mirror of
https://github.com/GTNewHorizons/Avaritia.git
synced 2026-11-26 06:53:22 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
da5cb1f6fb
commit
f32734a481
132 files changed
+7773
-7680
No files matched your search
@@ -1,8 +1,12 @@
|
||||
package fox.spiteful.avaritia;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
@@ -20,69 +24,67 @@ import fox.spiteful.avaritia.entity.LudicrousEntities;
|
||||
import fox.spiteful.avaritia.gui.GooeyHandler;
|
||||
import fox.spiteful.avaritia.items.ItemFracturedOre;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
@Mod(modid = "Avaritia", name = "Avaritia", version = "GRADLETOKEN_VERSION", dependencies = "after:Thaumcraft;after:AWWayofTime;after:Botania")
|
||||
@Mod(
|
||||
modid = "Avaritia",
|
||||
name = "Avaritia",
|
||||
version = "GRADLETOKEN_VERSION",
|
||||
dependencies = "after:Thaumcraft;after:AWWayofTime;after:Botania")
|
||||
public class Avaritia {
|
||||
|
||||
@Instance
|
||||
public static Avaritia instance;
|
||||
|
||||
@SidedProxy(serverSide = "fox.spiteful.avaritia.CommonProxy", clientSide = "fox.spiteful.avaritia.ClientProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
public static CreativeTabs tab = new CreativeTabs("avaritia"){
|
||||
public static CreativeTabs tab = new CreativeTabs("avaritia") {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getTabIconItem(){
|
||||
public Item getTabIconItem() {
|
||||
return LudicrousItems.resource;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int func_151243_f()
|
||||
{
|
||||
public int func_151243_f() {
|
||||
return 5;
|
||||
}
|
||||
};
|
||||
|
||||
@EventHandler
|
||||
public void earlyGame(FMLPreInitializationEvent event){
|
||||
public void earlyGame(FMLPreInitializationEvent event) {
|
||||
instance = this;
|
||||
Config.configurate(event.getSuggestedConfigurationFile());
|
||||
LudicrousItems.grind();
|
||||
LudicrousBlocks.voxelize();
|
||||
Compat.census();
|
||||
if(Config.craftingOnly)
|
||||
return;
|
||||
if (Config.craftingOnly) return;
|
||||
|
||||
LudicrousEntities.letLooseTheDogsOfWar();
|
||||
proxy.prepareForPretty();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void midGame(FMLInitializationEvent event){
|
||||
public void midGame(FMLInitializationEvent event) {
|
||||
Grinder.artsAndCrafts();
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GooeyHandler());
|
||||
if(Config.craftingOnly)
|
||||
return;
|
||||
if (Config.craftingOnly) return;
|
||||
proxy.makeThingsPretty();
|
||||
MinecraftForge.EVENT_BUS.register(new LudicrousEvents());
|
||||
if(Config.fractured)
|
||||
ItemFracturedOre.brushUpUncomfortablyAgainstTheOreDictionary();
|
||||
if (Config.fractured) ItemFracturedOre.brushUpUncomfortablyAgainstTheOreDictionary();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void endGame(FMLPostInitializationEvent event){
|
||||
public void endGame(FMLPostInitializationEvent event) {
|
||||
Compat.compatify();
|
||||
Gregorizer.balance();
|
||||
if(Config.craftingOnly)
|
||||
return;
|
||||
if (Config.craftingOnly) return;
|
||||
Mincer.countThoseCalories();
|
||||
Grinder.lastMinuteChanges();
|
||||
Achievements.achieve();
|
||||
PotionHelper.healthInspection();
|
||||
proxy.theAfterPretty();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package fox.spiteful.avaritia;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderSnowball;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import fox.spiteful.avaritia.compat.CompatClient;
|
||||
@@ -13,64 +17,62 @@ import fox.spiteful.avaritia.render.CosmicItemRenderer;
|
||||
import fox.spiteful.avaritia.render.FancyHaloRenderer;
|
||||
import fox.spiteful.avaritia.render.FracturedOreRenderer;
|
||||
import fox.spiteful.avaritia.render.LudicrousRenderEvents;
|
||||
//import fox.spiteful.avaritia.render.MorvInABoxRenderer;
|
||||
import fox.spiteful.avaritia.render.RenderGapingVoid;
|
||||
import fox.spiteful.avaritia.render.RenderHeavenArrow;
|
||||
import fox.spiteful.avaritia.render.ShaderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderSnowball;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
|
||||
public static final double toDeg = (1.0/(Math.PI*2))*360.0;
|
||||
|
||||
@Override
|
||||
public void prepareForPretty() {
|
||||
CompatClient.earlyComprettify();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void makeThingsPretty() {
|
||||
FancyHaloRenderer shiny = new FancyHaloRenderer();
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.resource, shiny);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.singularity, shiny);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.endest_pearl, shiny);
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityEndestPearl.class, new RenderSnowball(LudicrousItems.endest_pearl));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGapingVoid.class, new RenderGapingVoid());
|
||||
|
||||
RenderHeavenArrow arrowrender = new RenderHeavenArrow();
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityHeavenArrow.class, arrowrender);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityHeavenSubArrow.class, arrowrender);
|
||||
|
||||
CosmicItemRenderer sparkly = new CosmicItemRenderer();
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.infinity_sword, sparkly);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.infinity_helm, sparkly);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.infinity_armor, sparkly);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.infinity_pants, sparkly);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.infinity_shoes, sparkly);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.matter_cluster, sparkly);
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.infinity_bow, new CosmicBowRenderer());
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.fractured_ore, new FracturedOreRenderer());
|
||||
|
||||
//MinecraftForgeClient.registerItemRenderer(LudicrousItems.morv_in_a_box, new MorvInABoxRenderer());
|
||||
|
||||
CompatClient.comprettify();
|
||||
|
||||
LudicrousRenderEvents fancyevents = new LudicrousRenderEvents();
|
||||
MinecraftForge.EVENT_BUS.register(fancyevents);
|
||||
FMLCommonHandler.instance().bus().register(fancyevents);
|
||||
|
||||
ShaderHelper.initShaders();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void theAfterPretty() {
|
||||
CompatClient.lateComprettify();
|
||||
}
|
||||
public static final double toDeg = (1.0 / (Math.PI * 2)) * 360.0;
|
||||
|
||||
@Override
|
||||
public void prepareForPretty() {
|
||||
CompatClient.earlyComprettify();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void makeThingsPretty() {
|
||||
FancyHaloRenderer shiny = new FancyHaloRenderer();
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.resource, shiny);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.singularity, shiny);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.endest_pearl, shiny);
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(
|
||||
EntityEndestPearl.class,
|
||||
new RenderSnowball(LudicrousItems.endest_pearl));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGapingVoid.class, new RenderGapingVoid());
|
||||
|
||||
RenderHeavenArrow arrowrender = new RenderHeavenArrow();
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityHeavenArrow.class, arrowrender);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityHeavenSubArrow.class, arrowrender);
|
||||
|
||||
CosmicItemRenderer sparkly = new CosmicItemRenderer();
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.infinity_sword, sparkly);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.infinity_helm, sparkly);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.infinity_armor, sparkly);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.infinity_pants, sparkly);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.infinity_shoes, sparkly);
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.matter_cluster, sparkly);
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.infinity_bow, new CosmicBowRenderer());
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.fractured_ore, new FracturedOreRenderer());
|
||||
|
||||
// MinecraftForgeClient.registerItemRenderer(LudicrousItems.morv_in_a_box, new MorvInABoxRenderer());
|
||||
|
||||
CompatClient.comprettify();
|
||||
|
||||
LudicrousRenderEvents fancyevents = new LudicrousRenderEvents();
|
||||
MinecraftForge.EVENT_BUS.register(fancyevents);
|
||||
FMLCommonHandler.instance().bus().register(fancyevents);
|
||||
|
||||
ShaderHelper.initShaders();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void theAfterPretty() {
|
||||
CompatClient.lateComprettify();
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,15 @@ package fox.spiteful.avaritia;
|
||||
|
||||
public class CommonProxy {
|
||||
|
||||
public void prepareForPretty() {
|
||||
|
||||
}
|
||||
|
||||
public void makeThingsPretty() {
|
||||
|
||||
}
|
||||
|
||||
public void theAfterPretty() {
|
||||
|
||||
}
|
||||
public void prepareForPretty() {
|
||||
|
||||
}
|
||||
|
||||
public void makeThingsPretty() {
|
||||
|
||||
}
|
||||
|
||||
public void theAfterPretty() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
package fox.spiteful.avaritia;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class Config {
|
||||
|
||||
public static boolean craftingOnly = false;
|
||||
@@ -53,20 +54,48 @@ public class Config {
|
||||
public static int modifier = 0;
|
||||
public static int multiplier = 0;
|
||||
|
||||
public static void configurate(File file){
|
||||
public static void configurate(File file) {
|
||||
Configuration conf = new Configuration(file);
|
||||
|
||||
try {
|
||||
conf.load();
|
||||
|
||||
craftingOnly = conf.get("general", "Crafting Only", craftingOnly, "Enable to completely disable most of the mod except for the Dire Crafting table. For if you just want the mod for Minetweaking purposes.").getBoolean(false);
|
||||
endStone = conf.get("general", "Use End Stone", endStone, "Disable to take end stone out of recipes").getBoolean(true);
|
||||
bedrockBreaker = conf.get("general", "Break Bedrock", bedrockBreaker, "Disable if you don't want the World Breaker to break unbreakable blocks").getBoolean(true);
|
||||
boringFood = conf.get("general", "Boring Food", boringFood, "Enable to keep the Ultimate Stew and Cosmic Meatballs from grabbing more ingredients").getBoolean(false);
|
||||
fractured = conf.get("general", "Fractured Ores", fractured, "Enable if you don't have Rotarycraft installed and want some buggy fractured ores").getBoolean(false);
|
||||
fast = conf.get("general", "Gotta Go Fast", fast, "Disable if the Infinity Boots' speed boost is too ridiculous").getBoolean(true);
|
||||
craftingOnly = conf.get(
|
||||
"general",
|
||||
"Crafting Only",
|
||||
craftingOnly,
|
||||
"Enable to completely disable most of the mod except for the Dire Crafting table. For if you just want the mod for Minetweaking purposes.")
|
||||
.getBoolean(false);
|
||||
endStone = conf.get("general", "Use End Stone", endStone, "Disable to take end stone out of recipes")
|
||||
.getBoolean(true);
|
||||
bedrockBreaker = conf.get(
|
||||
"general",
|
||||
"Break Bedrock",
|
||||
bedrockBreaker,
|
||||
"Disable if you don't want the World Breaker to break unbreakable blocks").getBoolean(true);
|
||||
boringFood = conf
|
||||
.get(
|
||||
"general",
|
||||
"Boring Food",
|
||||
boringFood,
|
||||
"Enable to keep the Ultimate Stew and Cosmic Meatballs from grabbing more ingredients")
|
||||
.getBoolean(false);
|
||||
fractured = conf
|
||||
.get(
|
||||
"general",
|
||||
"Fractured Ores",
|
||||
fractured,
|
||||
"Enable if you don't have Rotarycraft installed and want some buggy fractured ores")
|
||||
.getBoolean(false);
|
||||
fast = conf.get(
|
||||
"general",
|
||||
"Gotta Go Fast",
|
||||
fast,
|
||||
"Disable if the Infinity Boots' speed boost is too ridiculous").getBoolean(true);
|
||||
|
||||
conf.addCustomCategoryComment("compatibility", "Disable to stop compatibility with that particular mod. Will not use the mod in recipes or add new items for that mod.");
|
||||
conf.addCustomCategoryComment(
|
||||
"compatibility",
|
||||
"Disable to stop compatibility with that particular mod. Will not use the mod in recipes or add new items for that mod.");
|
||||
thaumic = conf.get("compatibility", "Thaumcraft", true).getBoolean(true);
|
||||
sc2 = conf.get("compatibility", "Steve's Carts 2", true).getBoolean(true);
|
||||
ae2 = conf.get("compatibility", "Applied Energistics 2", true).getBoolean(true);
|
||||
@@ -93,7 +122,9 @@ public class Config {
|
||||
witch = conf.get("compatibility", "Witchery", true).getBoolean(true);
|
||||
rotisserie = conf.get("compatibility", "Rotarycraft", true).getBoolean(true);
|
||||
|
||||
conf.addCustomCategoryComment("materials", "Disable to stop using that material in recipes. Useful if a mod adds unobtainable placeholder ores.");
|
||||
conf.addCustomCategoryComment(
|
||||
"materials",
|
||||
"Disable to stop using that material in recipes. Useful if a mod adds unobtainable placeholder ores.");
|
||||
copper = conf.get("materials", "Copper", true).getBoolean(true);
|
||||
tin = conf.get("materials", "Tin", true).getBoolean(true);
|
||||
silver = conf.get("materials", "Silver", true).getBoolean(true);
|
||||
@@ -104,13 +135,22 @@ public class Config {
|
||||
darksteel = conf.get("compatibility", "DarkSteel", true).getBoolean(true);
|
||||
ultimateBalance = conf.get("materials", "Clay", true).getBoolean(true);
|
||||
|
||||
modifier = conf.get("balance!", "Cost Modifier", 0, "Added to the existing modifier to make prices more expensive or cheaper. Can be negative.").getInt(0);
|
||||
multiplier = conf.get("balance!", "Cost Multiplier", 0, "Added to the existing multiplier to make prices more expensive or cheaper. Can be negative.").getInt(0);
|
||||
}
|
||||
catch(Exception e){
|
||||
modifier = conf
|
||||
.get(
|
||||
"balance!",
|
||||
"Cost Modifier",
|
||||
0,
|
||||
"Added to the existing modifier to make prices more expensive or cheaper. Can be negative.")
|
||||
.getInt(0);
|
||||
multiplier = conf.get(
|
||||
"balance!",
|
||||
"Cost Multiplier",
|
||||
0,
|
||||
"Added to the existing multiplier to make prices more expensive or cheaper. Can be negative.")
|
||||
.getInt(0);
|
||||
} catch (Exception e) {
|
||||
Lumberjack.log(Level.ERROR, e, "Avaritia couldn't find its config!");
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
conf.save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +1,36 @@
|
||||
package fox.spiteful.avaritia;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EntityDamageSource;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class DamageSourceInfinitySword extends EntityDamageSource {
|
||||
|
||||
private static final Random randy = new Random();
|
||||
|
||||
public DamageSourceInfinitySword(Entity source){
|
||||
public DamageSourceInfinitySword(Entity source) {
|
||||
super("infinity", source);
|
||||
}
|
||||
|
||||
public IChatComponent func_151519_b(EntityLivingBase p_151519_1_)
|
||||
{
|
||||
ItemStack itemstack = this.damageSourceEntity instanceof EntityLivingBase ? ((EntityLivingBase)this.damageSourceEntity).getHeldItem() : null;
|
||||
public IChatComponent func_151519_b(EntityLivingBase p_151519_1_) {
|
||||
ItemStack itemstack = this.damageSourceEntity instanceof EntityLivingBase
|
||||
? ((EntityLivingBase) this.damageSourceEntity).getHeldItem()
|
||||
: null;
|
||||
String s = "death.attack.infinity";
|
||||
int rando = randy.nextInt(5);
|
||||
if(rando != 0)
|
||||
s = s + "." + rando;
|
||||
return new ChatComponentTranslation(s, new Object[] {p_151519_1_.func_145748_c_(), this.damageSourceEntity.func_145748_c_()});
|
||||
if (rando != 0) s = s + "." + rando;
|
||||
return new ChatComponentTranslation(
|
||||
s,
|
||||
new Object[] { p_151519_1_.func_145748_c_(), this.damageSourceEntity.func_145748_c_() });
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDifficultyScaled()
|
||||
{
|
||||
public boolean isDifficultyScaled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,31 +6,32 @@ import java.lang.reflect.Method;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class FieldHelper {
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T get(Field field, Object instance) {
|
||||
try {
|
||||
return (T) field.get(instance);
|
||||
} catch(Exception e) {
|
||||
Lumberjack.log(Level.ERROR, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <T> void set(Field field, Object instance, T value) {
|
||||
try {
|
||||
field.set(instance, value);
|
||||
} catch(Exception e) {
|
||||
Lumberjack.log(Level.ERROR, e);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T invoke(Method method, Object instance, Object... params) {
|
||||
try {
|
||||
return (T) method.invoke(instance, params);
|
||||
} catch(Exception e) {
|
||||
Lumberjack.log(Level.ERROR, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T get(Field field, Object instance) {
|
||||
try {
|
||||
return (T) field.get(instance);
|
||||
} catch (Exception e) {
|
||||
Lumberjack.log(Level.ERROR, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <T> void set(Field field, Object instance, T value) {
|
||||
try {
|
||||
field.set(instance, value);
|
||||
} catch (Exception e) {
|
||||
Lumberjack.log(Level.ERROR, e);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T invoke(Method method, Object instance, Object... params) {
|
||||
try {
|
||||
return (T) method.invoke(instance, params);
|
||||
} catch (Exception e) {
|
||||
Lumberjack.log(Level.ERROR, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,22 @@
|
||||
package fox.spiteful.avaritia;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import fox.spiteful.avaritia.items.ItemArmorInfinity;
|
||||
import fox.spiteful.avaritia.items.ItemFracturedOre;
|
||||
import fox.spiteful.avaritia.items.ItemMatterCluster;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import fox.spiteful.avaritia.items.tools.ItemPickaxeInfinity;
|
||||
import fox.spiteful.avaritia.items.tools.ItemSwordInfinity;
|
||||
import fox.spiteful.avaritia.items.tools.ToolHelper;
|
||||
import static net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
|
||||
import static net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
@@ -33,45 +30,53 @@ import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import static net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
|
||||
import static net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import fox.spiteful.avaritia.items.ItemFracturedOre;
|
||||
import fox.spiteful.avaritia.items.ItemMatterCluster;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import fox.spiteful.avaritia.items.tools.ItemSwordInfinity;
|
||||
import fox.spiteful.avaritia.items.tools.ToolHelper;
|
||||
|
||||
public class LudicrousEvents {
|
||||
|
||||
private static Random randy = new Random();
|
||||
static final String[] trash = new String[]{"dirt", "sand", "gravel", "cobblestone", "netherrack"};
|
||||
static final String[] trash = new String[] { "dirt", "sand", "gravel", "cobblestone", "netherrack" };
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerMine(PlayerInteractEvent event) {
|
||||
if(!Config.bedrockBreaker || event.face == -1 || event.world.isRemote || event.action != PlayerInteractEvent.Action.LEFT_CLICK_BLOCK || event.entityPlayer.getHeldItem() == null || event.entityPlayer.capabilities.isCreativeMode)
|
||||
if (!Config.bedrockBreaker || event.face == -1
|
||||
|| event.world.isRemote
|
||||
|| event.action != PlayerInteractEvent.Action.LEFT_CLICK_BLOCK
|
||||
|| event.entityPlayer.getHeldItem() == null
|
||||
|| event.entityPlayer.capabilities.isCreativeMode)
|
||||
return;
|
||||
Block block = event.world.getBlock(event.x, event.y, event.z);
|
||||
int meta = event.world.getBlockMetadata(event.x, event.y, event.z);
|
||||
if(block.getBlockHardness(event.entityPlayer.worldObj, event.x, event.y, event.z) <= -1 &&
|
||||
event.entityPlayer.getHeldItem().getItem() == LudicrousItems.infinity_pickaxe &&
|
||||
(block.getMaterial() == Material.rock || block.getMaterial() == Material.iron)){
|
||||
if (block.getBlockHardness(event.entityPlayer.worldObj, event.x, event.y, event.z) <= -1
|
||||
&& event.entityPlayer.getHeldItem().getItem() == LudicrousItems.infinity_pickaxe
|
||||
&& (block.getMaterial() == Material.rock || block.getMaterial() == Material.iron)) {
|
||||
|
||||
if(event.entityPlayer.getHeldItem().getTagCompound() != null && event.entityPlayer.getHeldItem().getTagCompound().getBoolean("hammer")) {
|
||||
LudicrousItems.infinity_pickaxe.onBlockStartBreak(event.entityPlayer.getHeldItem(), event.x, event.y, event.z, event.entityPlayer);
|
||||
}
|
||||
else {
|
||||
if (event.entityPlayer.getHeldItem().getTagCompound() != null
|
||||
&& event.entityPlayer.getHeldItem().getTagCompound().getBoolean("hammer")) {
|
||||
LudicrousItems.infinity_pickaxe.onBlockStartBreak(
|
||||
event.entityPlayer.getHeldItem(),
|
||||
event.x,
|
||||
event.y,
|
||||
event.z,
|
||||
event.entityPlayer);
|
||||
} else {
|
||||
|
||||
if(block.quantityDropped(randy) == 0) {
|
||||
ItemStack drop = block.getPickBlock(ToolHelper.raytraceFromEntity(event.world, event.entityPlayer, true, 10),
|
||||
event.world, event.x, event.y, event.z, event.entityPlayer);
|
||||
if(drop == null)
|
||||
drop = new ItemStack(block, 1, meta);
|
||||
if (block.quantityDropped(randy) == 0) {
|
||||
ItemStack drop = block.getPickBlock(
|
||||
ToolHelper.raytraceFromEntity(event.world, event.entityPlayer, true, 10),
|
||||
event.world,
|
||||
event.x,
|
||||
event.y,
|
||||
event.z,
|
||||
event.entityPlayer);
|
||||
if (drop == null) drop = new ItemStack(block, 1, meta);
|
||||
dropItem(drop, event.entityPlayer.worldObj, event.x, event.y, event.z);
|
||||
}
|
||||
else
|
||||
block.harvestBlock(event.world, event.entityPlayer, event.x, event.y, event.z, meta);
|
||||
} else block.harvestBlock(event.world, event.entityPlayer, event.x, event.y, event.z, meta);
|
||||
event.entityPlayer.worldObj.setBlockToAir(event.x, event.y, event.z);
|
||||
event.world.playAuxSFX(2001, event.x, event.y, event.z, Block.getIdFromBlock(block) + (meta << 12));
|
||||
}
|
||||
@@ -80,24 +85,21 @@ public class LudicrousEvents {
|
||||
|
||||
@SubscribeEvent
|
||||
public void handleExtraLuck(HarvestDropsEvent event) {
|
||||
if(event.harvester == null)
|
||||
return;
|
||||
if(event.harvester.getHeldItem() == null)
|
||||
return;
|
||||
if (event.harvester == null) return;
|
||||
if (event.harvester.getHeldItem() == null) return;
|
||||
ItemStack held = event.harvester.getHeldItem();
|
||||
if(held.getItem() == LudicrousItems.infinity_pickaxe) {
|
||||
extraLuck(event, 4);
|
||||
if (held.getItem() == LudicrousItems.infinity_pickaxe) {
|
||||
extraLuck(event, 4);
|
||||
|
||||
if (held.getTagCompound() != null && held.getTagCompound().getBoolean("hammer")
|
||||
&& ToolHelper.hammering.contains(event.harvester)
|
||||
&& ToolHelper.hammerdrops.containsKey(event.harvester)
|
||||
&& ToolHelper.hammerdrops.get(event.harvester) != null) {
|
||||
if (held.getTagCompound() != null && held.getTagCompound().getBoolean("hammer")
|
||||
&& ToolHelper.hammering.contains(event.harvester)
|
||||
&& ToolHelper.hammerdrops.containsKey(event.harvester)
|
||||
&& ToolHelper.hammerdrops.get(event.harvester) != null) {
|
||||
|
||||
ToolHelper.hammerdrops.get(event.harvester).addAll(event.drops);
|
||||
event.drops.clear();
|
||||
ToolHelper.hammerdrops.get(event.harvester).addAll(event.drops);
|
||||
event.drops.clear();
|
||||
}
|
||||
}
|
||||
else if(held.getItem() == LudicrousItems.infinity_shovel) {
|
||||
} else if (held.getItem() == LudicrousItems.infinity_shovel) {
|
||||
|
||||
if (held.getTagCompound() != null && held.getTagCompound().getBoolean("destroyer")
|
||||
&& ToolHelper.hammering.contains(event.harvester)
|
||||
@@ -105,21 +107,18 @@ public class LudicrousEvents {
|
||||
&& ToolHelper.hammerdrops.get(event.harvester) != null) {
|
||||
|
||||
ArrayList<ItemStack> garbage = new ArrayList<ItemStack>();
|
||||
for(ItemStack drop : event.drops){
|
||||
if(isGarbage(drop))
|
||||
garbage.add(drop);
|
||||
for (ItemStack drop : event.drops) {
|
||||
if (isGarbage(drop)) garbage.add(drop);
|
||||
}
|
||||
for(ItemStack junk : garbage){
|
||||
for (ItemStack junk : garbage) {
|
||||
event.drops.remove(junk);
|
||||
}
|
||||
ToolHelper.hammerdrops.get(event.harvester).addAll(event.drops);
|
||||
event.drops.clear();
|
||||
}
|
||||
}
|
||||
else if(held.getItem() == LudicrousItems.infinity_axe) {
|
||||
} else if (held.getItem() == LudicrousItems.infinity_axe) {
|
||||
|
||||
if (ToolHelper.hammering.contains(event.harvester)
|
||||
&& ToolHelper.hammerdrops.containsKey(event.harvester)
|
||||
if (ToolHelper.hammering.contains(event.harvester) && ToolHelper.hammerdrops.containsKey(event.harvester)
|
||||
&& ToolHelper.hammerdrops.get(event.harvester) != null) {
|
||||
|
||||
ToolHelper.hammerdrops.get(event.harvester).addAll(event.drops);
|
||||
@@ -128,51 +127,51 @@ public class LudicrousEvents {
|
||||
}
|
||||
}
|
||||
|
||||
public static void extraLuck(HarvestDropsEvent event, int mult){
|
||||
if(event.block.getMaterial() == Material.rock){
|
||||
List<ItemStack> adds = new ArrayList<ItemStack>();
|
||||
List<ItemStack> removals = new ArrayList<ItemStack>();
|
||||
for(ItemStack drop : event.drops){
|
||||
if(drop.getItem() != Item.getItemFromBlock(event.block) && !(drop.getItem() instanceof ItemBlock)){
|
||||
public static void extraLuck(HarvestDropsEvent event, int mult) {
|
||||
if (event.block.getMaterial() == Material.rock) {
|
||||
List<ItemStack> adds = new ArrayList<ItemStack>();
|
||||
List<ItemStack> removals = new ArrayList<ItemStack>();
|
||||
for (ItemStack drop : event.drops) {
|
||||
if (drop.getItem() != Item.getItemFromBlock(event.block) && !(drop.getItem() instanceof ItemBlock)) {
|
||||
drop.stackSize = Math.min(drop.stackSize * mult, drop.getMaxStackSize());
|
||||
}
|
||||
else if(Config.fractured && drop.getItem() == Item.getItemFromBlock(event.block))
|
||||
{
|
||||
ItemFracturedOre ifo = (ItemFracturedOre)LudicrousItems.fractured_ore;
|
||||
} else if (Config.fractured && drop.getItem() == Item.getItemFromBlock(event.block)) {
|
||||
ItemFracturedOre ifo = (ItemFracturedOre) LudicrousItems.fractured_ore;
|
||||
int[] oreids = OreDictionary.getOreIDs(drop);
|
||||
for (int i=0; i<oreids.length; i++) {
|
||||
String orename = OreDictionary.getOreName(oreids[i]);
|
||||
if (orename.startsWith("ore")) {
|
||||
// add the fractured ores
|
||||
adds.add(ifo.getStackForOre(drop, Math.min(drop.stackSize * (mult+1), drop.getMaxStackSize())));
|
||||
removals.add(drop);
|
||||
break;
|
||||
}
|
||||
for (int i = 0; i < oreids.length; i++) {
|
||||
String orename = OreDictionary.getOreName(oreids[i]);
|
||||
if (orename.startsWith("ore")) {
|
||||
// add the fractured ores
|
||||
adds.add(
|
||||
ifo.getStackForOre(
|
||||
drop,
|
||||
Math.min(drop.stackSize * (mult + 1), drop.getMaxStackSize())));
|
||||
removals.add(drop);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
event.drops.addAll(adds);
|
||||
event.drops.removeAll(removals);
|
||||
event.drops.addAll(adds);
|
||||
event.drops.removeAll(removals);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isGarbage(ItemStack drop) {
|
||||
for(int id : OreDictionary.getOreIDs(drop)) {
|
||||
for(String ore : trash) {
|
||||
if(OreDictionary.getOreName(id).equals(ore))
|
||||
return true;
|
||||
for (int id : OreDictionary.getOreIDs(drop)) {
|
||||
for (String ore : trash) {
|
||||
if (OreDictionary.getOreName(id).equals(ore)) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void dropItem(ItemStack drop, World world, int x, int y, int z){
|
||||
public static void dropItem(ItemStack drop, World world, int x, int y, int z) {
|
||||
float f = 0.7F;
|
||||
double d0 = (double)(randy.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
|
||||
double d1 = (double)(randy.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
|
||||
double d2 = (double)(randy.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(world, (double)x + d0, (double)y + d1, (double)z + d2, drop);
|
||||
double d0 = (double) (randy.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d1 = (double) (randy.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d2 = (double) (randy.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(world, (double) x + d0, (double) y + d1, (double) z + d2, drop);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
@@ -180,10 +179,16 @@ public class LudicrousEvents {
|
||||
@SubscribeEvent
|
||||
public void onTooltip(ItemTooltipEvent event) {
|
||||
if (event.itemStack.getItem() instanceof ItemSwordInfinity) {
|
||||
for(int x = 0;x < event.toolTip.size();x++){
|
||||
if(event.toolTip.get(x).contains(StatCollector.translateToLocal("attribute.name.generic.attackDamage"))
|
||||
|| event.toolTip.get(x).contains(StatCollector.translateToLocal("Attack Damage"))){
|
||||
event.toolTip.set(x, EnumChatFormatting.BLUE + "+" + LudicrousText.makeFabulous(StatCollector.translateToLocal("tip.infinity")) + " " + EnumChatFormatting.BLUE + StatCollector.translateToLocal("attribute.name.generic.attackDamage"));
|
||||
for (int x = 0; x < event.toolTip.size(); x++) {
|
||||
if (event.toolTip.get(x).contains(StatCollector.translateToLocal("attribute.name.generic.attackDamage"))
|
||||
|| event.toolTip.get(x).contains(StatCollector.translateToLocal("Attack Damage"))) {
|
||||
event.toolTip.set(
|
||||
x,
|
||||
EnumChatFormatting.BLUE + "+"
|
||||
+ LudicrousText.makeFabulous(StatCollector.translateToLocal("tip.infinity"))
|
||||
+ " "
|
||||
+ EnumChatFormatting.BLUE
|
||||
+ StatCollector.translateToLocal("attribute.name.generic.attackDamage"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -191,73 +196,70 @@ public class LudicrousEvents {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onGetHurt(LivingHurtEvent event){
|
||||
if(!(event.entityLiving instanceof EntityPlayer))
|
||||
return;
|
||||
EntityPlayer player = (EntityPlayer)event.entityLiving;
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() == LudicrousItems.infinity_sword && player.isUsingItem())
|
||||
event.setCanceled(true);
|
||||
if(LudicrousItems.isInfinite(player) && !event.source.damageType.equals("infinity"))
|
||||
public void onGetHurt(LivingHurtEvent event) {
|
||||
if (!(event.entityLiving instanceof EntityPlayer)) return;
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() == LudicrousItems.infinity_sword
|
||||
&& player.isUsingItem())
|
||||
event.setCanceled(true);
|
||||
if (LudicrousItems.isInfinite(player) && !event.source.damageType.equals("infinity")) event.setCanceled(true);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onAttacked(LivingAttackEvent event) {
|
||||
if(!(event.entityLiving instanceof EntityPlayer))
|
||||
return;
|
||||
if(event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer)
|
||||
return;
|
||||
EntityPlayer player = (EntityPlayer)event.entityLiving;
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() == LudicrousItems.infinity_sword && player.isUsingItem())
|
||||
event.setCanceled(true);
|
||||
if(LudicrousItems.isInfinite(player) && !event.source.damageType.equals("infinity"))
|
||||
if (!(event.entityLiving instanceof EntityPlayer)) return;
|
||||
if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) return;
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() == LudicrousItems.infinity_sword
|
||||
&& player.isUsingItem())
|
||||
event.setCanceled(true);
|
||||
if (LudicrousItems.isInfinite(player) && !event.source.damageType.equals("infinity")) event.setCanceled(true);
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingDrops(LivingDropsEvent event) {
|
||||
if(event.recentlyHit && event.entityLiving instanceof EntitySkeleton && event.source.getEntity() instanceof EntityPlayer){
|
||||
EntityPlayer player = (EntityPlayer)event.source.getEntity();
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() == LudicrousItems.skull_sword){
|
||||
// ok, we need to drop a skull then.
|
||||
if (event.drops.isEmpty()) {
|
||||
addDrop(event, new ItemStack(Items.skull, 1, 1));
|
||||
} else {
|
||||
int skulls = 0;
|
||||
|
||||
for (int i=0; i<event.drops.size(); i++) {
|
||||
EntityItem drop = event.drops.get(i);
|
||||
ItemStack stack = drop.getEntityItem();
|
||||
if (stack.getItem() == Items.skull) {
|
||||
if (stack.getItemDamage() == 1) {
|
||||
skulls++;
|
||||
} else if (stack.getItemDamage() == 0) {
|
||||
skulls++;
|
||||
stack.setItemDamage(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (skulls == 0) {
|
||||
addDrop(event, new ItemStack(Items.skull, 1, 1));
|
||||
}
|
||||
}
|
||||
|
||||
if (event.recentlyHit && event.entityLiving instanceof EntitySkeleton
|
||||
&& event.source.getEntity() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() == LudicrousItems.skull_sword) {
|
||||
// ok, we need to drop a skull then.
|
||||
if (event.drops.isEmpty()) {
|
||||
addDrop(event, new ItemStack(Items.skull, 1, 1));
|
||||
} else {
|
||||
int skulls = 0;
|
||||
|
||||
for (int i = 0; i < event.drops.size(); i++) {
|
||||
EntityItem drop = event.drops.get(i);
|
||||
ItemStack stack = drop.getEntityItem();
|
||||
if (stack.getItem() == Items.skull) {
|
||||
if (stack.getItemDamage() == 1) {
|
||||
skulls++;
|
||||
} else if (stack.getItemDamage() == 0) {
|
||||
skulls++;
|
||||
stack.setItemDamage(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (skulls == 0) {
|
||||
addDrop(event, new ItemStack(Items.skull, 1, 1));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void diggity(BreakSpeed event){
|
||||
if(event.entityPlayer.getHeldItem() != null){
|
||||
public void diggity(BreakSpeed event) {
|
||||
if (event.entityPlayer.getHeldItem() != null) {
|
||||
ItemStack held = event.entityPlayer.getHeldItem();
|
||||
if(held.getItem() == LudicrousItems.infinity_pickaxe || held.getItem() == LudicrousItems.infinity_shovel){
|
||||
if(!event.entityPlayer.onGround)
|
||||
if (held.getItem() == LudicrousItems.infinity_pickaxe || held.getItem() == LudicrousItems.infinity_shovel) {
|
||||
if (!event.entityPlayer.onGround) event.newSpeed *= 5;
|
||||
if (!event.entityPlayer.isInsideOfMaterial(Material.water)
|
||||
&& !EnchantmentHelper.getAquaAffinityModifier(event.entityPlayer))
|
||||
event.newSpeed *= 5;
|
||||
if(!event.entityPlayer.isInsideOfMaterial(Material.water) && !EnchantmentHelper.getAquaAffinityModifier(event.entityPlayer))
|
||||
event.newSpeed *= 5;
|
||||
if(held.getTagCompound() != null) {
|
||||
if (held.getTagCompound() != null) {
|
||||
if (held.getTagCompound().getBoolean("hammer") || held.getTagCompound().getBoolean("destroyer")) {
|
||||
event.newSpeed *= 0.5;
|
||||
}
|
||||
@@ -267,31 +269,31 @@ public class LudicrousEvents {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void canHarvest(PlayerEvent.HarvestCheck event){
|
||||
if(event.entityPlayer.getHeldItem() != null){
|
||||
public void canHarvest(PlayerEvent.HarvestCheck event) {
|
||||
if (event.entityPlayer.getHeldItem() != null) {
|
||||
ItemStack held = event.entityPlayer.getHeldItem();
|
||||
if(held.getItem() == LudicrousItems.infinity_shovel && event.block.getMaterial() == Material.rock){
|
||||
if(held.getTagCompound() != null && held.getTagCompound().getBoolean("destroyer") && isGarbageBlock(event.block))
|
||||
if (held.getItem() == LudicrousItems.infinity_shovel && event.block.getMaterial() == Material.rock) {
|
||||
if (held.getTagCompound() != null && held.getTagCompound().getBoolean("destroyer")
|
||||
&& isGarbageBlock(event.block))
|
||||
event.success = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isGarbageBlock(Block block) {
|
||||
for(int id : OreDictionary.getOreIDs(new ItemStack(block, 1))) {
|
||||
for (int id : OreDictionary.getOreIDs(new ItemStack(block, 1))) {
|
||||
String ore = OreDictionary.getOreName(id);
|
||||
if(ore.equals("cobblestone") || ore.equals("stone") || ore.equals("netherrack"))
|
||||
return true;
|
||||
if (ore.equals("cobblestone") || ore.equals("stone") || ore.equals("netherrack")) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDeath(LivingDeathEvent event){
|
||||
if(event.entityLiving instanceof EntityPlayer){
|
||||
EntityPlayer player = (EntityPlayer)event.entityLiving;
|
||||
if(LudicrousItems.isInfinite(player) && !event.source.getDamageType().equals("infinity")){
|
||||
public void onDeath(LivingDeathEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
if (LudicrousItems.isInfinite(player) && !event.source.getDamageType().equals("infinity")) {
|
||||
event.setCanceled(true);
|
||||
player.setHealth(player.getMaxHealth());
|
||||
}
|
||||
@@ -299,26 +301,31 @@ public class LudicrousEvents {
|
||||
}
|
||||
|
||||
private void addDrop(LivingDropsEvent event, ItemStack drop) {
|
||||
EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, drop);
|
||||
EntityItem entityitem = new EntityItem(
|
||||
event.entityLiving.worldObj,
|
||||
event.entityLiving.posX,
|
||||
event.entityLiving.posY,
|
||||
event.entityLiving.posZ,
|
||||
drop);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
event.drops.add(entityitem);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void clusterClustererererer(EntityItemPickupEvent event) {
|
||||
if(event.entityPlayer != null && event.item.getEntityItem().getItem() == LudicrousItems.matter_cluster) {
|
||||
ItemStack stack = event.item.getEntityItem();
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
|
||||
for (int i=0; i<player.inventory.mainInventory.length; i++) {
|
||||
if (stack.stackSize == 0) {
|
||||
break;
|
||||
}
|
||||
ItemStack slot = player.inventory.mainInventory[i];
|
||||
if (slot != null && slot.getItem() != null && slot.getItem() == LudicrousItems.matter_cluster) {
|
||||
ItemMatterCluster.mergeClusters(stack, slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.entityPlayer != null && event.item.getEntityItem().getItem() == LudicrousItems.matter_cluster) {
|
||||
ItemStack stack = event.item.getEntityItem();
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
|
||||
for (int i = 0; i < player.inventory.mainInventory.length; i++) {
|
||||
if (stack.stackSize == 0) {
|
||||
break;
|
||||
}
|
||||
ItemStack slot = player.inventory.mainInventory[i];
|
||||
if (slot != null && slot.getItem() != null && slot.getItem() == LudicrousItems.matter_cluster) {
|
||||
ItemMatterCluster.mergeClusters(stack, slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,38 +1,45 @@
|
||||
package fox.spiteful.avaritia;
|
||||
|
||||
import static net.minecraft.util.EnumChatFormatting.*;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import static net.minecraft.util.EnumChatFormatting.*;
|
||||
|
||||
public class LudicrousText {
|
||||
|
||||
private static final EnumChatFormatting[] fabulousness = new EnumChatFormatting[] {RED, GOLD, YELLOW, GREEN, AQUA, BLUE, LIGHT_PURPLE};
|
||||
public static String makeFabulous(String input) {
|
||||
return ludicrousFormatting(input, fabulousness, 80.0, 1, 1);
|
||||
}
|
||||
|
||||
private static final EnumChatFormatting[] sanic = new EnumChatFormatting[] {BLUE, BLUE, BLUE, BLUE, WHITE, BLUE, WHITE, WHITE, BLUE, WHITE, WHITE, BLUE, RED, WHITE, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY};
|
||||
public static String makeSANIC(String input) {
|
||||
return ludicrousFormatting(input, sanic, 50.0, 2,1);
|
||||
}
|
||||
|
||||
public static String ludicrousFormatting(String input, EnumChatFormatting[] colours, double delay, int step, int posstep) {
|
||||
StringBuilder sb = new StringBuilder(input.length()*3);
|
||||
if (delay <= 0) {
|
||||
delay = 0.001;
|
||||
}
|
||||
|
||||
int offset = (int) Math.floor(Minecraft.getSystemTime() / delay) % colours.length;
|
||||
|
||||
for (int i=0; i<input.length(); i++) {
|
||||
char c = input.charAt(i);
|
||||
|
||||
int col = ((i * posstep) + colours.length - offset) % colours.length;
|
||||
|
||||
sb.append(colours[col].toString());
|
||||
sb.append(c);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
private static final EnumChatFormatting[] fabulousness = new EnumChatFormatting[] { RED, GOLD, YELLOW, GREEN, AQUA,
|
||||
BLUE, LIGHT_PURPLE };
|
||||
|
||||
public static String makeFabulous(String input) {
|
||||
return ludicrousFormatting(input, fabulousness, 80.0, 1, 1);
|
||||
}
|
||||
|
||||
private static final EnumChatFormatting[] sanic = new EnumChatFormatting[] { BLUE, BLUE, BLUE, BLUE, WHITE, BLUE,
|
||||
WHITE, WHITE, BLUE, WHITE, WHITE, BLUE, RED, WHITE, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY,
|
||||
GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY };
|
||||
|
||||
public static String makeSANIC(String input) {
|
||||
return ludicrousFormatting(input, sanic, 50.0, 2, 1);
|
||||
}
|
||||
|
||||
public static String ludicrousFormatting(String input, EnumChatFormatting[] colours, double delay, int step,
|
||||
int posstep) {
|
||||
StringBuilder sb = new StringBuilder(input.length() * 3);
|
||||
if (delay <= 0) {
|
||||
delay = 0.001;
|
||||
}
|
||||
|
||||
int offset = (int) Math.floor(Minecraft.getSystemTime() / delay) % colours.length;
|
||||
|
||||
for (int i = 0; i < input.length(); i++) {
|
||||
char c = input.charAt(i);
|
||||
|
||||
int col = ((i * posstep) + colours.length - offset) % colours.length;
|
||||
|
||||
sb.append(colours[col].toString());
|
||||
sb.append(c);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package fox.spiteful.avaritia;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class Lumberjack {
|
||||
|
||||
public static final Logger logger = LogManager.getLogger("Avaritia");
|
||||
@@ -15,8 +16,8 @@ public class Lumberjack {
|
||||
public static void log(Level level, Object message) {
|
||||
logger.log(level, message);
|
||||
}
|
||||
|
||||
|
||||
public static void info(Object message) {
|
||||
log(Level.INFO, message);
|
||||
log(Level.INFO, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +1,34 @@
|
||||
package fox.spiteful.avaritia;
|
||||
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraft.potion.Potion;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.minecraft.potion.Potion;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public class PotionHelper {
|
||||
|
||||
private static ArrayList<Potion> badPotions;
|
||||
|
||||
public static void healthInspection(){
|
||||
public static void healthInspection() {
|
||||
badPotions = new ArrayList<Potion>();
|
||||
try {
|
||||
Field stupidMojangPrivateVariable = ReflectionHelper.findField(Potion.class, "isBadEffect", "field_76418_K");
|
||||
Field stupidMojangPrivateVariable = ReflectionHelper
|
||||
.findField(Potion.class, "isBadEffect", "field_76418_K");
|
||||
|
||||
for(Potion potion : Potion.potionTypes){
|
||||
if(potion != null && stupidMojangPrivateVariable.getBoolean(potion))
|
||||
badPotions.add(potion);
|
||||
for (Potion potion : Potion.potionTypes) {
|
||||
if (potion != null && stupidMojangPrivateVariable.getBoolean(potion)) badPotions.add(potion);
|
||||
}
|
||||
}
|
||||
catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
Lumberjack.log(Level.ERROR, e, "Failure to get potions");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean badPotion(Potion effect){
|
||||
public static boolean badPotion(Potion effect) {
|
||||
return badPotions.contains(effect);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,28 @@
|
||||
package fox.spiteful.avaritia.achievements;
|
||||
|
||||
import static net.minecraftforge.event.world.BlockEvent.BreakEvent;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import fox.spiteful.avaritia.blocks.LudicrousBlocks;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
|
||||
import static net.minecraftforge.event.world.BlockEvent.BreakEvent;
|
||||
|
||||
public class AchievementTrigger {
|
||||
|
||||
/*@SubscribeEvent
|
||||
public void onItemPickedUp(PlayerEvent.ItemPickupEvent event) {
|
||||
ItemStack stack = event.pickedUp.getEntityItem();
|
||||
|
||||
}*/
|
||||
/*
|
||||
* @SubscribeEvent public void onItemPickedUp(PlayerEvent.ItemPickupEvent event) { ItemStack stack =
|
||||
* event.pickedUp.getEntityItem(); }
|
||||
*/
|
||||
|
||||
@SubscribeEvent
|
||||
public void onItemCrafted(PlayerEvent.ItemCraftedEvent event) {
|
||||
if(event.crafting != null){
|
||||
if (event.crafting != null) {
|
||||
|
||||
if(event.crafting.getItem() == LudicrousItems.resource){
|
||||
switch(event.crafting.getItemDamage()){
|
||||
if (event.crafting.getItem() == LudicrousItems.resource) {
|
||||
switch (event.crafting.getItemDamage()) {
|
||||
case 1:
|
||||
event.player.addStat(Achievements.crystal_matrix, 1);
|
||||
return;
|
||||
@@ -38,17 +36,13 @@ public class AchievementTrigger {
|
||||
event.player.addStat(Achievements.infinity, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(event.crafting.getItem() == Item.getItemFromBlock(LudicrousBlocks.dire_crafting)){
|
||||
} else if (event.crafting.getItem() == Item.getItemFromBlock(LudicrousBlocks.dire_crafting)) {
|
||||
event.player.addStat(Achievements.dire_crafting, 1);
|
||||
}
|
||||
else if(event.crafting.getItem() == Item.getItemFromBlock(LudicrousBlocks.neutron_collector)){
|
||||
} else if (event.crafting.getItem() == Item.getItemFromBlock(LudicrousBlocks.neutron_collector)) {
|
||||
event.player.addStat(Achievements.collector, 1);
|
||||
}
|
||||
else if(event.crafting.getItem() == LudicrousItems.singularity){
|
||||
} else if (event.crafting.getItem() == LudicrousItems.singularity) {
|
||||
event.player.addStat(Achievements.singularity, 1);
|
||||
}
|
||||
else if(Compat.blood && event.crafting.getItem() == LudicrousItems.armok_orb){
|
||||
} else if (Compat.blood && event.crafting.getItem() == LudicrousItems.armok_orb) {
|
||||
event.player.addStat(Achievements.armok, 1);
|
||||
}
|
||||
}
|
||||
@@ -56,17 +50,17 @@ public class AchievementTrigger {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onItemSmelted(PlayerEvent.ItemSmeltedEvent event) {
|
||||
if(event.smelting != null){
|
||||
if (event.smelting != null) {
|
||||
|
||||
if(event.smelting.getItem() == LudicrousItems.singularity){
|
||||
if (event.smelting.getItem() == LudicrousItems.singularity) {
|
||||
event.player.addStat(Achievements.singularity, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBorken(BreakEvent event){
|
||||
if(event.block == LudicrousBlocks.dire_crafting && event.getPlayer() != null)
|
||||
public void onBorken(BreakEvent event) {
|
||||
if (event.block == LudicrousBlocks.dire_crafting && event.getPlayer() != null)
|
||||
event.getPlayer().addStat(Achievements.dire_uncrafting, 1);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
package fox.spiteful.avaritia.achievements;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import fox.spiteful.avaritia.blocks.LudicrousBlocks;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraftforge.common.AchievementPage;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import fox.spiteful.avaritia.blocks.LudicrousBlocks;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
|
||||
public class Achievements {
|
||||
|
||||
public static AchievementPage page;
|
||||
@@ -27,21 +27,59 @@ public class Achievements {
|
||||
|
||||
public static Achievement creative_kill;
|
||||
|
||||
public static void achieve(){
|
||||
crystal_matrix = new LudicrousAchievement("crystal_matrix", 0, 0, new ItemStack(LudicrousItems.resource, 1, 1), null);
|
||||
dire_crafting = new LudicrousAchievement("dire_crafting", 1, 1, new ItemStack(LudicrousBlocks.dire_crafting), crystal_matrix);
|
||||
collector = new LudicrousAchievement("collector", 2, 2, new ItemStack(LudicrousBlocks.neutron_collector), dire_crafting);
|
||||
neutronium = new LudicrousAchievement("neutronium", 4, 1, new ItemStack(LudicrousItems.resource, 1, 4), collector);
|
||||
singularity = new LudicrousAchievement("singularity", 6, 3, new ItemStack(LudicrousItems.singularity, 1, 0), neutronium);
|
||||
catalyst = new LudicrousAchievement("catalyst", 6, -3, new ItemStack(LudicrousItems.resource, 1, 5), singularity).setSpecial();
|
||||
infinity = new LudicrousAchievement("infinity", 4, -6, new ItemStack(LudicrousItems.resource, 1, 6), neutronium).setSpecial();
|
||||
creative_kill = new LudicrousAchievement("creative_kill", -6, -6, new ItemStack(Items.skull, 1, 3), null).setSpecial();
|
||||
dire_uncrafting = new LudicrousAchievement("dire_uncrafting", -1, 3, new ItemStack(Items.diamond_pickaxe), dire_crafting);
|
||||
public static void achieve() {
|
||||
crystal_matrix = new LudicrousAchievement(
|
||||
"crystal_matrix",
|
||||
0,
|
||||
0,
|
||||
new ItemStack(LudicrousItems.resource, 1, 1),
|
||||
null);
|
||||
dire_crafting = new LudicrousAchievement(
|
||||
"dire_crafting",
|
||||
1,
|
||||
1,
|
||||
new ItemStack(LudicrousBlocks.dire_crafting),
|
||||
crystal_matrix);
|
||||
collector = new LudicrousAchievement(
|
||||
"collector",
|
||||
2,
|
||||
2,
|
||||
new ItemStack(LudicrousBlocks.neutron_collector),
|
||||
dire_crafting);
|
||||
neutronium = new LudicrousAchievement(
|
||||
"neutronium",
|
||||
4,
|
||||
1,
|
||||
new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
collector);
|
||||
singularity = new LudicrousAchievement(
|
||||
"singularity",
|
||||
6,
|
||||
3,
|
||||
new ItemStack(LudicrousItems.singularity, 1, 0),
|
||||
neutronium);
|
||||
catalyst = new LudicrousAchievement(
|
||||
"catalyst",
|
||||
6,
|
||||
-3,
|
||||
new ItemStack(LudicrousItems.resource, 1, 5),
|
||||
singularity).setSpecial();
|
||||
infinity = new LudicrousAchievement("infinity", 4, -6, new ItemStack(LudicrousItems.resource, 1, 6), neutronium)
|
||||
.setSpecial();
|
||||
creative_kill = new LudicrousAchievement("creative_kill", -6, -6, new ItemStack(Items.skull, 1, 3), null)
|
||||
.setSpecial();
|
||||
dire_uncrafting = new LudicrousAchievement(
|
||||
"dire_uncrafting",
|
||||
-1,
|
||||
3,
|
||||
new ItemStack(Items.diamond_pickaxe),
|
||||
dire_crafting);
|
||||
|
||||
if(Compat.blood)
|
||||
armok = new LudicrousAchievement("armok", 2, -5, LudicrousItems.armok_orb, infinity);
|
||||
if (Compat.blood) armok = new LudicrousAchievement("armok", 2, -5, LudicrousItems.armok_orb, infinity);
|
||||
|
||||
page = new AchievementPage("Avaritia", LudicrousAchievement.achievements.toArray(new Achievement[LudicrousAchievement.achievements.size()]));
|
||||
page = new AchievementPage(
|
||||
"Avaritia",
|
||||
LudicrousAchievement.achievements.toArray(new Achievement[LudicrousAchievement.achievements.size()]));
|
||||
AchievementPage.registerAchievementPage(page);
|
||||
|
||||
AchievementTrigger tigger = new AchievementTrigger();
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package fox.spiteful.avaritia.achievements;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LudicrousAchievement extends Achievement {
|
||||
|
||||
public static List<Achievement> achievements = new ArrayList();
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package fox.spiteful.avaritia.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.tile.TileEntityCompressor;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -19,14 +17,17 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.tile.TileEntityCompressor;
|
||||
|
||||
public class BlockCompressor extends BlockContainer {
|
||||
|
||||
private IIcon top, sides, front;
|
||||
private Random randy = new Random();
|
||||
|
||||
public BlockCompressor(){
|
||||
public BlockCompressor() {
|
||||
super(Material.iron);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setHardness(20.0F);
|
||||
@@ -37,8 +38,7 @@ public class BlockCompressor extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.top = iconRegister.registerIcon("avaritia:compressor_top");
|
||||
this.sides = iconRegister.registerIcon("avaritia:compressor_side");
|
||||
this.front = iconRegister.registerIcon("avaritia:compressor_front");
|
||||
@@ -46,79 +46,61 @@ public class BlockCompressor extends BlockContainer {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
if(side == 1)
|
||||
return top;
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
if (side == 1) return top;
|
||||
int facing = 2;
|
||||
TileEntityCompressor machine = (TileEntityCompressor)world.getTileEntity(x, y, z);
|
||||
if(machine != null)
|
||||
facing = machine.getFacing();
|
||||
if(side == facing)
|
||||
return front;
|
||||
else
|
||||
return sides;
|
||||
TileEntityCompressor machine = (TileEntityCompressor) world.getTileEntity(x, y, z);
|
||||
if (machine != null) facing = machine.getFacing();
|
||||
if (side == facing) return front;
|
||||
else return sides;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int metadata)
|
||||
{
|
||||
if(side == 1)
|
||||
return top;
|
||||
if(side == 3)
|
||||
return front;
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
if (side == 1) return top;
|
||||
if (side == 3) return front;
|
||||
return sides;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7,
|
||||
float par8, float par9) {
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
player.openGui(Avaritia.instance, 3, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityCompressor();
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack item)
|
||||
{
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack item) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TileEntityCompressor) {
|
||||
TileEntityCompressor machine = (TileEntityCompressor)tile;
|
||||
if (tile instanceof TileEntityCompressor) {
|
||||
TileEntityCompressor machine = (TileEntityCompressor) tile;
|
||||
int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
|
||||
if (l == 0)
|
||||
machine.setFacing(2);
|
||||
if (l == 0) machine.setFacing(2);
|
||||
|
||||
if (l == 1)
|
||||
machine.setFacing(5);
|
||||
if (l == 1) machine.setFacing(5);
|
||||
|
||||
if (l == 2)
|
||||
machine.setFacing(3);
|
||||
if (l == 2) machine.setFacing(3);
|
||||
|
||||
if (l == 3)
|
||||
machine.setFacing(4);
|
||||
if (l == 3) machine.setFacing(4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int wut)
|
||||
{
|
||||
TileEntityCompressor compressor = (TileEntityCompressor)world.getTileEntity(x, y, z);
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int wut) {
|
||||
TileEntityCompressor compressor = (TileEntityCompressor) world.getTileEntity(x, y, z);
|
||||
|
||||
if (compressor != null)
|
||||
{
|
||||
for(int i = 0;i < 2;i++) {
|
||||
if (compressor != null) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
ItemStack itemstack = compressor.getStackInSlot(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
@@ -134,10 +116,16 @@ public class BlockCompressor extends BlockContainer {
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(world, (double) ((float) x + f), (double) ((float) y + f1), (double) ((float) z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
EntityItem entityitem = new EntityItem(
|
||||
world,
|
||||
(double) ((float) x + f),
|
||||
(double) ((float) y + f1),
|
||||
(double) ((float) z + f2),
|
||||
new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
entityitem.getEntityItem()
|
||||
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package fox.spiteful.avaritia.blocks;
|
||||
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
|
||||
public class BlockCrystalMatrix extends Block {
|
||||
|
||||
public BlockCrystalMatrix(){
|
||||
public BlockCrystalMatrix() {
|
||||
super(Material.iron);
|
||||
setStepSound(Block.soundTypeGlass);
|
||||
setHardness(50.0F);
|
||||
@@ -20,12 +21,12 @@ public class BlockCrystalMatrix extends Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ){
|
||||
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity){
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package fox.spiteful.avaritia.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.tile.TileEntityDireCrafting;
|
||||
import fox.spiteful.avaritia.tile.TileEntityNeutron;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -17,13 +14,17 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.tile.TileEntityDireCrafting;
|
||||
|
||||
public class BlockDireCrafting extends BlockContainer {
|
||||
|
||||
private static IIcon top, sides, bottom;
|
||||
private Random randy = new Random();
|
||||
|
||||
public BlockDireCrafting(){
|
||||
public BlockDireCrafting() {
|
||||
super(Material.iron);
|
||||
setStepSound(Block.soundTypeGlass);
|
||||
setHardness(50.0F);
|
||||
@@ -35,8 +36,7 @@ public class BlockDireCrafting extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
top = iconRegister.registerIcon("avaritia:dire_crafting_top");
|
||||
sides = iconRegister.registerIcon("avaritia:dire_crafting_side");
|
||||
bottom = iconRegister.registerIcon("avaritia:block_crystal_matrix");
|
||||
@@ -44,42 +44,33 @@ public class BlockDireCrafting extends BlockContainer {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int metadata)
|
||||
{
|
||||
if (side == 0)
|
||||
return bottom;
|
||||
if (side == 1)
|
||||
return top;
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
if (side == 0) return bottom;
|
||||
if (side == 1) return top;
|
||||
return sides;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7,
|
||||
float par8, float par9) {
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
player.openGui(Avaritia.instance, 1, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityDireCrafting();
|
||||
}
|
||||
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int wut)
|
||||
{
|
||||
TileEntityDireCrafting craft = (TileEntityDireCrafting)world.getTileEntity(x, y, z);
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int wut) {
|
||||
TileEntityDireCrafting craft = (TileEntityDireCrafting) world.getTileEntity(x, y, z);
|
||||
|
||||
if (craft != null)
|
||||
{
|
||||
for(int i = 1;i < 82;i++) {
|
||||
if (craft != null) {
|
||||
for (int i = 1; i < 82; i++) {
|
||||
ItemStack itemstack = craft.getStackInSlot(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
@@ -95,10 +86,16 @@ public class BlockDireCrafting extends BlockContainer {
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(world, (double) ((float) x + f), (double) ((float) y + f1), (double) ((float) z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
EntityItem entityitem = new EntityItem(
|
||||
world,
|
||||
(double) ((float) x + f),
|
||||
(double) ((float) y + f1),
|
||||
(double) ((float) z + f2),
|
||||
new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
entityitem.getEntityItem()
|
||||
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package fox.spiteful.avaritia.blocks;
|
||||
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
|
||||
public class BlockDoubleCraft extends Block {
|
||||
|
||||
public BlockDoubleCraft(){
|
||||
public BlockDoubleCraft() {
|
||||
super(Material.wood);
|
||||
setHardness(4.0F);
|
||||
setBlockName("compressed_workbench");
|
||||
@@ -21,14 +20,11 @@ public class BlockDoubleCraft extends Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7,
|
||||
float par8, float par9) {
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
player.openGui(Avaritia.instance, 0, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package fox.spiteful.avaritia.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.tile.TileEntityNeutron;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -14,20 +12,22 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.tile.TileEntityNeutron;
|
||||
|
||||
public class BlockNeutronCollector extends BlockContainer {
|
||||
|
||||
private IIcon top, sides, front;
|
||||
private Random randy = new Random();
|
||||
|
||||
public BlockNeutronCollector(){
|
||||
|
||||
public BlockNeutronCollector() {
|
||||
super(Material.iron);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setHardness(20.0F);
|
||||
@@ -38,8 +38,7 @@ public class BlockNeutronCollector extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.top = iconRegister.registerIcon("avaritia:collector_top");
|
||||
this.sides = iconRegister.registerIcon("avaritia:collector_side");
|
||||
this.front = iconRegister.registerIcon("avaritia:collector_front");
|
||||
@@ -47,114 +46,97 @@ public class BlockNeutronCollector extends BlockContainer {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
if(side == 1)
|
||||
return top;
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
if (side == 1) return top;
|
||||
int facing = 2;
|
||||
TileEntityNeutron machine = (TileEntityNeutron)world.getTileEntity(x, y, z);
|
||||
if(machine != null)
|
||||
facing = machine.getFacing();
|
||||
if(side == facing)
|
||||
return front;
|
||||
else
|
||||
return sides;
|
||||
TileEntityNeutron machine = (TileEntityNeutron) world.getTileEntity(x, y, z);
|
||||
if (machine != null) facing = machine.getFacing();
|
||||
if (side == facing) return front;
|
||||
else return sides;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int metadata)
|
||||
{
|
||||
if(side == 1)
|
||||
return top;
|
||||
if(side == 3)
|
||||
return front;
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
if (side == 1) return top;
|
||||
if (side == 3) return front;
|
||||
return sides;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7,
|
||||
float par8, float par9) {
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
player.openGui(Avaritia.instance, 2, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityNeutron();
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack item)
|
||||
{
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack item) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TileEntityNeutron) {
|
||||
TileEntityNeutron machine = (TileEntityNeutron)tile;
|
||||
if (tile instanceof TileEntityNeutron) {
|
||||
TileEntityNeutron machine = (TileEntityNeutron) tile;
|
||||
int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
|
||||
if (l == 0)
|
||||
machine.setFacing(2);
|
||||
if (l == 0) machine.setFacing(2);
|
||||
|
||||
if (l == 1)
|
||||
machine.setFacing(5);
|
||||
if (l == 1) machine.setFacing(5);
|
||||
|
||||
if (l == 2)
|
||||
machine.setFacing(3);
|
||||
if (l == 2) machine.setFacing(3);
|
||||
|
||||
if (l == 3)
|
||||
machine.setFacing(4);
|
||||
if (l == 3) machine.setFacing(4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int wut)
|
||||
{
|
||||
TileEntityNeutron collector = (TileEntityNeutron)world.getTileEntity(x, y, z);
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int wut) {
|
||||
TileEntityNeutron collector = (TileEntityNeutron) world.getTileEntity(x, y, z);
|
||||
|
||||
if (collector != null)
|
||||
{
|
||||
ItemStack itemstack = collector.getStackInSlot(0);
|
||||
if (collector != null) {
|
||||
ItemStack itemstack = collector.getStackInSlot(0);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
float f = this.randy.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.randy.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.randy.nextFloat() * 0.8F + 0.1F;
|
||||
if (itemstack != null) {
|
||||
float f = this.randy.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.randy.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.randy.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0)
|
||||
{
|
||||
int j1 = this.randy.nextInt(21) + 10;
|
||||
while (itemstack.stackSize > 0) {
|
||||
int j1 = this.randy.nextInt(21) + 10;
|
||||
|
||||
if (j1 > itemstack.stackSize)
|
||||
{
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (double)((float)this.randy.nextGaussian() * f3);
|
||||
entityitem.motionY = (double)((float)this.randy.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motionZ = (double)((float)this.randy.nextGaussian() * f3);
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
if (j1 > itemstack.stackSize) {
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
world.func_147453_f(x, y, z, block);
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(
|
||||
world,
|
||||
(double) ((float) x + f),
|
||||
(double) ((float) y + f1),
|
||||
(double) ((float) z + f2),
|
||||
new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (double) ((float) this.randy.nextGaussian() * f3);
|
||||
entityitem.motionY = (double) ((float) this.randy.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motionZ = (double) ((float) this.randy.nextGaussian() * f3);
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
|
||||
world.func_147453_f(x, y, z, block);
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, wut);
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,27 @@
|
||||
package fox.spiteful.avaritia.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
|
||||
public class BlockResource extends Block {
|
||||
|
||||
public static final String[] types = new String[]{"neutronium", "infinity"};
|
||||
public static final String[] types = new String[] { "neutronium", "infinity" };
|
||||
private IIcon[] icons;
|
||||
|
||||
public BlockResource(){
|
||||
public BlockResource() {
|
||||
super(Material.iron);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setHardness(50.0F);
|
||||
@@ -33,38 +32,34 @@ public class BlockResource extends Block {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return this.icons[metadata % types.length];
|
||||
}
|
||||
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
public int damageDropped(int metadata) {
|
||||
return metadata;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list){
|
||||
for(int x = 0;x < types.length;x++)
|
||||
list.add(new ItemStack(item, 1, x));
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (int x = 0; x < types.length; x++) list.add(new ItemStack(item, 1, x));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister){
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[types.length];
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("avaritia:block_" + types[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ){
|
||||
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity){
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,15 @@
|
||||
package fox.spiteful.avaritia.blocks;
|
||||
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
|
||||
public class BlockTripleCraft extends Block {
|
||||
|
||||
public BlockTripleCraft(){
|
||||
public BlockTripleCraft() {
|
||||
super(Material.wood);
|
||||
setHardness(8.0F);
|
||||
setBlockName("very_compressed_workbench");
|
||||
@@ -21,14 +20,11 @@ public class BlockTripleCraft extends Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7,
|
||||
float par8, float par9) {
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
player.openGui(Avaritia.instance, 0, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -23,4 +23,4 @@ public class ItemBlockResource extends ItemBlock {
|
||||
|
||||
return "tile.block_" + BlockResource.types[itemStack.getItemDamage() % BlockResource.types.length];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,14 +5,14 @@ import net.minecraft.item.ItemBlockWithMetadata;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemBlockWithMetadataUnderp extends ItemBlockWithMetadata {
|
||||
public ItemBlockWithMetadataUnderp(Block block) {
|
||||
super(block, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack)
|
||||
{
|
||||
int meta = stack.getItemDamage();
|
||||
|
||||
public ItemBlockWithMetadataUnderp(Block block) {
|
||||
super(block, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
int meta = stack.getItemDamage();
|
||||
return this.field_150939_a.getUnlocalizedName() + meta;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package fox.spiteful.avaritia.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import fox.spiteful.avaritia.Config;
|
||||
import fox.spiteful.avaritia.tile.TileEntityCompressor;
|
||||
import fox.spiteful.avaritia.tile.TileEntityDireCrafting;
|
||||
import fox.spiteful.avaritia.tile.TileEntityNeutron;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
|
||||
public class LudicrousBlocks {
|
||||
|
||||
@@ -14,8 +14,7 @@ public class LudicrousBlocks {
|
||||
public static Block triple_craft;
|
||||
public static Block crystal_matrix;
|
||||
/**
|
||||
* 0 = Neutronium,
|
||||
* 1 = Infinity
|
||||
* 0 = Neutronium, 1 = Infinity
|
||||
*/
|
||||
public static Block resource_block;
|
||||
public static Block dire_crafting;
|
||||
@@ -24,14 +23,13 @@ public class LudicrousBlocks {
|
||||
|
||||
public static Block infinitato;
|
||||
|
||||
public static void voxelize(){
|
||||
public static void voxelize() {
|
||||
double_craft = GameRegistry.registerBlock(new BlockDoubleCraft(), "Double_Craft");
|
||||
triple_craft = GameRegistry.registerBlock(new BlockTripleCraft(), "Triple_Craft");
|
||||
dire_crafting = GameRegistry.registerBlock(new BlockDireCrafting(), "Dire_Crafting");
|
||||
GameRegistry.registerTileEntity(TileEntityDireCrafting.class, "Avaritia_Dire_Craft");
|
||||
|
||||
if(Config.craftingOnly)
|
||||
return;
|
||||
if (Config.craftingOnly) return;
|
||||
|
||||
crystal_matrix = GameRegistry.registerBlock(new BlockCrystalMatrix(), "Crystal_Matrix");
|
||||
resource_block = GameRegistry.registerBlock(new BlockResource(), ItemBlockResource.class, "Resource_Block");
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package fox.spiteful.avaritia.compat;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import com.emoniph.witchery.util.CreatureUtil;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class Belmont {
|
||||
|
||||
public static boolean isVampire(Entity entity){
|
||||
public static boolean isVampire(Entity entity) {
|
||||
|
||||
if(Loader.isModLoaded("witchery")){
|
||||
if (Loader.isModLoaded("witchery")) {
|
||||
try {
|
||||
return CreatureUtil.isVampire(entity);
|
||||
}
|
||||
catch(Throwable e){}
|
||||
} catch (Throwable e) {}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
package fox.spiteful.avaritia.compat;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import fox.spiteful.avaritia.Config;
|
||||
@@ -16,13 +24,6 @@ import fox.spiteful.avaritia.compat.ticon.Tonkers;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
|
||||
import fox.spiteful.avaritia.crafting.Grinder;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class Compat {
|
||||
|
||||
@@ -43,7 +44,7 @@ public class Compat {
|
||||
public static boolean forestry = false;
|
||||
public static boolean te = false;
|
||||
|
||||
public static void census(){
|
||||
public static void census() {
|
||||
nei = Loader.isModLoaded("NotEnoughItems");
|
||||
tweak = Loader.isModLoaded("MineTweaker3");
|
||||
thaumic = Loader.isModLoaded("Thaumcraft") && Config.thaumic;
|
||||
@@ -62,74 +63,65 @@ public class Compat {
|
||||
te = Loader.isModLoaded("ThermalExpansion") && Config.te;
|
||||
}
|
||||
|
||||
public static void compatify(){
|
||||
if(nei){
|
||||
try
|
||||
{
|
||||
public static void compatify() {
|
||||
if (nei) {
|
||||
try {
|
||||
NotEnough.items();
|
||||
}
|
||||
catch(Throwable e)
|
||||
{
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, e, "Avaritia had Too Many Items.");
|
||||
}
|
||||
}
|
||||
|
||||
if(tweak){
|
||||
try
|
||||
{
|
||||
if (tweak) {
|
||||
try {
|
||||
Tweak.registrate();
|
||||
}
|
||||
catch(Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, e, "Avaritia is too good for tweaking, apparently.");
|
||||
}
|
||||
}
|
||||
|
||||
if(Config.craftingOnly)
|
||||
return;
|
||||
if (Config.craftingOnly) return;
|
||||
|
||||
if(thaumic){
|
||||
try
|
||||
{
|
||||
if (thaumic) {
|
||||
try {
|
||||
Lucrum.abracadabra();
|
||||
}
|
||||
catch(Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, "Avaritia accumulated too much Warp!");
|
||||
e.printStackTrace();
|
||||
thaumic = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("StevesCarts") && Config.sc2){
|
||||
if (Loader.isModLoaded("StevesCarts") && Config.sc2) {
|
||||
try {
|
||||
Block resource = getBlock("StevesCarts", "BlockMetalStorage");
|
||||
ItemStack galg = new ItemStack(resource, 1, 2);
|
||||
Grinder.catalyst.getInput().add(galg);
|
||||
}
|
||||
catch(Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, "Avaritia died of old age while trying to craft the Galgadorian Drill.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if(ae2){
|
||||
if (ae2) {
|
||||
try {
|
||||
Item resource = getItem("appliedenergistics2", "item.ItemMultiMaterial");
|
||||
if(Loader.isModLoaded("extracells") && Config.extracells){
|
||||
if (Loader.isModLoaded("extracells") && Config.extracells) {
|
||||
Item extracell = getItem("extracells", "storage.component");
|
||||
//16mb cell
|
||||
// 16mb cell
|
||||
Grinder.catalyst.getInput().add(new ItemStack(extracell, 1, 3));
|
||||
}
|
||||
else {
|
||||
//64k Cell
|
||||
} else {
|
||||
// 64k Cell
|
||||
Grinder.catalyst.getInput().add(new ItemStack(resource, 1, 38));
|
||||
}
|
||||
//Singularity
|
||||
// Singularity
|
||||
Grinder.catalyst.getInput().add(new ItemStack(resource, 1, 47));
|
||||
|
||||
Block creative = getBlock("appliedenergistics2", "tile.BlockCreativeEnergyCell");
|
||||
Block dense = getBlock("appliedenergistics2", "tile.BlockDenseEnergyCell");
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(creative, 1, 0),
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(creative, 1, 0),
|
||||
"IIIIDIIII",
|
||||
"IEEEDEEEI",
|
||||
"IEEEDEEEI",
|
||||
@@ -139,18 +131,20 @@ public class Compat {
|
||||
"IEEEDEEEI",
|
||||
"IEEEDEEEI",
|
||||
"IIIIDIIII",
|
||||
'D', new ItemStack(resource, 1, 24),
|
||||
'E', new ItemStack(dense, 1, 0),
|
||||
'I', new ItemStack(LudicrousItems.resource, 1, 6));
|
||||
}
|
||||
catch (Throwable e){
|
||||
'D',
|
||||
new ItemStack(resource, 1, 24),
|
||||
'E',
|
||||
new ItemStack(dense, 1, 0),
|
||||
'I',
|
||||
new ItemStack(LudicrousItems.resource, 1, 6));
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, "Avaritia couldn't figure out how channels work.");
|
||||
e.printStackTrace();
|
||||
ae2 = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(exu){
|
||||
if (exu) {
|
||||
try {
|
||||
Block bedrockium = getBlock("ExtraUtilities", "block_bedrockium");
|
||||
Block deco = getBlock("ExtraUtilities", "decorativeBlock1");
|
||||
@@ -158,139 +152,128 @@ public class Compat {
|
||||
ItemStack unstable = new ItemStack(deco, 1, 5);
|
||||
Grinder.catalyst.getInput().add(bed);
|
||||
Grinder.catalyst.getInput().add(unstable);
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, "Avaritia was unable to stop Lavos.");
|
||||
e.printStackTrace();
|
||||
exu = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(ic2){
|
||||
if (ic2) {
|
||||
try {
|
||||
if(gt){
|
||||
if (gt) {
|
||||
try {
|
||||
Item resource = getItem("gregtech", "gt.metaitem.01");
|
||||
ItemStack lolneutronium = new ItemStack(resource, 1, 9129);
|
||||
Grinder.catalyst.getInput().add(lolneutronium);
|
||||
}
|
||||
catch(Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, "Avaritia got sick of only getting 2 planks per log.");
|
||||
e.printStackTrace();
|
||||
gt = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!gt){
|
||||
if (!gt) {
|
||||
Item iridium = getItem("IC2", "itemPartIridium");
|
||||
ItemStack plate = new ItemStack(iridium, 1, 0);
|
||||
Grinder.catalyst.getInput().add(plate);
|
||||
}
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, "Avaritia blew up the macerator.");
|
||||
e.printStackTrace();
|
||||
ic2 = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(botan){
|
||||
if (botan) {
|
||||
try {
|
||||
Tsundere.baka();
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, "Avaritia is wondering where all the dayblooms went.");
|
||||
e.printStackTrace();
|
||||
botan = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(blood){
|
||||
if (blood) {
|
||||
try {
|
||||
Bloody.bloodlett();
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, "Avaritia decided to use a Fallen Kanade instead.");
|
||||
e.printStackTrace();
|
||||
blood = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("DraconicEvolution") && Config.lolDargon){
|
||||
if (Loader.isModLoaded("DraconicEvolution") && Config.lolDargon) {
|
||||
try {
|
||||
Block dargon = getBlock("DraconicEvolution", "draconicBlock");
|
||||
ItemStack lol = new ItemStack(dargon, 1, 0);
|
||||
Grinder.catalyst.getInput().add(lol);
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, e, "Avaritia was distracted by a giant glowing sphere.");
|
||||
}
|
||||
}
|
||||
|
||||
if(bigReactors){
|
||||
if (bigReactors) {
|
||||
try {
|
||||
Item ingot = getItem("BigReactors", "BRIngot");
|
||||
ItemStack ludicrite = new ItemStack(ingot, 1, 8);
|
||||
Grinder.catalyst.getInput().add(ludicrite);
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, "Avaritia decided it just didn't need all that RF.");
|
||||
e.printStackTrace();
|
||||
bigReactors = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(ticon){
|
||||
if (ticon) {
|
||||
try {
|
||||
Block metal = getBlock("TConstruct", "MetalBlock");
|
||||
ItemStack menomena = new ItemStack(metal, 1, 2);
|
||||
Grinder.catalyst.getInput().add(menomena);
|
||||
Tonkers.buildstruct();
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, "Avaritia fell in the smeltery.");
|
||||
e.printStackTrace();
|
||||
ticon = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(pe){
|
||||
if (pe) {
|
||||
try {
|
||||
Item matter = getItem("ProjectE", "item.pe_matter");
|
||||
ItemStack red = new ItemStack(matter, 1, 1);
|
||||
Grinder.catalyst.getInput().add(red);
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, "Avaritia got tired of abusing the blaze rod exploit.");
|
||||
e.printStackTrace();
|
||||
pe = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(mfr){
|
||||
if (mfr) {
|
||||
try {
|
||||
Item ponk = getItem("MineFactoryReloaded", "pinkslime");
|
||||
ItemStack pank = new ItemStack(ponk, 1, 1);
|
||||
Grinder.catalyst.getInput().add(pank);
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, "Avaritia walked into the laser drill.");
|
||||
e.printStackTrace();
|
||||
mfr = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("TwilightForest") && Config.twilight){
|
||||
if (Loader.isModLoaded("TwilightForest") && Config.twilight) {
|
||||
try {
|
||||
Item ironwood = getItem("TwilightForest", "item.ironwoodIngot");
|
||||
Grinder.catalyst.getInput().add(new ItemStack(ironwood, 1));
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, e, "Avaritia was killed by a hydra.");
|
||||
}
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("magicalcrops") && Config.magicrops){
|
||||
if (Loader.isModLoaded("magicalcrops") && Config.magicrops) {
|
||||
try {
|
||||
Item essence = getItem("magicalcrops", "magicalcrops_MagicEssence");
|
||||
Item meat = getItem("magicalcrops", "magicalcrops_RawMeat");
|
||||
@@ -308,23 +291,21 @@ public class Compat {
|
||||
OreDictionary.registerOre("cropTomato", new ItemStack(crop, 1, 8));
|
||||
OreDictionary.registerOre("rawMutton", new ItemStack(meat, 1, 0));
|
||||
OreDictionary.registerOre("rawCalamari", new ItemStack(meat, 1, 1));
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, e, "Avaritia got bored of waiting for magical crops to grow.");
|
||||
}
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("ganyssurface")){
|
||||
if (Loader.isModLoaded("ganyssurface")) {
|
||||
try {
|
||||
Item mutton = getItem("ganyssurface", "mutton_raw");
|
||||
OreDictionary.registerOre("rawMutton", new ItemStack(mutton, 1, 0));
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, e, "Avaritia forgot which Gany's mod it was dealing with.");
|
||||
}
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("harvestcraft")){
|
||||
if (Loader.isModLoaded("harvestcraft")) {
|
||||
try {
|
||||
Item mutton = getItem("harvestcraft", "muttonrawItem");
|
||||
Item beet = getItem("harvestcraft", "beetItem");
|
||||
@@ -332,61 +313,57 @@ public class Compat {
|
||||
OreDictionary.registerOre("rawMutton", new ItemStack(mutton, 1, 0));
|
||||
OreDictionary.registerOre("rawCalamari", new ItemStack(calamari, 1, 0));
|
||||
OreDictionary.registerOre("cropBeetroot", new ItemStack(beet, 1, 0));
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, "Avaritia got overwhelmed by all the food choices. D:");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("Natura")){
|
||||
if (Loader.isModLoaded("Natura")) {
|
||||
try {
|
||||
Item barley = getItem("Natura", "barleyFood");
|
||||
OreDictionary.registerOre("cropBarley", new ItemStack(barley, 1, 0));
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, e, "Avaritia got overwhelmed by all the food choices. D:");
|
||||
}
|
||||
}
|
||||
|
||||
if(am2){
|
||||
if (am2) {
|
||||
try {
|
||||
Item gem = getItem("arsmagica2", "itemOre");
|
||||
Item essence = getItem("arsmagica2", "essence");
|
||||
|
||||
Grinder.catalyst.getInput().add(new ItemStack(essence, 1, 10));
|
||||
Grinder.catalyst.getInput().add(new ItemStack(gem, 1, 6));
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, e, "Avaritia got sick of the arcane guardian's healspam.");
|
||||
am2 = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(forestry){
|
||||
if (forestry) {
|
||||
try {
|
||||
Ranger.stopForestFires();
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, e, "Avaritia got stung by a bee.");
|
||||
forestry = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("EE3") && Config.ee3){
|
||||
if (Loader.isModLoaded("EE3") && Config.ee3) {
|
||||
try {
|
||||
Block fuel = getBlock("EE3", "alchemicalFuelBlock");
|
||||
Grinder.catalyst.getInput().add(new ItemStack(fuel, 1, 2));
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, e, "Avaritia tried to do human transmutation.");
|
||||
}
|
||||
}
|
||||
|
||||
if(te){
|
||||
if (te) {
|
||||
try {
|
||||
Block cell = getBlock("ThermalExpansion", "Cell");
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(cell, 1, 0),
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(cell, 1, 0),
|
||||
"IIIIRIIII",
|
||||
"IEEEREEEI",
|
||||
"IERRRRREI",
|
||||
@@ -396,17 +373,20 @@ public class Compat {
|
||||
"IERRRRREI",
|
||||
"IEEEREEEI",
|
||||
"IIIIRIIII",
|
||||
'X', new ItemStack(LudicrousBlocks.resource_block, 1, 1),
|
||||
'E', "blockEnderium",
|
||||
'I', new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'R', new ItemStack(LudicrousItems.singularity, 1, 3));
|
||||
}
|
||||
catch (Throwable e){
|
||||
'X',
|
||||
new ItemStack(LudicrousBlocks.resource_block, 1, 1),
|
||||
'E',
|
||||
"blockEnderium",
|
||||
'I',
|
||||
new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'R',
|
||||
new ItemStack(LudicrousItems.singularity, 1, 3));
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, e, "Avaritia forgot one of Thermal Expansion's 500 prerequisites.");
|
||||
te = false;
|
||||
}
|
||||
}
|
||||
if(!Loader.isModLoaded("dreamcraft")) {
|
||||
if (!Loader.isModLoaded("dreamcraft")) {
|
||||
if (Loader.isModLoaded("witchery") && Config.witch) {
|
||||
try {
|
||||
Item ingredient = getItem("witchery", "ingredient");
|
||||
@@ -414,41 +394,42 @@ public class Compat {
|
||||
|
||||
Block egg = getBlock("witchery", "infinityegg");
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(egg, 1, 0),
|
||||
" NNN ",
|
||||
" NNNNN ",
|
||||
" NNNNN ",
|
||||
" NNNINNN ",
|
||||
"NNNIIINNN",
|
||||
"NNIIEIINN",
|
||||
"NNNIIINNN",
|
||||
" NNNINNN ",
|
||||
" NNNNN ",
|
||||
'N', new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
'E', new ItemStack(Blocks.dragon_egg),
|
||||
'I', new ItemStack(LudicrousItems.resource, 1, 6));
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(egg, 1, 0),
|
||||
" NNN ",
|
||||
" NNNNN ",
|
||||
" NNNNN ",
|
||||
" NNNINNN ",
|
||||
"NNNIIINNN",
|
||||
"NNIIEIINN",
|
||||
"NNNIIINNN",
|
||||
" NNNINNN ",
|
||||
" NNNNN ",
|
||||
'N',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
'E',
|
||||
new ItemStack(Blocks.dragon_egg),
|
||||
'I',
|
||||
new ItemStack(LudicrousItems.resource, 1, 6));
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, e, "Avaritia suffered from Curse of the Incompatibility.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("RotaryCraft") && Config.rotisserie){
|
||||
if (Loader.isModLoaded("RotaryCraft") && Config.rotisserie) {
|
||||
try {
|
||||
Item stuff = getItem("RotaryCraft", "rotarycraft_item_compacts");
|
||||
Grinder.catalyst.getInput().add(new ItemStack(stuff, 1, 3));
|
||||
}
|
||||
catch (Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, e, "Avaritia couldn't figure out how torque works.");
|
||||
}
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("Tails")){
|
||||
try
|
||||
{
|
||||
if (Loader.isModLoaded("Tails")) {
|
||||
try {
|
||||
InfiniteFoxes.floof();
|
||||
}
|
||||
catch(Throwable e){
|
||||
} catch (Throwable e) {
|
||||
Lumberjack.log(Level.INFO, "Avaritia was not fluffy enough!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -457,20 +438,19 @@ public class Compat {
|
||||
|
||||
public static Block getBlock(String mod, String block) throws ItemNotFoundException {
|
||||
Block target = GameRegistry.findBlock(mod, block);
|
||||
if(target == null)
|
||||
throw new ItemNotFoundException(mod, block);
|
||||
if (target == null) throw new ItemNotFoundException(mod, block);
|
||||
return target;
|
||||
}
|
||||
|
||||
public static Item getItem(String mod, String item) throws ItemNotFoundException {
|
||||
Item target = GameRegistry.findItem(mod, item);
|
||||
if(target == null)
|
||||
throw new ItemNotFoundException(mod, item);
|
||||
if (target == null) throw new ItemNotFoundException(mod, item);
|
||||
return target;
|
||||
}
|
||||
|
||||
public static class ItemNotFoundException extends Exception {
|
||||
public ItemNotFoundException(String mod, String item){
|
||||
|
||||
public ItemNotFoundException(String mod, String item) {
|
||||
super("Unable to find " + item + " in mod " + mod + "! Are you using the correct version of the mod?");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package fox.spiteful.avaritia.compat;
|
||||
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import fox.spiteful.avaritia.Config;
|
||||
@@ -9,28 +11,27 @@ import fox.spiteful.avaritia.compat.botania.TileInfinitato;
|
||||
import fox.spiteful.avaritia.compat.ticon.TonkersClient;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import fox.spiteful.avaritia.render.FancyHaloRenderer;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
public class CompatClient {
|
||||
|
||||
public static void earlyComprettify() {
|
||||
|
||||
}
|
||||
|
||||
public static void comprettify() {
|
||||
if (Compat.botan) {
|
||||
RenderingRegistry.registerBlockHandler(new RenderInfinitato(RenderingRegistry.getNextAvailableRenderId()));
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileInfinitato.class, new RenderTileInfinitato());
|
||||
}
|
||||
public static void earlyComprettify() {
|
||||
|
||||
if (Compat.ticon) {
|
||||
TonkersClient.dunkThosePaintbrushes();
|
||||
}
|
||||
}
|
||||
|
||||
public static void lateComprettify() {
|
||||
if(Compat.forestry && Config.bees){
|
||||
}
|
||||
|
||||
public static void comprettify() {
|
||||
if (Compat.botan) {
|
||||
RenderingRegistry.registerBlockHandler(new RenderInfinitato(RenderingRegistry.getNextAvailableRenderId()));
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileInfinitato.class, new RenderTileInfinitato());
|
||||
}
|
||||
|
||||
if (Compat.ticon) {
|
||||
TonkersClient.dunkThosePaintbrushes();
|
||||
}
|
||||
}
|
||||
|
||||
public static void lateComprettify() {
|
||||
if (Compat.forestry && Config.bees) {
|
||||
MinecraftForgeClient.registerItemRenderer(LudicrousItems.beesource, new FancyHaloRenderer());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
package fox.spiteful.avaritia.compat.bloodmagic;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
|
||||
import fox.spiteful.avaritia.crafting.Grinder;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class Bloody {
|
||||
|
||||
@@ -20,19 +21,12 @@ public class Bloody {
|
||||
GameRegistry.registerItem(LudicrousItems.armok_orb, "Orb_Armok");
|
||||
|
||||
Item transorb = Compat.getItem("AWWayofTime", "transcendentBloodOrb");
|
||||
ExtremeCraftingManager.getInstance().addRecipe(new ItemStack(LudicrousItems.armok_orb, 1), new Object[]{
|
||||
" III ",
|
||||
" IOIOI ",
|
||||
" IIXII ",
|
||||
" NIOIOIN ",
|
||||
"NNNIIINNN",
|
||||
" NNNNNNN ",
|
||||
" NNN ",
|
||||
'I', new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'X', new ItemStack(LudicrousItems.resource, 1, 5),
|
||||
'N', new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
'O', new ItemStack(transorb)
|
||||
});
|
||||
ExtremeCraftingManager.getInstance().addRecipe(
|
||||
new ItemStack(LudicrousItems.armok_orb, 1),
|
||||
new Object[] { " III ", " IOIOI ", " IIXII ", " NIOIOIN ", "NNNIIINNN", " NNNNNNN ",
|
||||
" NNN ", 'I', new ItemStack(LudicrousItems.resource, 1, 6), 'X',
|
||||
new ItemStack(LudicrousItems.resource, 1, 5), 'N', new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
'O', new ItemStack(transorb) });
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,7 @@
|
||||
package fox.spiteful.avaritia.compat.bloodmagic;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
@@ -15,11 +11,16 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
|
||||
public class ItemOrbArmok extends Item implements IBloodOrb, IBindable {
|
||||
|
||||
public ItemOrbArmok(){
|
||||
public ItemOrbArmok() {
|
||||
setMaxStackSize(1);
|
||||
this.setUnlocalizedName("orb_armok");
|
||||
this.setTextureName("avaritia:orb_armok");
|
||||
@@ -29,30 +30,28 @@ public class ItemOrbArmok extends Item implements IBloodOrb, IBindable {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) {
|
||||
if (!world.isRemote)
|
||||
SoulNetworkHandler.checkAndSetItemOwner(itemstack, player);
|
||||
if (!world.isRemote) SoulNetworkHandler.checkAndSetItemOwner(itemstack, player);
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) {
|
||||
if(!world.isRemote && entity instanceof EntityPlayer){
|
||||
if (!world.isRemote && entity instanceof EntityPlayer) {
|
||||
NBTTagCompound itemTag = stack.stackTagCompound;
|
||||
if (itemTag == null || itemTag.getString("ownerName").equals(""))
|
||||
return;
|
||||
if (itemTag == null || itemTag.getString("ownerName").equals("")) return;
|
||||
|
||||
SoulNetworkHandler.setCurrentEssence(itemTag.getString("ownerName"), getMaxEssence());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack item, EntityPlayer player, List tooltip, boolean wut)
|
||||
{
|
||||
public void addInformation(ItemStack item, EntityPlayer player, List tooltip, boolean wut) {
|
||||
tooltip.add(StatCollector.translateToLocal("tooltip.armok.desc"));
|
||||
if (item.getTagCompound() != null)
|
||||
{
|
||||
tooltip.add(StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + item.getTagCompound().getString("ownerName"));
|
||||
if (item.getTagCompound() != null) {
|
||||
tooltip.add(
|
||||
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
|
||||
+ item.getTagCompound().getString("ownerName"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,20 +71,17 @@ public class ItemOrbArmok extends Item implements IBloodOrb, IBindable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasContainerItem()
|
||||
{
|
||||
public boolean hasContainerItem() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack)
|
||||
{
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem(ItemStack itemStack)
|
||||
{
|
||||
public ItemStack getContainerItem(ItemStack itemStack) {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,111 +1,133 @@
|
||||
package fox.spiteful.avaritia.compat.botania;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
public class BlockInfinitato extends BlockContainer implements ILexiconable {
|
||||
public static LexiconEntry lexiconEntry;
|
||||
|
||||
public BlockInfinitato() {
|
||||
super(Material.cloth);
|
||||
setHardness(0.25F);
|
||||
setBlockName("infinitato");
|
||||
float f = 1F / 16F * 4F;
|
||||
setBlockBounds(f, 0, f, 1F - f, f*3, 1F - f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
}
|
||||
public static LexiconEntry lexiconEntry;
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return Blocks.hardened_clay.getIcon(0, 11);
|
||||
}
|
||||
public BlockInfinitato() {
|
||||
super(Material.cloth);
|
||||
setHardness(0.25F);
|
||||
setBlockName("infinitato");
|
||||
float f = 1F / 16F * 4F;
|
||||
setBlockBounds(f, 0, f, 1F - f, f * 3, 1F - f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if(tile instanceof TileInfinitato) {
|
||||
((TileInfinitato) tile).interact();
|
||||
par1World.spawnParticle("heart", par2 + minX + Math.random() * (maxX - minX), par3 + maxY, par4 + minZ + Math.random() * (maxZ - minZ), 0, 0 ,0);
|
||||
par1World.spawnParticle("heart", par2 + minX + Math.random() * (maxX - minX), par3 + maxY, par4 + minZ + Math.random() * (maxZ - minZ), 0, 0 ,0);
|
||||
par1World.spawnParticle("heart", par2 + minX + Math.random() * (maxX - minX), par3 + maxY, par4 + minZ + Math.random() * (maxZ - minZ), 0, 0 ,0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving, ItemStack par6ItemStack) {
|
||||
int l1 = MathHelper.floor_double(par5EntityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return Blocks.hardened_clay.getIcon(0, 11);
|
||||
}
|
||||
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, l1, 2);
|
||||
if (par6ItemStack.hasDisplayName())
|
||||
((TileInfinitato) par1World.getTileEntity(par2, par3, par4)).name = par6ItemStack.getDisplayName();
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer,
|
||||
int par6, float par7, float par8, float par9) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile instanceof TileInfinitato) {
|
||||
((TileInfinitato) tile).interact();
|
||||
par1World.spawnParticle(
|
||||
"heart",
|
||||
par2 + minX + Math.random() * (maxX - minX),
|
||||
par3 + maxY,
|
||||
par4 + minZ + Math.random() * (maxZ - minZ),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
par1World.spawnParticle(
|
||||
"heart",
|
||||
par2 + minX + Math.random() * (maxX - minX),
|
||||
par3 + maxY,
|
||||
par4 + minZ + Math.random() * (maxZ - minZ),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
par1World.spawnParticle(
|
||||
"heart",
|
||||
par2 + minX + Math.random() * (maxX - minX),
|
||||
par3 + maxY,
|
||||
par4 + minZ + Math.random() * (maxZ - minZ),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) {
|
||||
if(!par6EntityPlayer.capabilities.isCreativeMode)
|
||||
dropBlockAsItem(par1World, par2, par3, par4, par5, 0);
|
||||
}
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving,
|
||||
ItemStack par6ItemStack) {
|
||||
int l1 = MathHelper.floor_double(par5EntityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> list = new ArrayList();
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, l1, 2);
|
||||
if (par6ItemStack.hasDisplayName())
|
||||
((TileInfinitato) par1World.getTileEntity(par2, par3, par4)).name = par6ItemStack.getDisplayName();
|
||||
}
|
||||
|
||||
if(tile != null) {
|
||||
ItemStack stack = new ItemStack(this);
|
||||
String name = ((TileInfinitato) tile).name;
|
||||
if(!name.isEmpty())
|
||||
stack.setStackDisplayName(name);
|
||||
list.add(stack);
|
||||
}
|
||||
@Override
|
||||
public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5,
|
||||
EntityPlayer par6EntityPlayer) {
|
||||
if (!par6EntityPlayer.capabilities.isCreativeMode) dropBlockAsItem(par1World, par2, par3, par4, par5, 0);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> list = new ArrayList();
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
if (tile != null) {
|
||||
ItemStack stack = new ItemStack(this);
|
||||
String name = ((TileInfinitato) tile).name;
|
||||
if (!name.isEmpty()) stack.setStackDisplayName(name);
|
||||
list.add(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderInfinitato.renderID;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileInfinitato();
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
|
||||
return lexiconEntry;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderInfinitato.renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileInfinitato();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
|
||||
return lexiconEntry;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +1,23 @@
|
||||
package fox.spiteful.avaritia.compat.botania;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemInfinitatoCostume extends Item {
|
||||
|
||||
private static final String[] types = new String[]{"armstrong", "moon", "egbert", "francis"};
|
||||
private static final String[] types = new String[] { "armstrong", "moon", "egbert", "francis" };
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon[] icons;
|
||||
|
||||
public ItemInfinitatoCostume(){
|
||||
public ItemInfinitatoCostume() {
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@@ -6,16 +6,19 @@ import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
public class LudicrousLexicon extends LexiconEntry implements IAddonEntry {
|
||||
public LudicrousLexicon(String name, LexiconCategory category){
|
||||
|
||||
public LudicrousLexicon(String name, LexiconCategory category) {
|
||||
super(name, category);
|
||||
BotaniaAPI.addEntry(this, category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSubtitle(){
|
||||
public String getSubtitle() {
|
||||
return "[Avaritia]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return "avaritia.lexicon." + super.getUnlocalizedName();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,20 +5,20 @@ import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelInfinitato extends ModelBase {
|
||||
|
||||
ModelRenderer potato;
|
||||
ModelRenderer potato;
|
||||
|
||||
public ModelInfinitato() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 32;
|
||||
public ModelInfinitato() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 32;
|
||||
|
||||
potato = new ModelRenderer(this, 0, 0);
|
||||
potato.addBox(0F, 0F, 0F, 8, 12, 8);
|
||||
potato.setRotationPoint(-4F, 12F, -4F);
|
||||
potato.setTextureSize(64, 32);
|
||||
}
|
||||
potato = new ModelRenderer(this, 0, 0);
|
||||
potato.addBox(0F, 0F, 0F, 8, 12, 8);
|
||||
potato.setRotationPoint(-4F, 12F, -4F);
|
||||
potato.setTextureSize(64, 32);
|
||||
}
|
||||
|
||||
public void render() {
|
||||
potato.render(1F / 16F);
|
||||
}
|
||||
public void render() {
|
||||
potato.render(1F / 16F);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,8 +3,6 @@ package fox.spiteful.avaritia.compat.botania;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
@@ -13,197 +11,163 @@ import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeShapedOreRecipe;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeShapedRecipe;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeShapelessRecipe;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.api.internal.IGuiLexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.common.lexicon.page.PageRecipe;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeShapedOreRecipe;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeShapedRecipe;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeShapelessRecipe;
|
||||
|
||||
public class PageLudicrousRecipe extends PageRecipe {
|
||||
|
||||
private static final ResourceLocation craftingOverlay = new ResourceLocation("avaritia", "textures/gui/lexiconCraftingOverlay.png");
|
||||
|
||||
IRecipe recipe;
|
||||
int ticksElapsed = 0;
|
||||
|
||||
boolean oreDictRecipe, shapelessRecipe;
|
||||
|
||||
public PageLudicrousRecipe(String unlocalizedName, IRecipe recipe) {
|
||||
super(unlocalizedName);
|
||||
this.recipe = recipe;
|
||||
}
|
||||
private static final ResourceLocation craftingOverlay = new ResourceLocation(
|
||||
"avaritia",
|
||||
"textures/gui/lexiconCraftingOverlay.png");
|
||||
|
||||
@Override
|
||||
public void onPageAdded(LexiconEntry entry, int index) {
|
||||
LexiconRecipeMappings.map(this.recipe.getRecipeOutput(), entry, index);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
|
||||
oreDictRecipe = shapelessRecipe = false;
|
||||
IRecipe recipe;
|
||||
int ticksElapsed = 0;
|
||||
|
||||
renderCraftingRecipe(gui, recipe);
|
||||
boolean oreDictRecipe, shapelessRecipe;
|
||||
|
||||
TextureManager render = Minecraft.getMinecraft().renderEngine;
|
||||
render.bindTexture(craftingOverlay);
|
||||
public PageLudicrousRecipe(String unlocalizedName, IRecipe recipe) {
|
||||
super(unlocalizedName);
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
|
||||
@Override
|
||||
public void onPageAdded(LexiconEntry entry, int index) {
|
||||
LexiconRecipeMappings.map(this.recipe.getRecipeOutput(), entry, index);
|
||||
}
|
||||
|
||||
int iconX = gui.getLeft() + 115;
|
||||
int iconY = gui.getTop() + 12;
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
|
||||
oreDictRecipe = shapelessRecipe = false;
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
renderCraftingRecipe(gui, recipe);
|
||||
|
||||
if(shapelessRecipe) {
|
||||
((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 0, 16, 16);
|
||||
TextureManager render = Minecraft.getMinecraft().renderEngine;
|
||||
render.bindTexture(craftingOverlay);
|
||||
|
||||
if(mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16)
|
||||
RenderHelper.renderTooltip(mx, my, Arrays.asList(StatCollector.translateToLocal("botaniamisc.shapeless")));
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
|
||||
|
||||
iconY += 20;
|
||||
}
|
||||
int iconX = gui.getLeft() + 115;
|
||||
int iconY = gui.getTop() + 12;
|
||||
|
||||
render.bindTexture(craftingOverlay);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if(oreDictRecipe) {
|
||||
((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 16, 16, 16);
|
||||
if (shapelessRecipe) {
|
||||
((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 0, 16, 16);
|
||||
|
||||
if(mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16)
|
||||
RenderHelper.renderTooltip(mx, my, Arrays.asList(StatCollector.translateToLocal("botaniamisc.oredict")));
|
||||
}
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
if (mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16) RenderHelper
|
||||
.renderTooltip(mx, my, Arrays.asList(StatCollector.translateToLocal("botaniamisc.shapeless")));
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateScreen() {
|
||||
/*if(ticksElapsed % 20 == 0) {
|
||||
recipeAt++;
|
||||
iconY += 20;
|
||||
}
|
||||
|
||||
if(recipeAt == recipes.size())
|
||||
recipeAt = 0;
|
||||
}*/
|
||||
++ticksElapsed;
|
||||
}
|
||||
render.bindTexture(craftingOverlay);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderCraftingRecipe(IGuiLexiconEntry gui, IRecipe recipe) {
|
||||
if (recipe instanceof ExtremeShapedRecipe) {
|
||||
ExtremeShapedRecipe shaped = (ExtremeShapedRecipe) recipe;
|
||||
|
||||
for(int y = 0; y < shaped.recipeHeight; y++)
|
||||
for(int x = 0; x < shaped.recipeWidth; x++)
|
||||
renderItemAtLudicrousGridPos(gui, x, y, shaped.recipeItems[y * shaped.recipeWidth + x], true);
|
||||
} else if (recipe instanceof ExtremeShapedOreRecipe) {
|
||||
oreDictRecipe = true;
|
||||
} else if (recipe instanceof ExtremeShapelessRecipe) {
|
||||
shapelessRecipe = true;
|
||||
} else if(recipe instanceof ShapelessOreRecipe) {
|
||||
ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe;
|
||||
if (oreDictRecipe) {
|
||||
((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 16, 16, 16);
|
||||
|
||||
drawGrid : {
|
||||
for(int y = 0; y < 3; y++)
|
||||
for(int x = 0; x < 3; x++) {
|
||||
int index = y * 3 + x;
|
||||
if (mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16) RenderHelper
|
||||
.renderTooltip(mx, my, Arrays.asList(StatCollector.translateToLocal("botaniamisc.oredict")));
|
||||
}
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
if(index >= shapeless.getRecipeSize())
|
||||
break drawGrid;
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateScreen() {
|
||||
/*
|
||||
* if(ticksElapsed % 20 == 0) { recipeAt++; if(recipeAt == recipes.size()) recipeAt = 0; }
|
||||
*/
|
||||
++ticksElapsed;
|
||||
}
|
||||
|
||||
Object input = shapeless.getInput().get(index);
|
||||
if(input != null)
|
||||
renderItemAtLudicrousGridPos(gui, x, y, input instanceof ItemStack ? (ItemStack) input : ((ArrayList<ItemStack>) input).get(0), true);
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderCraftingRecipe(IGuiLexiconEntry gui, IRecipe recipe) {
|
||||
if (recipe instanceof ExtremeShapedRecipe) {
|
||||
ExtremeShapedRecipe shaped = (ExtremeShapedRecipe) recipe;
|
||||
|
||||
shapelessRecipe = true;
|
||||
oreDictRecipe = true;
|
||||
}
|
||||
/*if(recipe instanceof ShapedRecipes) {
|
||||
ShapedRecipes shaped = (ShapedRecipes)recipe;
|
||||
for (int y = 0; y < shaped.recipeHeight; y++) for (int x = 0; x < shaped.recipeWidth; x++)
|
||||
renderItemAtLudicrousGridPos(gui, x, y, shaped.recipeItems[y * shaped.recipeWidth + x], true);
|
||||
} else if (recipe instanceof ExtremeShapedOreRecipe) {
|
||||
oreDictRecipe = true;
|
||||
} else if (recipe instanceof ExtremeShapelessRecipe) {
|
||||
shapelessRecipe = true;
|
||||
} else if (recipe instanceof ShapelessOreRecipe) {
|
||||
ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe;
|
||||
|
||||
for(int y = 0; y < shaped.recipeHeight; y++)
|
||||
for(int x = 0; x < shaped.recipeWidth; x++)
|
||||
renderItemAtGridPos(gui, 1 + x, 1 + y, shaped.recipeItems[y * shaped.recipeWidth + x], true);
|
||||
} else if(recipe instanceof ShapedOreRecipe) {
|
||||
ShapedOreRecipe shaped = (ShapedOreRecipe) recipe;
|
||||
int width = (Integer) ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 4);
|
||||
int height = (Integer) ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 5);
|
||||
drawGrid: {
|
||||
for (int y = 0; y < 3; y++) for (int x = 0; x < 3; x++) {
|
||||
int index = y * 3 + x;
|
||||
|
||||
for(int y = 0; y < height; y++)
|
||||
for(int x = 0; x < width; x++) {
|
||||
Object input = shaped.getInput()[y * width + x];
|
||||
if(input != null)
|
||||
renderItemAtGridPos(gui, 1 + x, 1 + y, input instanceof ItemStack ? (ItemStack) input : ((ArrayList<ItemStack>) input).get(0), true);
|
||||
}
|
||||
if (index >= shapeless.getRecipeSize()) break drawGrid;
|
||||
|
||||
oreDictRecipe = true;
|
||||
} else if(recipe instanceof ShapelessRecipes) {
|
||||
ShapelessRecipes shapeless = (ShapelessRecipes) recipe;
|
||||
Object input = shapeless.getInput().get(index);
|
||||
if (input != null) renderItemAtLudicrousGridPos(
|
||||
gui,
|
||||
x,
|
||||
y,
|
||||
input instanceof ItemStack ? (ItemStack) input : ((ArrayList<ItemStack>) input).get(0),
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
drawGrid : {
|
||||
for(int y = 0; y < 3; y++)
|
||||
for(int x = 0; x < 3; x++) {
|
||||
int index = y * 3 + x;
|
||||
shapelessRecipe = true;
|
||||
oreDictRecipe = true;
|
||||
}
|
||||
/*
|
||||
* if(recipe instanceof ShapedRecipes) { ShapedRecipes shaped = (ShapedRecipes)recipe; for(int y = 0; y <
|
||||
* shaped.recipeHeight; y++) for(int x = 0; x < shaped.recipeWidth; x++) renderItemAtGridPos(gui, 1 + x, 1 + y,
|
||||
* shaped.recipeItems[y * shaped.recipeWidth + x], true); } else if(recipe instanceof ShapedOreRecipe) {
|
||||
* ShapedOreRecipe shaped = (ShapedOreRecipe) recipe; int width = (Integer)
|
||||
* ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 4); int height = (Integer)
|
||||
* ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 5); for(int y = 0; y < height; y++) for(int x
|
||||
* = 0; x < width; x++) { Object input = shaped.getInput()[y * width + x]; if(input != null)
|
||||
* renderItemAtGridPos(gui, 1 + x, 1 + y, input instanceof ItemStack ? (ItemStack) input :
|
||||
* ((ArrayList<ItemStack>) input).get(0), true); } oreDictRecipe = true; } else if(recipe instanceof
|
||||
* ShapelessRecipes) { ShapelessRecipes shapeless = (ShapelessRecipes) recipe; drawGrid : { for(int y = 0; y <
|
||||
* 3; y++) for(int x = 0; x < 3; x++) { int index = y * 3 + x; if(index >= shapeless.recipeItems.size()) break
|
||||
* drawGrid; renderItemAtGridPos(gui, 1 + x, 1 + y, (ItemStack) shapeless.recipeItems.get(index), true); } }
|
||||
* shapelessRecipe = true; } else if(recipe instanceof ShapelessOreRecipe) { ShapelessOreRecipe shapeless =
|
||||
* (ShapelessOreRecipe) recipe; drawGrid : { for(int y = 0; y < 3; y++) for(int x = 0; x < 3; x++) { int index =
|
||||
* y * 3 + x; if(index >= shapeless.getRecipeSize()) break drawGrid; Object input =
|
||||
* shapeless.getInput().get(index); if(input != null) renderItemAtGridPos(gui, 1 + x, 1 + y, input instanceof
|
||||
* ItemStack ? (ItemStack) input : ((ArrayList<ItemStack>) input).get(0), true); } } shapelessRecipe = true;
|
||||
* oreDictRecipe = true; }
|
||||
*/
|
||||
|
||||
if(index >= shapeless.recipeItems.size())
|
||||
break drawGrid;
|
||||
renderItemAtLudicrousGridPos(gui, 4, -1, recipe.getRecipeOutput(), false);
|
||||
}
|
||||
|
||||
renderItemAtGridPos(gui, 1 + x, 1 + y, (ItemStack) shapeless.recipeItems.get(index), true);
|
||||
}
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderItemAtLudicrousGridPos(IGuiLexiconEntry gui, int x, int y, ItemStack stack,
|
||||
boolean accountForContainer) {
|
||||
if (stack == null || stack.getItem() == null) return;
|
||||
stack = stack.copy();
|
||||
|
||||
shapelessRecipe = true;
|
||||
} else if(recipe instanceof ShapelessOreRecipe) {
|
||||
ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe;
|
||||
if (stack.getItemDamage() == Short.MAX_VALUE) stack.setItemDamage(0);
|
||||
|
||||
drawGrid : {
|
||||
for(int y = 0; y < 3; y++)
|
||||
for(int x = 0; x < 3; x++) {
|
||||
int index = y * 3 + x;
|
||||
int xPos = gui.getLeft() + x * 13 + 13;
|
||||
int yPos = gui.getTop() + y * 13 + 30 - (y == -1 ? 5 : 0);
|
||||
ItemStack stack1 = stack.copy();
|
||||
if (stack1.getItemDamage() == -1) stack1.setItemDamage(0);
|
||||
|
||||
if(index >= shapeless.getRecipeSize())
|
||||
break drawGrid;
|
||||
|
||||
Object input = shapeless.getInput().get(index);
|
||||
if(input != null)
|
||||
renderItemAtGridPos(gui, 1 + x, 1 + y, input instanceof ItemStack ? (ItemStack) input : ((ArrayList<ItemStack>) input).get(0), true);
|
||||
}
|
||||
}
|
||||
|
||||
shapelessRecipe = true;
|
||||
oreDictRecipe = true;
|
||||
}*/
|
||||
|
||||
renderItemAtLudicrousGridPos(gui, 4, -1, recipe.getRecipeOutput(), false);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderItemAtLudicrousGridPos(IGuiLexiconEntry gui, int x, int y, ItemStack stack, boolean accountForContainer) {
|
||||
if(stack == null || stack.getItem() == null)
|
||||
return;
|
||||
stack = stack.copy();
|
||||
|
||||
if(stack.getItemDamage() == Short.MAX_VALUE)
|
||||
stack.setItemDamage(0);
|
||||
|
||||
int xPos = gui.getLeft() + x * 13 + 13;
|
||||
int yPos = gui.getTop() + y * 13 + 30 - (y==-1 ? 5 : 0);
|
||||
ItemStack stack1 = stack.copy();
|
||||
if(stack1.getItemDamage() == -1)
|
||||
stack1.setItemDamage(0);
|
||||
|
||||
renderItem(gui, xPos, yPos, stack1, accountForContainer);
|
||||
}
|
||||
renderItem(gui, xPos, yPos, stack1, accountForContainer);
|
||||
}
|
||||
}
|
||||
@@ -1,44 +1,47 @@
|
||||
package fox.spiteful.avaritia.compat.botania;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
public class RenderInfinitato implements ISimpleBlockRenderingHandler {
|
||||
public static int renderID;
|
||||
|
||||
public RenderInfinitato(int id) {
|
||||
renderID = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, -0.35F, 0.5F);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
RenderTileInfinitato.drawHalo = false;
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileInfinitato(), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
RenderTileInfinitato.drawHalo = true;
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
return false;
|
||||
}
|
||||
public static int renderID;
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
public RenderInfinitato(int id) {
|
||||
renderID = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return renderID;
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, -0.35F, 0.5F);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
RenderTileInfinitato.drawHalo = false;
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileInfinitato(), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
RenderTileInfinitato.drawHalo = true;
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,117 +1,112 @@
|
||||
package fox.spiteful.avaritia.compat.botania;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import fox.spiteful.avaritia.compat.tails.InfiniteFoxes;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderTileInfinitato extends TileEntitySpecialRenderer {
|
||||
|
||||
public static boolean drawHalo = true;
|
||||
private static final ResourceLocation texture = new ResourceLocation("avaritia","textures/blocks/infinitato.png");
|
||||
public static final ResourceLocation halo = new ResourceLocation("avaritia", "textures/items/halo128.png");
|
||||
private static final ModelInfinitato model = new ModelInfinitato();
|
||||
public static boolean drawHalo = true;
|
||||
private static final ResourceLocation texture = new ResourceLocation("avaritia", "textures/blocks/infinitato.png");
|
||||
public static final ResourceLocation halo = new ResourceLocation("avaritia", "textures/items/halo128.png");
|
||||
private static final ModelInfinitato model = new ModelInfinitato();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity var1, double x, double y, double z, float partialTicks) {
|
||||
TileInfinitato potato = (TileInfinitato) var1;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(x, y, z);
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity var1, double x, double y, double z, float partialTicks) {
|
||||
TileInfinitato potato = (TileInfinitato) var1;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
int meta = potato.getWorldObj() == null ? 3 : potato.getBlockMetadata();
|
||||
|
||||
if (drawHalo){
|
||||
mc.renderEngine.bindTexture(halo);
|
||||
GL11.glPushMatrix();
|
||||
|
||||
double xdiff = (potato.xCoord + 0.5) - RenderManager.instance.viewerPosX;//.renderPosX;
|
||||
double ydiff = (potato.yCoord + 0.4) - RenderManager.instance.viewerPosY;//.renderPosY;
|
||||
double zdiff = (potato.zCoord + 0.5) - RenderManager.instance.viewerPosZ;//.renderPosZ;
|
||||
|
||||
double len = Math.sqrt(xdiff*xdiff + ydiff*ydiff + zdiff*zdiff);
|
||||
|
||||
xdiff /= len;
|
||||
ydiff /= len;
|
||||
zdiff /= len;
|
||||
|
||||
GL11.glTranslated(-xdiff, ydiff, zdiff);
|
||||
|
||||
//GL11.glRotatef(-rotZ, 0F, 0F, 1F);
|
||||
//GL11.glRotatef(-rotY, 0F, 1F, 0F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
|
||||
GL11.glTranslatef(0F, -1.15F, 0F);
|
||||
GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
int meta = potato.getWorldObj() == null ? 3 : potato.getBlockMetadata();
|
||||
|
||||
//GL11.glTranslatef(0F, 0F, -1F);
|
||||
float f = 1.6F;
|
||||
float f1 = 0.016666668F * f;
|
||||
GL11.glScalef(f1, f1, f1);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
//GL11.glTranslatef(0.0F, 0F / f1, 0.0F);
|
||||
GL11.glDepthMask(false);
|
||||
//GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
tessellator.startDrawingQuads();
|
||||
int i=60;
|
||||
tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 1.0F);
|
||||
tessellator.addVertexWithUV(-i, -i, 0.0D, 0,0);
|
||||
tessellator.addVertexWithUV(-i, i, 0.0D, 1,0);
|
||||
tessellator.addVertexWithUV(i, i, 0.0D, 1,1);
|
||||
tessellator.addVertexWithUV(i, -i, 0.0D, 0,1);
|
||||
tessellator.draw();
|
||||
GL11.glDepthMask(true);
|
||||
//GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
//GL11.glScalef(1F / -f1, 1F / -f1, 1F / f1);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
float rotY = meta * 90F - 180F;
|
||||
GL11.glRotatef(rotY, 0F, 1F, 0F);
|
||||
if (drawHalo) {
|
||||
mc.renderEngine.bindTexture(halo);
|
||||
GL11.glPushMatrix();
|
||||
|
||||
float jump = potato.jumpTicks*0.5f;
|
||||
if(jump > 0)
|
||||
jump += partialTicks*0.5f;
|
||||
double xdiff = (potato.xCoord + 0.5) - RenderManager.instance.viewerPosX;// .renderPosX;
|
||||
double ydiff = (potato.yCoord + 0.4) - RenderManager.instance.viewerPosY;// .renderPosY;
|
||||
double zdiff = (potato.zCoord + 0.5) - RenderManager.instance.viewerPosZ;// .renderPosZ;
|
||||
|
||||
float up = (float) -Math.abs(Math.sin(jump / 10 * Math.PI)) * 0.2F;
|
||||
float rotZ = (float) Math.sin(jump / 10 * Math.PI) * 2;
|
||||
double len = Math.sqrt(xdiff * xdiff + ydiff * ydiff + zdiff * zdiff);
|
||||
|
||||
|
||||
|
||||
GL11.glTranslatef(0F, up, 0F);
|
||||
GL11.glRotatef(rotZ, 0F, 0F, 1F);
|
||||
xdiff /= len;
|
||||
ydiff /= len;
|
||||
zdiff /= len;
|
||||
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
model.render();
|
||||
GL11.glTranslated(-xdiff, ydiff, zdiff);
|
||||
|
||||
// GL11.glRotatef(-rotZ, 0F, 0F, 1F);
|
||||
// GL11.glRotatef(-rotY, 0F, 1F, 0F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
|
||||
GL11.glTranslatef(0F, -1.15F, 0F);
|
||||
GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
|
||||
|
||||
// GL11.glTranslatef(0F, 0F, -1F);
|
||||
float f = 1.6F;
|
||||
float f1 = 0.016666668F * f;
|
||||
GL11.glScalef(f1, f1, f1);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
// GL11.glTranslatef(0.0F, 0F / f1, 0.0F);
|
||||
GL11.glDepthMask(false);
|
||||
// GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
tessellator.startDrawingQuads();
|
||||
int i = 60;
|
||||
tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 1.0F);
|
||||
tessellator.addVertexWithUV(-i, -i, 0.0D, 0, 0);
|
||||
tessellator.addVertexWithUV(-i, i, 0.0D, 1, 0);
|
||||
tessellator.addVertexWithUV(i, i, 0.0D, 1, 1);
|
||||
tessellator.addVertexWithUV(i, -i, 0.0D, 0, 1);
|
||||
tessellator.draw();
|
||||
GL11.glDepthMask(true);
|
||||
// GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
// GL11.glScalef(1F / -f1, 1F / -f1, 1F / f1);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
float rotY = meta * 90F - 180F;
|
||||
GL11.glRotatef(rotY, 0F, 1F, 0F);
|
||||
|
||||
float jump = potato.jumpTicks * 0.5f;
|
||||
if (jump > 0) jump += partialTicks * 0.5f;
|
||||
|
||||
float up = (float) -Math.abs(Math.sin(jump / 10 * Math.PI)) * 0.2F;
|
||||
float rotZ = (float) Math.sin(jump / 10 * Math.PI) * 2;
|
||||
|
||||
GL11.glTranslatef(0F, up, 0F);
|
||||
GL11.glRotatef(rotZ, 0F, 0F, 1F);
|
||||
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
model.render();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
String name = potato.name.toLowerCase();
|
||||
@@ -119,83 +114,89 @@ public class RenderTileInfinitato extends TileEntitySpecialRenderer {
|
||||
float scale = 1F / 4F;
|
||||
GL11.glTranslatef(0F, 1F, 0F);
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
if(name.equals("armstrong")) {
|
||||
if (name.equals("armstrong")) {
|
||||
GL11.glScalef(1.75F, 1.75F, 1.25F);
|
||||
GL11.glRotatef(180F, 0F, 0F, 1F);
|
||||
GL11.glTranslatef(-0.5F, -0.55F, -0.8F);
|
||||
renderIcon(Tsundere.costumes.getIconFromDamage(0));
|
||||
}
|
||||
else if(name.startsWith("moo") && name.endsWith("oon")) {
|
||||
} else if (name.startsWith("moo") && name.endsWith("oon")) {
|
||||
GL11.glScalef(2.5F, 2.5F, 1.25F);
|
||||
GL11.glRotatef(180F, 0F, 0F, 1F);
|
||||
GL11.glTranslatef(-0.5F, -0.6F, -0.8F);
|
||||
renderIcon(Tsundere.costumes.getIconFromDamage(1));
|
||||
}
|
||||
else if(name.equals("egbert")) {
|
||||
} else if (name.equals("egbert")) {
|
||||
GL11.glScalef(1.25F, 1.25F, 1.25F);
|
||||
GL11.glRotatef(180F, 0F, 0F, 1F);
|
||||
GL11.glTranslatef(-0.5F, -1.4F, -0.8F);
|
||||
renderIcon(Tsundere.costumes.getIconFromDamage(2));
|
||||
}
|
||||
else if(name.equals("popetato")) {
|
||||
} else if (name.equals("popetato")) {
|
||||
GL11.glScalef(1.75F, 1.75F, 1.25F);
|
||||
GL11.glRotatef(180F, 0F, 0F, 1F);
|
||||
GL11.glTranslatef(-0.5F, -0, -0.8F);
|
||||
renderIcon(Tsundere.costumes.getIconFromDamage(3));
|
||||
}
|
||||
else if(name.startsWith("foxtato")) {
|
||||
InfiniteFoxes.renderInfinitatoFluff(partialTicks);
|
||||
} else if (name.startsWith("foxtato")) {
|
||||
InfiniteFoxes.renderInfinitatoFluff(partialTicks);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
GL11.glRotatef(-rotZ, 0F, 0F, 1F);
|
||||
GL11.glRotatef(-rotY, 0F, 1F, 0F);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
GL11.glRotatef(-rotZ, 0F, 0F, 1F);
|
||||
GL11.glRotatef(-rotY, 0F, 1F, 0F);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
|
||||
MovingObjectPosition pos = mc.objectMouseOver;
|
||||
if(!potato.name.isEmpty() && pos != null && pos.blockX == potato.xCoord && pos.blockY == potato.yCoord && pos.blockZ == potato.zCoord) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0F, -0.4F, 0F);
|
||||
GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
|
||||
float f = 1.6F;
|
||||
float f1 = 0.016666668F * f;
|
||||
GL11.glScalef(-f1, -f1, f1);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glTranslatef(0.0F, 0F / f1, 0.0F);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
tessellator.startDrawingQuads();
|
||||
int i = mc.fontRenderer.getStringWidth(potato.name) / 2;
|
||||
tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
|
||||
tessellator.addVertex(-i - 1, -1.0D, 0.0D);
|
||||
tessellator.addVertex(-i - 1, 8.0D, 0.0D);
|
||||
tessellator.addVertex(i + 1, 8.0D, 0.0D);
|
||||
tessellator.addVertex(i + 1, -1.0D, 0.0D);
|
||||
tessellator.draw();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDepthMask(true);
|
||||
mc.fontRenderer.drawString(potato.name, -mc.fontRenderer.getStringWidth(potato.name) / 2, 0, 0xFFFFFF);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glScalef(1F / -f1, 1F / -f1, 1F / f1);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (!potato.name.isEmpty() && pos != null
|
||||
&& pos.blockX == potato.xCoord
|
||||
&& pos.blockY == potato.yCoord
|
||||
&& pos.blockZ == potato.zCoord) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0F, -0.4F, 0F);
|
||||
GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
|
||||
float f = 1.6F;
|
||||
float f1 = 0.016666668F * f;
|
||||
GL11.glScalef(-f1, -f1, f1);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glTranslatef(0.0F, 0F / f1, 0.0F);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
tessellator.startDrawingQuads();
|
||||
int i = mc.fontRenderer.getStringWidth(potato.name) / 2;
|
||||
tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
|
||||
tessellator.addVertex(-i - 1, -1.0D, 0.0D);
|
||||
tessellator.addVertex(-i - 1, 8.0D, 0.0D);
|
||||
tessellator.addVertex(i + 1, 8.0D, 0.0D);
|
||||
tessellator.addVertex(i + 1, -1.0D, 0.0D);
|
||||
tessellator.draw();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDepthMask(true);
|
||||
mc.fontRenderer.drawString(potato.name, -mc.fontRenderer.getStringWidth(potato.name) / 2, 0, 0xFFFFFF);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glScalef(1F / -f1, 1F / -f1, 1F / f1);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderIcon(IIcon icon) {
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
ItemRenderer.renderItemIn2D(
|
||||
Tessellator.instance,
|
||||
f1,
|
||||
f2,
|
||||
f,
|
||||
f3,
|
||||
icon.getIconWidth(),
|
||||
icon.getIconHeight(),
|
||||
1F / 16F);
|
||||
}
|
||||
}
|
||||
@@ -3,28 +3,35 @@ package fox.spiteful.avaritia.compat.botania;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import vazkii.botania.api.subtile.signature.SubTileSignature;
|
||||
|
||||
public class Signature extends SubTileSignature {
|
||||
|
||||
String name;
|
||||
IIcon icon;
|
||||
public Signature(String nombre){
|
||||
|
||||
public Signature(String nombre) {
|
||||
name = nombre;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister reg){
|
||||
public void registerIcons(IIconRegister reg) {
|
||||
icon = reg.registerIcon("avaritia:" + name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconForStack(ItemStack item){
|
||||
public IIcon getIconForStack(ItemStack item) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedNameForStack(ItemStack item){
|
||||
public String getUnlocalizedNameForStack(ItemStack item) {
|
||||
return "avaritia.flower." + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedLoreTextForStack(ItemStack item){
|
||||
public String getUnlocalizedLoreTextForStack(ItemStack item) {
|
||||
return "tile.avaritia.flower." + name + ".lore";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +1,47 @@
|
||||
package fox.spiteful.avaritia.compat.botania;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.SubTileGenerating;
|
||||
|
||||
public class SubTileCheaty extends SubTileGenerating {
|
||||
|
||||
public static LexiconEntry lexicon;
|
||||
|
||||
@Override
|
||||
public int getMaxMana() {
|
||||
return 1000000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return 0x11FF00;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry() {
|
||||
return lexicon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGeneratePassively() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDelayBetweenPassiveGeneration() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getValueForPassiveGeneration() {
|
||||
return 1000000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(){
|
||||
public IIcon getIcon() {
|
||||
return BotaniaAPI.getSignatureForName("asgardandelion").getIconForStack(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +1,47 @@
|
||||
package fox.spiteful.avaritia.compat.botania;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.SubTileGenerating;
|
||||
|
||||
public class SubTileChicken extends SubTileGenerating {
|
||||
public static LexiconEntry lexicon;
|
||||
|
||||
public static LexiconEntry lexicon;
|
||||
|
||||
@Override
|
||||
public int getMaxMana() {
|
||||
return 1000000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return 0x11FF00;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry() {
|
||||
return lexicon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGeneratePassively() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDelayBetweenPassiveGeneration() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getValueForPassiveGeneration() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(){
|
||||
public IIcon getIcon() {
|
||||
return BotaniaAPI.getSignatureForName("soarleander").getIconForStack(null);
|
||||
}
|
||||
}
|
||||
@@ -2,85 +2,92 @@ package fox.spiteful.avaritia.compat.botania;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import fox.spiteful.avaritia.tile.TileLudicrous;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import fox.spiteful.avaritia.tile.TileLudicrous;
|
||||
|
||||
public class TileInfinitato extends TileLudicrous {
|
||||
|
||||
private static final String TAG_NAME = "name";
|
||||
private static final String TAG_NAME = "name";
|
||||
|
||||
public int jumpTicks = 0;
|
||||
public String name = "";
|
||||
public int jumpTicks = 0;
|
||||
public String name = "";
|
||||
public int nextDoIt = 0;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void interact() {
|
||||
public void interact() {
|
||||
jump();
|
||||
if(name.equalsIgnoreCase("shia labeouf") && !worldObj.isRemote && nextDoIt == 0) {
|
||||
if (name.equalsIgnoreCase("shia labeouf") && !worldObj.isRemote && nextDoIt == 0) {
|
||||
nextDoIt = 40;
|
||||
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "botania:doit", 2.5F, 0.7F);
|
||||
}
|
||||
|
||||
|
||||
double radius = 10.5;
|
||||
int time = 3600;
|
||||
List<EntityLivingBase> inspired = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(xCoord-radius, yCoord-radius, zCoord-radius, xCoord+radius, yCoord+radius, zCoord+radius));
|
||||
|
||||
List<EntityLivingBase> inspired = this.worldObj.getEntitiesWithinAABB(
|
||||
EntityLivingBase.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
xCoord - radius,
|
||||
yCoord - radius,
|
||||
zCoord - radius,
|
||||
xCoord + radius,
|
||||
yCoord + radius,
|
||||
zCoord + radius));
|
||||
|
||||
for (EntityLivingBase ent : inspired) {
|
||||
Lumberjack.info(ent);
|
||||
double dx = ent.posX - xCoord;
|
||||
double dy = ent.posY - yCoord;
|
||||
double dz = ent.posZ - zCoord;
|
||||
double dist = Math.sqrt(dx*dx + dy*dy + dz*dz);
|
||||
|
||||
if (dist <= radius) {
|
||||
ent.addPotionEffect(new PotionEffect(Potion.damageBoost.id, time, 1));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, time, 0));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.jump.id, time, 0));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.regeneration.id, time, 1));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.resistance.id, time, 1));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.digSpeed.id, time, 1));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.fireResistance.id, time, 0));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, time, 0));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.nightVision.id, time, 0));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, time, 4)); // absorb
|
||||
Lumberjack.info(ent);
|
||||
double dx = ent.posX - xCoord;
|
||||
double dy = ent.posY - yCoord;
|
||||
double dz = ent.posZ - zCoord;
|
||||
double dist = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
||||
|
||||
if (dist <= radius) {
|
||||
ent.addPotionEffect(new PotionEffect(Potion.damageBoost.id, time, 1));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, time, 0));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.jump.id, time, 0));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.regeneration.id, time, 1));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.resistance.id, time, 1));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.digSpeed.id, time, 1));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.fireResistance.id, time, 0));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, time, 0));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.nightVision.id, time, 0));
|
||||
ent.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, time, 4)); // absorb
|
||||
ent.addPotionEffect(new PotionEffect(Potion.field_76443_y.id, time, 4)); // saturation
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void jump() {
|
||||
if(jumpTicks == 0)
|
||||
jumpTicks = 40;
|
||||
}
|
||||
if (jumpTicks == 0) jumpTicks = 40;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
/*if(worldObj.rand.nextInt(100) == 0)
|
||||
jump();*/
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
/*
|
||||
* if(worldObj.rand.nextInt(100) == 0) jump();
|
||||
*/
|
||||
|
||||
if(jumpTicks > 0) {
|
||||
jumpTicks--;
|
||||
if (jumpTicks == 20 || jumpTicks == 0) {
|
||||
this.worldObj.createExplosion(null, this.xCoord+0.5, this.yCoord, this.zCoord+0.5, 0.0f, true);
|
||||
}
|
||||
}
|
||||
if(nextDoIt > 0)
|
||||
nextDoIt--;
|
||||
}
|
||||
if (jumpTicks > 0) {
|
||||
jumpTicks--;
|
||||
if (jumpTicks == 20 || jumpTicks == 0) {
|
||||
this.worldObj.createExplosion(null, this.xCoord + 0.5, this.yCoord, this.zCoord + 0.5, 0.0f, true);
|
||||
}
|
||||
}
|
||||
if (nextDoIt > 0) nextDoIt--;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound cmp) {
|
||||
cmp.setString(TAG_NAME, name);
|
||||
}
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound cmp) {
|
||||
cmp.setString(TAG_NAME, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
name = cmp.getString(TAG_NAME);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
name = cmp.getString(TAG_NAME);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,14 @@
|
||||
package fox.spiteful.avaritia.compat.botania;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import fox.spiteful.avaritia.blocks.LudicrousBlocks;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
@@ -8,17 +17,9 @@ import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeShapedRecipe;
|
||||
import fox.spiteful.avaritia.crafting.Grinder;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
|
||||
public class Tsundere {
|
||||
|
||||
|
||||
public static Item costumes;
|
||||
|
||||
public static void baka() throws Compat.ItemNotFoundException {
|
||||
@@ -30,7 +31,6 @@ public class Tsundere {
|
||||
Grinder.catalyst.getInput().add(terra);
|
||||
Grinder.catalyst.getInput().add(gaia);
|
||||
|
||||
|
||||
BotaniaAPI.registerSubTile("asgardandelion", SubTileCheaty.class);
|
||||
BotaniaAPI.registerSubTileSignature(SubTileCheaty.class, new Signature("asgardandelion"));
|
||||
BotaniaAPI.addSubTileToCreativeMenu("asgardandelion");
|
||||
@@ -41,68 +41,64 @@ public class Tsundere {
|
||||
SubTileCheaty.lexicon.addPage(BotaniaAPI.internalHandler.textPage("avaritia.lexicon.asgardandelion.0"));
|
||||
SubTileCheaty.lexicon.setIcon(cheaty);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addRecipe(cheaty, new Object[]{
|
||||
" III ",
|
||||
" IIIII ",
|
||||
" IIXII ",
|
||||
" IIIII ",
|
||||
" III ",
|
||||
" nn N nn ",
|
||||
"nnnnNnnnn",
|
||||
" nn N nn ",
|
||||
" N ",
|
||||
'I', new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'X', new ItemStack(LudicrousItems.resource, 1, 5),
|
||||
'N', new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
'n', new ItemStack(LudicrousItems.resource, 1, 3),
|
||||
});
|
||||
|
||||
ExtremeCraftingManager.getInstance().addRecipe(
|
||||
cheaty,
|
||||
new Object[] { " III ", " IIIII ", " IIXII ", " IIIII ", " III ", " nn N nn ",
|
||||
"nnnnNnnnn", " nn N nn ", " N ", 'I', new ItemStack(LudicrousItems.resource, 1, 6), 'X',
|
||||
new ItemStack(LudicrousItems.resource, 1, 5), 'N', new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
'n', new ItemStack(LudicrousItems.resource, 1, 3), });
|
||||
|
||||
BotaniaAPI.registerSubTile("soarleander", SubTileChicken.class);
|
||||
BotaniaAPI.registerSubTileSignature(SubTileChicken.class, new Signature("soarleander"));
|
||||
BotaniaAPI.addSubTileToCreativeMenu("soarleander");
|
||||
|
||||
|
||||
ItemStack chicken = getFlower("soarleander");
|
||||
|
||||
|
||||
ItemStack chickenitem = new ItemStack(Items.chicken);
|
||||
|
||||
RecipeRuneAltar chickenrecipe = BotaniaAPI.registerRuneAltarRecipe(chicken, 8000, getFlower("gourmaryllis"), chickenitem, chickenitem, chickenitem, chickenitem, chickenitem, chickenitem, chickenitem, chickenitem );
|
||||
|
||||
|
||||
RecipeRuneAltar chickenrecipe = BotaniaAPI.registerRuneAltarRecipe(
|
||||
chicken,
|
||||
8000,
|
||||
getFlower("gourmaryllis"),
|
||||
chickenitem,
|
||||
chickenitem,
|
||||
chickenitem,
|
||||
chickenitem,
|
||||
chickenitem,
|
||||
chickenitem,
|
||||
chickenitem,
|
||||
chickenitem);
|
||||
|
||||
SubTileChicken.lexicon = new LudicrousLexicon("soarleander", BotaniaAPI.categoryGenerationFlowers);
|
||||
SubTileChicken.lexicon.setLexiconPages(BotaniaAPI.internalHandler.textPage("avaritia.lexicon.soarleander.0"), BotaniaAPI.internalHandler.runeRecipePage("avaritia.lexicon.soarleander.1", chickenrecipe));
|
||||
SubTileChicken.lexicon.setLexiconPages(
|
||||
BotaniaAPI.internalHandler.textPage("avaritia.lexicon.soarleander.0"),
|
||||
BotaniaAPI.internalHandler.runeRecipePage("avaritia.lexicon.soarleander.1", chickenrecipe));
|
||||
SubTileChicken.lexicon.setIcon(chicken);
|
||||
|
||||
LudicrousBlocks.infinitato = GameRegistry.registerBlock(new BlockInfinitato(), "infinitato");
|
||||
GameRegistry.registerTileEntity(TileInfinitato.class, "Avaritia_Infinitato");
|
||||
costumes = new ItemInfinitatoCostume();
|
||||
GameRegistry.registerItem(costumes, "costumes");
|
||||
if(Compat.nei){
|
||||
try{
|
||||
if (Compat.nei) {
|
||||
try {
|
||||
NotEnough.hide(new ItemStack(costumes, 1, OreDictionary.WILDCARD_VALUE));
|
||||
}
|
||||
catch(Throwable e){}
|
||||
} catch (Throwable e) {}
|
||||
}
|
||||
|
||||
Block potato = Compat.getBlock("Botania", "tinyPotato");
|
||||
|
||||
ExtremeShapedRecipe tatorecipe = ExtremeCraftingManager.getInstance().addRecipe(new ItemStack(LudicrousBlocks.infinitato), new Object[]{
|
||||
"IIIIIIIII",
|
||||
"IIIIIIIII",
|
||||
"IIISISIII",
|
||||
"IIIIIIIII",
|
||||
"IISIXISII",
|
||||
"IIISSSIII",
|
||||
"IIIIIIIII",
|
||||
"IIIIIIIII",
|
||||
"IIIIIIIII",
|
||||
'I', new ItemStack(potato),
|
||||
'X', new ItemStack(LudicrousItems.resource, 1, 5),
|
||||
'S', new ItemStack(Items.diamond)});
|
||||
|
||||
ExtremeShapedRecipe tatorecipe = ExtremeCraftingManager.getInstance().addRecipe(
|
||||
new ItemStack(LudicrousBlocks.infinitato),
|
||||
new Object[] { "IIIIIIIII", "IIIIIIIII", "IIISISIII", "IIIIIIIII", "IISIXISII", "IIISSSIII",
|
||||
"IIIIIIIII", "IIIIIIIII", "IIIIIIIII", 'I', new ItemStack(potato), 'X',
|
||||
new ItemStack(LudicrousItems.resource, 1, 5), 'S', new ItemStack(Items.diamond) });
|
||||
|
||||
BlockInfinitato.lexiconEntry = new LudicrousLexicon("infinitato", BotaniaAPI.categoryMisc);
|
||||
BlockInfinitato.lexiconEntry.setLexiconPages(
|
||||
BotaniaAPI.internalHandler.textPage("avaritia.lexicon.infinitato.0"),
|
||||
new PageLudicrousRecipe("avaritia.lexicon.infinitato.1", tatorecipe)
|
||||
).setIcon(new ItemStack(LudicrousBlocks.infinitato));
|
||||
BlockInfinitato.lexiconEntry
|
||||
.setLexiconPages(
|
||||
BotaniaAPI.internalHandler.textPage("avaritia.lexicon.infinitato.0"),
|
||||
new PageLudicrousRecipe("avaritia.lexicon.infinitato.1", tatorecipe))
|
||||
.setIcon(new ItemStack(LudicrousBlocks.infinitato));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package fox.spiteful.avaritia.compat.forestry;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class Allele implements IAllele {
|
||||
|
||||
@@ -14,12 +15,12 @@ public class Allele implements IAllele {
|
||||
private String id;
|
||||
private boolean dom;
|
||||
|
||||
public static void prepareGenes(){
|
||||
public static void prepareGenes() {
|
||||
grindySpeed = new AlleleFloat("speedNerfed", true, 0.1f);
|
||||
grindyLife = new AlleleInteger("lifespanArtificial", false, 75);
|
||||
}
|
||||
|
||||
public Allele(String moniker, boolean dominant){
|
||||
public Allele(String moniker, boolean dominant) {
|
||||
name = "avaritia.allele." + moniker;
|
||||
id = "avaritia." + moniker;
|
||||
dom = dominant;
|
||||
@@ -27,40 +28,41 @@ public class Allele implements IAllele {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID(){
|
||||
public String getUID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
public String getName() {
|
||||
return StatCollector.translateToLocal(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(){
|
||||
public String getUnlocalizedName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant(){
|
||||
public boolean isDominant() {
|
||||
return dom;
|
||||
}
|
||||
|
||||
public static IAlleleBeeSpecies getBaseSpecies(String name) {
|
||||
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele((new StringBuilder()).append("forestry.species").append(name).toString());
|
||||
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry
|
||||
.getAllele((new StringBuilder()).append("forestry.species").append(name).toString());
|
||||
}
|
||||
|
||||
public static IAlleleBeeSpecies getExtraSpecies(String name) {
|
||||
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele((new StringBuilder()).append("extrabees.species.").append(name.toLowerCase())
|
||||
.toString());
|
||||
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry
|
||||
.getAllele((new StringBuilder()).append("extrabees.species.").append(name.toLowerCase()).toString());
|
||||
}
|
||||
|
||||
public static IAlleleBeeSpecies getMagicSpecies(String name) {
|
||||
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele((new StringBuilder()).append("magicbees.species").append(name)
|
||||
.toString());
|
||||
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry
|
||||
.getAllele((new StringBuilder()).append("magicbees.species").append(name).toString());
|
||||
}
|
||||
|
||||
public static IAllele getBaseAllele(String name) {
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry." + name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,13 @@ public class AlleleFloat extends Allele implements IAlleleFloat {
|
||||
|
||||
private float value;
|
||||
|
||||
public AlleleFloat(String moniker, boolean dom, float val){
|
||||
public AlleleFloat(String moniker, boolean dom, float val) {
|
||||
super(moniker, dom);
|
||||
value = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getValue(){
|
||||
public float getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,18 @@
|
||||
package fox.spiteful.avaritia.compat.forestry;
|
||||
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
|
||||
public class AlleleInteger extends Allele implements IAlleleInteger {
|
||||
|
||||
private int value;
|
||||
|
||||
public AlleleInteger(String moniker, boolean dom, int val){
|
||||
public AlleleInteger(String moniker, boolean dom, int val) {
|
||||
super(moniker, dom);
|
||||
value = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getValue(){
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package fox.spiteful.avaritia.compat.forestry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public enum BeeBranch implements IClassification {
|
||||
|
||||
@@ -18,7 +19,7 @@ public enum BeeBranch implements IClassification {
|
||||
private IClassification parent;
|
||||
private final EnumClassLevel level = EnumClassLevel.GENUS;
|
||||
|
||||
BeeBranch(String nombre, String science){
|
||||
BeeBranch(String nombre, String science) {
|
||||
name = nombre;
|
||||
latin = science;
|
||||
parent = AlleleManager.alleleRegistry.getClassification("family.apidae");
|
||||
@@ -26,58 +27,57 @@ public enum BeeBranch implements IClassification {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumClassLevel getLevel(){
|
||||
public EnumClassLevel getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID(){
|
||||
public String getUID() {
|
||||
return "classification." + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
public String getName() {
|
||||
return StatCollector.translateToLocal("classification." + name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getScientific(){
|
||||
public String getScientific() {
|
||||
return latin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription(){
|
||||
public String getDescription() {
|
||||
return StatCollector.translateToLocal("classification." + name + ".desc");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClassification[] getMemberGroups(){
|
||||
public IClassification[] getMemberGroups() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMemberGroup(IClassification group){
|
||||
public void addMemberGroup(IClassification group) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleSpecies[] getMemberSpecies(){
|
||||
public IAlleleSpecies[] getMemberSpecies() {
|
||||
return this.species.toArray(new IAlleleSpecies[this.species.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMemberSpecies(IAlleleSpecies species){
|
||||
if (!this.species.contains(species))
|
||||
this.species.add(species);
|
||||
public void addMemberSpecies(IAlleleSpecies species) {
|
||||
if (!this.species.contains(species)) this.species.add(species);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClassification getParent(){
|
||||
public IClassification getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParent(IClassification parent){
|
||||
public void setParent(IClassification parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package fox.spiteful.avaritia.compat.forestry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import forestry.api.apiculture.*;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
public class ExpensiveMutation implements IBeeMutation {
|
||||
|
||||
private IAlleleBeeSpecies mom;
|
||||
@@ -15,7 +15,7 @@ public class ExpensiveMutation implements IBeeMutation {
|
||||
private boolean secret = false;
|
||||
private float baseChance;
|
||||
|
||||
public ExpensiveMutation(IAlleleBeeSpecies first, IAlleleBeeSpecies second, IAllele[] result, float chance){
|
||||
public ExpensiveMutation(IAlleleBeeSpecies first, IAlleleBeeSpecies second, IAllele[] result, float chance) {
|
||||
mom = first;
|
||||
dad = second;
|
||||
template = result;
|
||||
@@ -23,45 +23,36 @@ public class ExpensiveMutation implements IBeeMutation {
|
||||
BeeManager.beeRoot.registerMutation(this);
|
||||
}
|
||||
|
||||
public static void mutate(){
|
||||
public static void mutate() {
|
||||
IAlleleBeeSpecies first;
|
||||
IAlleleBeeSpecies second;
|
||||
if(Ranger.extra)
|
||||
first = Allele.getExtraSpecies("Relic");
|
||||
else
|
||||
first = Allele.getBaseSpecies("Austere");
|
||||
if (Ranger.extra) first = Allele.getExtraSpecies("Relic");
|
||||
else first = Allele.getBaseSpecies("Austere");
|
||||
second = Allele.getBaseSpecies("Hermitic");
|
||||
new ExpensiveMutation(first, second, Genomes.getBalanced(), 0.8f);
|
||||
if(Ranger.magic)
|
||||
first = Allele.getMagicSpecies("Draconic");
|
||||
else
|
||||
first = Allele.getBaseSpecies("Heroic");
|
||||
if (Ranger.magic) first = Allele.getMagicSpecies("Draconic");
|
||||
else first = Allele.getBaseSpecies("Heroic");
|
||||
new ExpensiveMutation(first, GreedyBeeSpecies.ANNOYING, Genomes.getTedious(), 0.7f);
|
||||
if(Ranger.extra)
|
||||
first = Allele.getExtraSpecies("Virulent");
|
||||
else if(Ranger.magic)
|
||||
first = Allele.getMagicSpecies("Withering");
|
||||
else
|
||||
first = Allele.getBaseSpecies("Demonic");
|
||||
if (Ranger.extra) first = Allele.getExtraSpecies("Virulent");
|
||||
else if (Ranger.magic) first = Allele.getMagicSpecies("Withering");
|
||||
else first = Allele.getBaseSpecies("Demonic");
|
||||
new ExpensiveMutation(first, GreedyBeeSpecies.TEDIOUS, Genomes.getInsufferable(), 0.6f);
|
||||
|
||||
new ExpensiveMutation(Allele.getBaseSpecies("Edenic"), GreedyBeeSpecies.INSUFFERABLE, Genomes.getInfinite(), 0.4f);
|
||||
if(Ranger.magic)
|
||||
first = Allele.getMagicSpecies("Doctoral");
|
||||
else if(Ranger.extra)
|
||||
first = Allele.getExtraSpecies("Diamond");
|
||||
else
|
||||
first = Allele.getBaseSpecies("Phantasmal");
|
||||
new ExpensiveMutation(
|
||||
Allele.getBaseSpecies("Edenic"),
|
||||
GreedyBeeSpecies.INSUFFERABLE,
|
||||
Genomes.getInfinite(),
|
||||
0.4f);
|
||||
if (Ranger.magic) first = Allele.getMagicSpecies("Doctoral");
|
||||
else if (Ranger.extra) first = Allele.getExtraSpecies("Diamond");
|
||||
else first = Allele.getBaseSpecies("Phantasmal");
|
||||
|
||||
new ExpensiveMutation(first, GreedyBeeSpecies.TRIPPY, Genomes.getCosmic(), 0.8f);
|
||||
|
||||
if(Ranger.magic)
|
||||
first = Allele.getMagicSpecies("Firey");
|
||||
else if(Ranger.extra)
|
||||
first = Allele.getExtraSpecies("Volcanic");
|
||||
else
|
||||
first = Allele.getBaseSpecies("Industrious");
|
||||
//new ExpensiveMutation(first, GreedyBeeSpecies.COSMIC, Genomes.getNeutronium(), 0.6f);
|
||||
if (Ranger.magic) first = Allele.getMagicSpecies("Firey");
|
||||
else if (Ranger.extra) first = Allele.getExtraSpecies("Volcanic");
|
||||
else first = Allele.getBaseSpecies("Industrious");
|
||||
// new ExpensiveMutation(first, GreedyBeeSpecies.COSMIC, Genomes.getNeutronium(), 0.6f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,7 +81,7 @@ public class ExpensiveMutation implements IBeeMutation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecret(){
|
||||
public boolean isSecret() {
|
||||
return secret;
|
||||
}
|
||||
|
||||
@@ -101,8 +92,7 @@ public class ExpensiveMutation implements IBeeMutation {
|
||||
|
||||
@Override
|
||||
public IAllele getPartner(IAllele allele) {
|
||||
if(allele.getUID().equals(mom.getUID()))
|
||||
return dad;
|
||||
if (allele.getUID().equals(mom.getUID())) return dad;
|
||||
return mom;
|
||||
}
|
||||
|
||||
@@ -112,20 +102,20 @@ public class ExpensiveMutation implements IBeeMutation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(IBeeHousing housing, IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, IBeeGenome genome0, IBeeGenome genome1) {
|
||||
public float getChance(IBeeHousing housing, IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1,
|
||||
IBeeGenome genome0, IBeeGenome genome1) {
|
||||
float finalChance = 0f;
|
||||
float chance = this.baseChance * 1f;
|
||||
|
||||
if(isPartner(allele0) && isPartner(allele1)){
|
||||
if (isPartner(allele0) && isPartner(allele1)) {
|
||||
float housingModifier = 1.0f;
|
||||
for (IBeeModifier modifier : housing.getBeeModifiers()) {
|
||||
housingModifier *= modifier.getMutationModifier(genome0, genome1, chance);
|
||||
}
|
||||
finalChance = Math.round(chance
|
||||
* housingModifier
|
||||
* BeeManager.beeRoot.getBeekeepingMode(housing.getWorld()).getBeeModifier()
|
||||
.getMutationModifier(genome0,
|
||||
genome1, chance));
|
||||
finalChance = Math.round(
|
||||
chance * housingModifier
|
||||
* BeeManager.beeRoot.getBeekeepingMode(housing.getWorld()).getBeeModifier()
|
||||
.getMutationModifier(genome0, genome1, chance));
|
||||
}
|
||||
|
||||
return finalChance;
|
||||
|
||||
@@ -5,7 +5,7 @@ import forestry.api.genetics.IAllele;
|
||||
|
||||
public class Genomes {
|
||||
|
||||
public static IAllele[] getBase(){
|
||||
public static IAllele[] getBase() {
|
||||
IAllele[] genome = new IAllele[EnumBeeChromosome.values().length];
|
||||
|
||||
genome[EnumBeeChromosome.SPECIES.ordinal()] = GreedyBeeSpecies.ANNOYING;
|
||||
@@ -25,19 +25,19 @@ public class Genomes {
|
||||
return genome;
|
||||
}
|
||||
|
||||
public static IAllele[] getBalanced(){
|
||||
public static IAllele[] getBalanced() {
|
||||
IAllele[] genome = getBase();
|
||||
|
||||
genome[EnumBeeChromosome.SPEED.ordinal()] = Allele.grindySpeed;
|
||||
genome[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.grindyLife;
|
||||
genome[EnumBeeChromosome.NOCTURNAL.ordinal()] = Allele.getBaseAllele("boolTrue");
|
||||
genome[EnumBeeChromosome.TOLERANT_FLYER.ordinal()] = Allele.getBaseAllele("boolTrue");
|
||||
//genome[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.getBaseAllele("flowersVanilla");
|
||||
// genome[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.getBaseAllele("flowersVanilla");
|
||||
|
||||
return genome;
|
||||
}
|
||||
|
||||
public static IAllele[] getTedious(){
|
||||
public static IAllele[] getTedious() {
|
||||
IAllele[] genome = getBalanced();
|
||||
|
||||
genome[EnumBeeChromosome.SPECIES.ordinal()] = GreedyBeeSpecies.TEDIOUS;
|
||||
@@ -45,7 +45,7 @@ public class Genomes {
|
||||
return genome;
|
||||
}
|
||||
|
||||
public static IAllele[] getInsufferable(){
|
||||
public static IAllele[] getInsufferable() {
|
||||
IAllele[] genome = getBalanced();
|
||||
|
||||
genome[EnumBeeChromosome.SPECIES.ordinal()] = GreedyBeeSpecies.INSUFFERABLE;
|
||||
@@ -53,18 +53,18 @@ public class Genomes {
|
||||
return genome;
|
||||
}
|
||||
|
||||
public static IAllele[] getInfinite(){
|
||||
public static IAllele[] getInfinite() {
|
||||
IAllele[] genome = getBase();
|
||||
|
||||
genome[EnumBeeChromosome.SPECIES.ordinal()] = GreedyBeeSpecies.TRIPPY;
|
||||
genome[EnumBeeChromosome.NOCTURNAL.ordinal()] = Allele.getBaseAllele("boolTrue");
|
||||
genome[EnumBeeChromosome.CAVE_DWELLING.ordinal()] = Allele.getBaseAllele("boolTrue");
|
||||
//genome[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.getBaseAllele("flowersVanilla");
|
||||
// genome[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.getBaseAllele("flowersVanilla");
|
||||
|
||||
return genome;
|
||||
}
|
||||
|
||||
public static IAllele[] getCosmic(){
|
||||
public static IAllele[] getCosmic() {
|
||||
IAllele[] genome = getInfinite();
|
||||
|
||||
genome[EnumBeeChromosome.SPECIES.ordinal()] = GreedyBeeSpecies.COSMIC;
|
||||
@@ -72,7 +72,7 @@ public class Genomes {
|
||||
return genome;
|
||||
}
|
||||
|
||||
public static IAllele[] getNeutronium(){
|
||||
public static IAllele[] getNeutronium() {
|
||||
IAllele[] genome = getInfinite();
|
||||
|
||||
genome[EnumBeeChromosome.SPECIES.ordinal()] = GreedyBeeSpecies.NEUTRONIUM;
|
||||
@@ -80,7 +80,7 @@ public class Genomes {
|
||||
return genome;
|
||||
}
|
||||
|
||||
public static IAllele[] getInfiniteBee(){
|
||||
public static IAllele[] getInfiniteBee() {
|
||||
IAllele[] genome = getInfinite();
|
||||
|
||||
genome[EnumBeeChromosome.SPECIES.ordinal()] = GreedyBeeSpecies.INFINITE;
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
package fox.spiteful.avaritia.compat.forestry;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.apiculture.*;
|
||||
@@ -9,19 +20,9 @@ import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IIconProvider;
|
||||
import forestry.api.genetics.*;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
|
||||
public enum GreedyBeeSpecies implements IAlleleBeeSpecies, IIconProvider {
|
||||
|
||||
|
||||
ANNOYING("annoying", "incommodus", BeeBranch.BALANCED, "SpitefulFox", 0x662D01, 0x777777, false),
|
||||
TEDIOUS("tedious", "longus", BeeBranch.BALANCED, "SpitefulFox", 0x662D01, 0x662D01, false),
|
||||
INSUFFERABLE("insufferable", "intolerabilis", BeeBranch.BALANCED, "SpitefulFox", 0x662D01, 0xFFCAF0, true),
|
||||
@@ -50,7 +51,8 @@ public enum GreedyBeeSpecies implements IAlleleBeeSpecies, IIconProvider {
|
||||
private int primaryColor;
|
||||
private int secondaryColor;
|
||||
|
||||
GreedyBeeSpecies(String nombre, String genus, IClassification bran, String author, int mainColor, int otherColor, boolean dom, boolean secret, boolean shiny){
|
||||
GreedyBeeSpecies(String nombre, String genus, IClassification bran, String author, int mainColor, int otherColor,
|
||||
boolean dom, boolean secret, boolean shiny) {
|
||||
name = nombre;
|
||||
binomial = genus;
|
||||
branch = bran;
|
||||
@@ -64,11 +66,12 @@ public enum GreedyBeeSpecies implements IAlleleBeeSpecies, IIconProvider {
|
||||
fancy = shiny;
|
||||
}
|
||||
|
||||
GreedyBeeSpecies(String nombre, String genus, IClassification bran, String author, int mainColor, int otherColor, boolean dom){
|
||||
GreedyBeeSpecies(String nombre, String genus, IClassification bran, String author, int mainColor, int otherColor,
|
||||
boolean dom) {
|
||||
this(nombre, genus, bran, author, mainColor, otherColor, dom, false, false);
|
||||
}
|
||||
|
||||
public static void buzz(){
|
||||
public static void buzz() {
|
||||
ANNOYING.registerGenomeTemplate(Genomes.getBalanced());
|
||||
TEDIOUS.registerGenomeTemplate(Genomes.getTedious());
|
||||
INSUFFERABLE.registerGenomeTemplate(Genomes.getInsufferable());
|
||||
@@ -92,32 +95,32 @@ public enum GreedyBeeSpecies implements IAlleleBeeSpecies, IIconProvider {
|
||||
private IIcon[][] icons;
|
||||
|
||||
@Override
|
||||
public String getUID(){
|
||||
public String getUID() {
|
||||
return "avaritia." + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
public String getName() {
|
||||
return StatCollector.translateToLocal("avaritia.bee." + name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(){
|
||||
public String getUnlocalizedName() {
|
||||
return "avaritia.bee." + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBinomial(){
|
||||
public String getBinomial() {
|
||||
return binomial;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthority(){
|
||||
public String getAuthority() {
|
||||
return authority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription(){
|
||||
public String getDescription() {
|
||||
return StatCollector.translateToLocal("avaritia.bee." + name + ".desc");
|
||||
}
|
||||
|
||||
@@ -132,27 +135,27 @@ public enum GreedyBeeSpecies implements IAlleleBeeSpecies, IIconProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCounted(){
|
||||
public boolean isCounted() {
|
||||
return isCounted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecret(){
|
||||
public boolean isSecret() {
|
||||
return isSecret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEffect(){
|
||||
public boolean hasEffect() {
|
||||
return fancy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTemperature getTemperature(){
|
||||
public EnumTemperature getTemperature() {
|
||||
return temperature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumHumidity getHumidity(){
|
||||
public EnumHumidity getHumidity() {
|
||||
return humidity;
|
||||
}
|
||||
|
||||
@@ -165,7 +168,7 @@ public enum GreedyBeeSpecies implements IAlleleBeeSpecies, IIconProvider {
|
||||
return genomeTemplate;
|
||||
}
|
||||
|
||||
public void setGenome(IAllele[] genome){
|
||||
public void setGenome(IAllele[] genome) {
|
||||
genomeTemplate = genome;
|
||||
}
|
||||
|
||||
@@ -174,7 +177,6 @@ public enum GreedyBeeSpecies implements IAlleleBeeSpecies, IIconProvider {
|
||||
return 1 + getGeneticAdvancement(this, new ArrayList<IAllele>());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HashMap<ItemStack, Float> getProductChances() {
|
||||
return products;
|
||||
@@ -197,12 +199,12 @@ public enum GreedyBeeSpecies implements IAlleleBeeSpecies, IIconProvider {
|
||||
|
||||
public void addProduct(ItemStack produce, float percentChance) {
|
||||
products.put(produce, percentChance);
|
||||
legacyProducts.put(produce, (int)(percentChance * 100));
|
||||
legacyProducts.put(produce, (int) (percentChance * 100));
|
||||
}
|
||||
|
||||
public void addSpecialty(ItemStack produce, float percentChance) {
|
||||
specialties.put(produce, percentChance);
|
||||
legacySpecialties.put(produce, (int)(percentChance * 100));
|
||||
legacySpecialties.put(produce, (int) (percentChance * 100));
|
||||
}
|
||||
|
||||
public void registerGenomeTemplate(IAllele[] genome) {
|
||||
@@ -277,7 +279,9 @@ public enum GreedyBeeSpecies implements IAlleleBeeSpecies, IIconProvider {
|
||||
Collection<? extends IMutation> resultantMutations = getRoot().getCombinations(this);
|
||||
if (resultantMutations.size() > 0) {
|
||||
IMutation[] candidates = resultantMutations.toArray(new IMutation[resultantMutations.size()]);
|
||||
bounty.add(AlleleManager.alleleRegistry.getMutationNoteStack(researcher, candidates[world.rand.nextInt(candidates.length)]));
|
||||
bounty.add(
|
||||
AlleleManager.alleleRegistry
|
||||
.getMutationNoteStack(researcher, candidates[world.rand.nextInt(candidates.length)]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,13 +349,18 @@ public enum GreedyBeeSpecies implements IAlleleBeeSpecies, IIconProvider {
|
||||
IIcon body1 = itemMap.registerIcon("forestry:bees/default/body1");
|
||||
|
||||
for (int i = 0; i < EnumBeeType.values().length; i++) {
|
||||
if (EnumBeeType.values()[i] == EnumBeeType.NONE)
|
||||
continue;
|
||||
if (EnumBeeType.values()[i] == EnumBeeType.NONE) continue;
|
||||
|
||||
icons[i][0] = itemMap.registerIcon("forestry:bees/default/" + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH) + ".outline");
|
||||
icons[i][1] = (EnumBeeType.values()[i] != EnumBeeType.LARVAE) ? body1 : itemMap.registerIcon("forestry:bees/default/"
|
||||
+ EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH) + ".body");
|
||||
icons[i][2] = itemMap.registerIcon("forestry:bees/default/" + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH) + ".body2");
|
||||
icons[i][0] = itemMap.registerIcon(
|
||||
"forestry:bees/default/" + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH)
|
||||
+ ".outline");
|
||||
icons[i][1] = (EnumBeeType.values()[i] != EnumBeeType.LARVAE) ? body1
|
||||
: itemMap.registerIcon(
|
||||
"forestry:bees/default/" + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH)
|
||||
+ ".body");
|
||||
icons[i][2] = itemMap.registerIcon(
|
||||
"forestry:bees/default/" + EnumBeeType.values()[i].toString().toLowerCase(Locale.ENGLISH)
|
||||
+ ".body2");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package fox.spiteful.avaritia.compat.forestry;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import fox.spiteful.avaritia.render.IHaloRenderItem;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
@@ -13,11 +10,15 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import fox.spiteful.avaritia.render.IHaloRenderItem;
|
||||
|
||||
public class ItemBeesource extends Item implements IHaloRenderItem {
|
||||
|
||||
private static final String[] types = new String[]{"infinity_drop", "dust"};
|
||||
private static final String[] types = new String[] { "infinity_drop", "dust" };
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon[] icons;
|
||||
@@ -25,7 +26,7 @@ public class ItemBeesource extends Item implements IHaloRenderItem {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon halo;
|
||||
|
||||
public ItemBeesource(){
|
||||
public ItemBeesource() {
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
this.setUnlocalizedName("avaritia_beesource");
|
||||
@@ -64,9 +65,8 @@ public class ItemBeesource extends Item implements IHaloRenderItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack)
|
||||
{
|
||||
switch(stack.getItemDamage()){
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
switch (stack.getItemDamage()) {
|
||||
case 0:
|
||||
return LudicrousItems.cosmic;
|
||||
case 1:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package fox.spiteful.avaritia.compat.forestry;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -10,19 +10,20 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
|
||||
public class ItemComb extends Item {
|
||||
|
||||
private static final String[] types = new String[]{"nerfed", "cosmic"};
|
||||
private static final int[] mainColors = new int[]{0xB6B6B6, 0xEF57FF};
|
||||
private static final int[] otherColors = new int[]{0x757575, 0x06005C};
|
||||
private static final String[] types = new String[] { "nerfed", "cosmic" };
|
||||
private static final int[] mainColors = new int[] { 0xB6B6B6, 0xEF57FF };
|
||||
private static final int[] otherColors = new int[] { 0x757575, 0x06005C };
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon secondIcon;
|
||||
|
||||
public ItemComb(){
|
||||
public ItemComb() {
|
||||
setCreativeTab(Avaritia.tab);
|
||||
setHasSubtypes(true);
|
||||
setMaxDamage(0);
|
||||
@@ -39,39 +40,33 @@ public class ItemComb extends Item {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
this.itemIcon = par1IconRegister.registerIcon("forestry:beeCombs.0");
|
||||
this.secondIcon = par1IconRegister.registerIcon("forestry:beeCombs.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass)
|
||||
{
|
||||
public IIcon getIcon(ItemStack stack, int pass) {
|
||||
return (pass == 0) ? itemIcon : secondIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses()
|
||||
{
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(int meta)
|
||||
{
|
||||
public int getRenderPasses(int meta) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass)
|
||||
{
|
||||
public int getColorFromItemStack(ItemStack stack, int pass) {
|
||||
|
||||
if (pass == 0)
|
||||
{
|
||||
if(stack.getItemDamage() == 1){
|
||||
if (pass == 0) {
|
||||
if (stack.getItemDamage() == 1) {
|
||||
int hue = (int) (System.currentTimeMillis() >> 2) % 360;
|
||||
return Color.getHSBColor(hue / 360f, 0.75f, 0.80f).getRGB();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
package fox.spiteful.avaritia.compat.forestry;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
@@ -7,16 +18,6 @@ import fox.spiteful.avaritia.Config;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
import fox.spiteful.avaritia.crafting.Grinder;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Ranger {
|
||||
|
||||
@@ -38,8 +39,7 @@ public class Ranger {
|
||||
honeydew = Compat.getItem("Forestry", "honeydew");
|
||||
Item panel = Compat.getItem("Forestry", "craftingMaterial");
|
||||
|
||||
if(!Config.bees)
|
||||
return;
|
||||
if (!Config.bees) return;
|
||||
|
||||
LudicrousItems.combs = new ItemComb();
|
||||
GameRegistry.registerItem(LudicrousItems.combs, "Combs");
|
||||
@@ -61,7 +61,9 @@ public class Ranger {
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, new ItemStack(LudicrousItems.combs, 1, 1), products);
|
||||
|
||||
final float centrifugeChanceB = 1.0f;
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, new ItemStack(LudicrousItems.combs, 1, 0),
|
||||
RecipeManagers.centrifugeManager.addRecipe(
|
||||
20,
|
||||
new ItemStack(LudicrousItems.combs, 1, 0),
|
||||
Collections.singletonMap(new ItemStack(LudicrousItems.beesource, 1, 1), centrifugeChanceB));
|
||||
|
||||
Grinder.catalyst.getInput().add(new ItemStack(panel, 1, 6));
|
||||
|
||||
@@ -1,72 +1,74 @@
|
||||
package fox.spiteful.avaritia.compat.minetweaker;
|
||||
|
||||
import fox.spiteful.avaritia.crafting.CompressOreRecipe;
|
||||
import fox.spiteful.avaritia.crafting.CompressorManager;
|
||||
import fox.spiteful.avaritia.crafting.CompressorRecipe;
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.oredict.IOreDictEntry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import fox.spiteful.avaritia.crafting.CompressOreRecipe;
|
||||
import fox.spiteful.avaritia.crafting.CompressorManager;
|
||||
import fox.spiteful.avaritia.crafting.CompressorRecipe;
|
||||
|
||||
@ZenClass("mods.avaritia.Compressor")
|
||||
public class Compressor {
|
||||
|
||||
@ZenMethod
|
||||
public static void add(IItemStack output, int amount, IIngredient input, boolean exact){
|
||||
public static void add(IItemStack output, int amount, IIngredient input, boolean exact) {
|
||||
CompressorRecipe recipe = null;
|
||||
if(input instanceof IOreDictEntry)
|
||||
recipe = new CompressOreRecipe(toStack(output), amount, toString((IOreDictEntry)input), exact);
|
||||
else if(input instanceof IItemStack)
|
||||
recipe = new CompressorRecipe(toStack(output), amount, toStack((IItemStack)input), exact);
|
||||
if(recipe != null)
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
if (input instanceof IOreDictEntry)
|
||||
recipe = new CompressOreRecipe(toStack(output), amount, toString((IOreDictEntry) input), exact);
|
||||
else if (input instanceof IItemStack)
|
||||
recipe = new CompressorRecipe(toStack(output), amount, toStack((IItemStack) input), exact);
|
||||
if (recipe != null) MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void add(IItemStack output, int amount, IIngredient input){
|
||||
public static void add(IItemStack output, int amount, IIngredient input) {
|
||||
add(output, amount, input, true);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IItemStack output){
|
||||
public static void remove(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(toStack(output)));
|
||||
}
|
||||
|
||||
private static class Add implements IUndoableAction {
|
||||
|
||||
CompressorRecipe recipe;
|
||||
|
||||
public Add(CompressorRecipe add){
|
||||
public Add(CompressorRecipe add) {
|
||||
recipe = add;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
public void apply() {
|
||||
|
||||
CompressorManager.getRecipes().add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo(){
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo(){
|
||||
public void undo() {
|
||||
CompressorManager.getRecipes().remove(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe(){
|
||||
public String describe() {
|
||||
return "Adding Compressor Recipe for " + recipe.getOutput().getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo(){
|
||||
public String describeUndo() {
|
||||
return "Un-adding Compressor Recipe for " + recipe.getOutput().getDisplayName();
|
||||
}
|
||||
|
||||
@@ -78,20 +80,21 @@ public class Compressor {
|
||||
}
|
||||
|
||||
private static class Remove implements IUndoableAction {
|
||||
|
||||
CompressorRecipe recipe = null;
|
||||
ItemStack remove;
|
||||
|
||||
public Remove(ItemStack rem){
|
||||
public Remove(ItemStack rem) {
|
||||
remove = rem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
public void apply() {
|
||||
|
||||
for(Object obj : CompressorManager.getRecipes()){
|
||||
if(obj instanceof CompressorRecipe){
|
||||
CompressorRecipe craft = (CompressorRecipe)obj;
|
||||
if(craft.getOutput().isItemEqual(remove)) {
|
||||
for (Object obj : CompressorManager.getRecipes()) {
|
||||
if (obj instanceof CompressorRecipe) {
|
||||
CompressorRecipe craft = (CompressorRecipe) obj;
|
||||
if (craft.getOutput().isItemEqual(remove)) {
|
||||
recipe = craft;
|
||||
CompressorManager.getRecipes().remove(obj);
|
||||
break;
|
||||
@@ -101,22 +104,22 @@ public class Compressor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo(){
|
||||
public boolean canUndo() {
|
||||
return recipe != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo(){
|
||||
public void undo() {
|
||||
CompressorManager.getRecipes().add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe(){
|
||||
public String describe() {
|
||||
return "Removing Compressor Recipe for " + remove.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo(){
|
||||
public String describeUndo() {
|
||||
return "Un-removing Compressor Recipe for " + remove.getDisplayName();
|
||||
}
|
||||
|
||||
@@ -127,7 +130,7 @@ public class Compressor {
|
||||
|
||||
}
|
||||
|
||||
private static ItemStack toStack(IItemStack item){
|
||||
private static ItemStack toStack(IItemStack item) {
|
||||
if (item == null) return null;
|
||||
else {
|
||||
Object internal = item.getInternal();
|
||||
@@ -138,28 +141,27 @@ public class Compressor {
|
||||
}
|
||||
}
|
||||
|
||||
private static Object toObject(IIngredient ingredient){
|
||||
private static Object toObject(IIngredient ingredient) {
|
||||
if (ingredient == null) return null;
|
||||
else {
|
||||
if (ingredient instanceof IOreDictEntry) {
|
||||
return toString((IOreDictEntry)ingredient);
|
||||
return toString((IOreDictEntry) ingredient);
|
||||
} else if (ingredient instanceof IItemStack) {
|
||||
return toStack((IItemStack) ingredient);
|
||||
} else return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static Object[] toObjects(IIngredient[] list){
|
||||
if(list == null)
|
||||
return null;
|
||||
private static Object[] toObjects(IIngredient[] list) {
|
||||
if (list == null) return null;
|
||||
Object[] ingredients = new Object[list.length];
|
||||
for(int x = 0;x < list.length;x++){
|
||||
for (int x = 0; x < list.length; x++) {
|
||||
ingredients[x] = toObject(list[x]);
|
||||
}
|
||||
return ingredients;
|
||||
}
|
||||
|
||||
private static Object toActualObject(IIngredient ingredient){
|
||||
private static Object toActualObject(IIngredient ingredient) {
|
||||
if (ingredient == null) return null;
|
||||
else {
|
||||
if (ingredient instanceof IOreDictEntry) {
|
||||
|
||||
@@ -1,43 +1,44 @@
|
||||
package fox.spiteful.avaritia.compat.minetweaker;
|
||||
|
||||
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeShapedOreRecipe;
|
||||
import fox.spiteful.avaritia.crafting.Grinder;
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.oredict.IOreDictEntry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.List;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeShapedOreRecipe;
|
||||
import fox.spiteful.avaritia.crafting.Grinder;
|
||||
|
||||
@ZenClass("mods.avaritia.ExtremeCrafting")
|
||||
public class ExtremeCrafting {
|
||||
|
||||
@ZenMethod
|
||||
public static void addShapeless(IItemStack output, IIngredient[] ingredients){
|
||||
public static void addShapeless(IItemStack output, IIngredient[] ingredients) {
|
||||
|
||||
MineTweakerAPI.apply(new Add(new ShapelessOreRecipe(toStack(output), toObjects(ingredients))));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addShaped(IItemStack output, IIngredient[][] ingredients){
|
||||
public static void addShaped(IItemStack output, IIngredient[][] ingredients) {
|
||||
int height = ingredients.length;
|
||||
int width = 0;
|
||||
for(IIngredient[] row : ingredients){
|
||||
if(width < row.length)
|
||||
width = row.length;
|
||||
for (IIngredient[] row : ingredients) {
|
||||
if (width < row.length) width = row.length;
|
||||
}
|
||||
Object[] input = new Object[width * height];
|
||||
int x = 0;
|
||||
for(IIngredient[] row : ingredients){
|
||||
for(IIngredient ingredient : row){
|
||||
for (IIngredient[] row : ingredients) {
|
||||
for (IIngredient ingredient : row) {
|
||||
input[x++] = toActualObject(ingredient);
|
||||
}
|
||||
}
|
||||
@@ -46,40 +47,41 @@ public class ExtremeCrafting {
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IItemStack target){
|
||||
public static void remove(IItemStack target) {
|
||||
MineTweakerAPI.apply(new Remove(toStack(target)));
|
||||
}
|
||||
|
||||
private static class Add implements IUndoableAction {
|
||||
|
||||
IRecipe recipe;
|
||||
|
||||
public Add(IRecipe add){
|
||||
public Add(IRecipe add) {
|
||||
recipe = add;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
public void apply() {
|
||||
|
||||
ExtremeCraftingManager.getInstance().getRecipeList().add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo(){
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo(){
|
||||
public void undo() {
|
||||
ExtremeCraftingManager.getInstance().getRecipeList().remove(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe(){
|
||||
public String describe() {
|
||||
return "Adding Xtreme Crafting Recipe for " + recipe.getRecipeOutput().getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo(){
|
||||
public String describeUndo() {
|
||||
return "Un-adding Xtreme Crafting Recipe for " + recipe.getRecipeOutput().getDisplayName();
|
||||
}
|
||||
|
||||
@@ -91,20 +93,21 @@ public class ExtremeCrafting {
|
||||
}
|
||||
|
||||
private static class Remove implements IUndoableAction {
|
||||
|
||||
IRecipe recipe = null;
|
||||
ItemStack remove;
|
||||
|
||||
public Remove(ItemStack rem){
|
||||
public Remove(ItemStack rem) {
|
||||
remove = rem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
public void apply() {
|
||||
|
||||
for(Object obj : ExtremeCraftingManager.getInstance().getRecipeList()){
|
||||
if(obj instanceof IRecipe){
|
||||
IRecipe craft = (IRecipe)obj;
|
||||
if(craft.getRecipeOutput().isItemEqual(remove)) {
|
||||
for (Object obj : ExtremeCraftingManager.getInstance().getRecipeList()) {
|
||||
if (obj instanceof IRecipe) {
|
||||
IRecipe craft = (IRecipe) obj;
|
||||
if (craft.getRecipeOutput().isItemEqual(remove)) {
|
||||
recipe = craft;
|
||||
ExtremeCraftingManager.getInstance().getRecipeList().remove(obj);
|
||||
break;
|
||||
@@ -114,22 +117,22 @@ public class ExtremeCrafting {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo(){
|
||||
public boolean canUndo() {
|
||||
return recipe != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo(){
|
||||
public void undo() {
|
||||
ExtremeCraftingManager.getInstance().getRecipeList().add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe(){
|
||||
public String describe() {
|
||||
return "Removing Xtreme Crafting Recipe for " + remove.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo(){
|
||||
public String describeUndo() {
|
||||
return "Un-removing Xtreme Crafting Recipe for " + remove.getDisplayName();
|
||||
}
|
||||
|
||||
@@ -141,46 +144,47 @@ public class ExtremeCrafting {
|
||||
}
|
||||
|
||||
private static class AddCatalyst implements IUndoableAction {
|
||||
|
||||
Object ingredient;
|
||||
|
||||
public AddCatalyst(Object add){
|
||||
public AddCatalyst(Object add) {
|
||||
ingredient = add;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
public void apply() {
|
||||
|
||||
Grinder.catalyst.getInput().add(ingredient);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo(){
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo(){
|
||||
public void undo() {
|
||||
Grinder.catalyst.getInput().remove(ingredient);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe(){
|
||||
if(ingredient instanceof ItemStack)
|
||||
return "Adding " + ((ItemStack)ingredient).getDisplayName() + " to Infinity Catalyst recipe.";
|
||||
else if(ingredient instanceof List)
|
||||
return "Adding " + ((ItemStack)(((List)ingredient).get(0))).getDisplayName() + " to Infinity Catalyst recipe.";
|
||||
else
|
||||
return "Adding something to Infinity Catalyst recipe.";
|
||||
public String describe() {
|
||||
if (ingredient instanceof ItemStack)
|
||||
return "Adding " + ((ItemStack) ingredient).getDisplayName() + " to Infinity Catalyst recipe.";
|
||||
else if (ingredient instanceof List)
|
||||
return "Adding " + ((ItemStack) (((List) ingredient).get(0))).getDisplayName()
|
||||
+ " to Infinity Catalyst recipe.";
|
||||
else return "Adding something to Infinity Catalyst recipe.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo(){
|
||||
if(ingredient instanceof ItemStack)
|
||||
return "Removing " + ((ItemStack)ingredient).getDisplayName() + " from Infinity Catalyst recipe.";
|
||||
else if(ingredient instanceof List)
|
||||
return "Removing " + ((ItemStack)(((List)ingredient).get(0))).getDisplayName() + " from Infinity Catalyst recipe.";
|
||||
else
|
||||
return "Removing something from Infinity Catalyst recipe.";
|
||||
public String describeUndo() {
|
||||
if (ingredient instanceof ItemStack)
|
||||
return "Removing " + ((ItemStack) ingredient).getDisplayName() + " from Infinity Catalyst recipe.";
|
||||
else if (ingredient instanceof List)
|
||||
return "Removing " + ((ItemStack) (((List) ingredient).get(0))).getDisplayName()
|
||||
+ " from Infinity Catalyst recipe.";
|
||||
else return "Removing something from Infinity Catalyst recipe.";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -191,38 +195,39 @@ public class ExtremeCrafting {
|
||||
}
|
||||
|
||||
private static class RemoveCatalyst implements IUndoableAction {
|
||||
|
||||
IIngredient ingredient;
|
||||
|
||||
public RemoveCatalyst(IIngredient rem){
|
||||
public RemoveCatalyst(IIngredient rem) {
|
||||
ingredient = rem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
public void apply() {
|
||||
|
||||
Grinder.catalyst.getInput().add(ingredient);
|
||||
for(Object ingredient : Grinder.catalyst.getInput()){
|
||||
for (Object ingredient : Grinder.catalyst.getInput()) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo(){
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo(){
|
||||
public void undo() {
|
||||
Grinder.catalyst.getInput().remove(ingredient);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe(){
|
||||
public String describe() {
|
||||
return "Adding something to Infinity Catalyst recipe.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo(){
|
||||
public String describeUndo() {
|
||||
return "Removing something from Infinity Catalyst recipe.";
|
||||
}
|
||||
|
||||
@@ -233,7 +238,7 @@ public class ExtremeCrafting {
|
||||
|
||||
}
|
||||
|
||||
private static ItemStack toStack(IItemStack item){
|
||||
private static ItemStack toStack(IItemStack item) {
|
||||
if (item == null) return null;
|
||||
else {
|
||||
Object internal = item.getInternal();
|
||||
@@ -244,28 +249,27 @@ public class ExtremeCrafting {
|
||||
}
|
||||
}
|
||||
|
||||
private static Object toObject(IIngredient ingredient){
|
||||
private static Object toObject(IIngredient ingredient) {
|
||||
if (ingredient == null) return null;
|
||||
else {
|
||||
if (ingredient instanceof IOreDictEntry) {
|
||||
return toString((IOreDictEntry)ingredient);
|
||||
return toString((IOreDictEntry) ingredient);
|
||||
} else if (ingredient instanceof IItemStack) {
|
||||
return toStack((IItemStack) ingredient);
|
||||
} else return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static Object[] toObjects(IIngredient[] list){
|
||||
if(list == null)
|
||||
return null;
|
||||
private static Object[] toObjects(IIngredient[] list) {
|
||||
if (list == null) return null;
|
||||
Object[] ingredients = new Object[list.length];
|
||||
for(int x = 0;x < list.length;x++){
|
||||
for (int x = 0; x < list.length; x++) {
|
||||
ingredients[x] = toObject(list[x]);
|
||||
}
|
||||
return ingredients;
|
||||
}
|
||||
|
||||
private static Object toActualObject(IIngredient ingredient){
|
||||
private static Object toActualObject(IIngredient ingredient) {
|
||||
if (ingredient == null) return null;
|
||||
else {
|
||||
if (ingredient instanceof IOreDictEntry) {
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package fox.spiteful.avaritia.compat.minetweaker;
|
||||
|
||||
import fox.spiteful.avaritia.Config;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import fox.spiteful.avaritia.Config;
|
||||
|
||||
public class Tweak {
|
||||
|
||||
public static void registrate(){
|
||||
public static void registrate() {
|
||||
MineTweakerAPI.registerClass(ExtremeCrafting.class);
|
||||
if(Config.craftingOnly)
|
||||
return;
|
||||
if (Config.craftingOnly) return;
|
||||
|
||||
MineTweakerAPI.registerClass(Compressor.class);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
package fox.spiteful.avaritia.compat.nei;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
@@ -9,37 +19,27 @@ import fox.spiteful.avaritia.crafting.CompressOreRecipe;
|
||||
import fox.spiteful.avaritia.crafting.CompressorManager;
|
||||
import fox.spiteful.avaritia.crafting.CompressorRecipe;
|
||||
import fox.spiteful.avaritia.gui.GUICompressor;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
public class CompressionHandler extends TemplateRecipeHandler {
|
||||
|
||||
public class CompressionHandler extends TemplateRecipeHandler
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private FontRenderer fontRender;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public CompressionHandler(){
|
||||
public CompressionHandler() {
|
||||
super();
|
||||
fontRender = Minecraft.getMinecraft().fontRenderer;
|
||||
}
|
||||
|
||||
public class CachedCompression extends CachedRecipe
|
||||
{
|
||||
public class CachedCompression extends CachedRecipe {
|
||||
|
||||
public CachedCompression(CompressorRecipe recipe) {
|
||||
this.ingred = new PositionedStack(recipe.getIngredient(), 51, 16);
|
||||
this.result = new PositionedStack(recipe.getOutput(), 111, 16);
|
||||
this.cost = recipe.getCost();
|
||||
}
|
||||
public CachedCompression(ItemStack output, int price, ItemStack ingredient){
|
||||
|
||||
public CachedCompression(ItemStack output, int price, ItemStack ingredient) {
|
||||
this.ingred = new PositionedStack(ingredient, 51, 16);
|
||||
this.result = new PositionedStack(output, 111, 16);
|
||||
cost = price;
|
||||
@@ -59,7 +59,7 @@ public class CompressionHandler extends TemplateRecipeHandler
|
||||
ingred.generatePermutations();
|
||||
}
|
||||
|
||||
public int getCost(){
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
@@ -88,20 +88,19 @@ public class CompressionHandler extends TemplateRecipeHandler
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("extreme_compression") && getClass() == CompressionHandler.class) {
|
||||
for (CompressorRecipe recipe : CompressorManager.getRecipes()) {
|
||||
if(safeOre(recipe)) {
|
||||
if (safeOre(recipe)) {
|
||||
CachedCompression r = new CachedCompression(recipe);
|
||||
r.computeVisuals();
|
||||
arecipes.add(r);
|
||||
}
|
||||
}
|
||||
} else
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
} else super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (CompressorRecipe recipe : CompressorManager.getRecipes()) {
|
||||
if(safeOre(recipe) && NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result)){
|
||||
if (safeOre(recipe) && NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result)) {
|
||||
CachedCompression r = new CachedCompression(recipe);
|
||||
r.computeVisuals();
|
||||
arecipes.add(r);
|
||||
@@ -113,24 +112,22 @@ public class CompressionHandler extends TemplateRecipeHandler
|
||||
public void loadUsageRecipes(String inputId, Object... ingredients) {
|
||||
if (inputId.equals("extreme_compression") && getClass() == CompressionHandler.class)
|
||||
loadCraftingRecipes("extreme_compression");
|
||||
else
|
||||
super.loadUsageRecipes(inputId, ingredients);
|
||||
else super.loadUsageRecipes(inputId, ingredients);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for (CompressorRecipe recipe : CompressorManager.getRecipes()) {
|
||||
if(safeOre(recipe) && recipe.validInput(ingredient)){
|
||||
if (safeOre(recipe) && recipe.validInput(ingredient)) {
|
||||
CachedCompression r = new CachedCompression(recipe.getOutput(), recipe.getCost(), ingredient);
|
||||
arecipes.add(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean safeOre(CompressorRecipe recipe){
|
||||
if(!(recipe instanceof CompressOreRecipe))
|
||||
return true;
|
||||
return !((ArrayList)recipe.getIngredient()).isEmpty();
|
||||
private boolean safeOre(CompressorRecipe recipe) {
|
||||
if (!(recipe instanceof CompressOreRecipe)) return true;
|
||||
return !((ArrayList) recipe.getIngredient()).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -140,9 +137,9 @@ public class CompressionHandler extends TemplateRecipeHandler
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void drawForeground(int recipe){
|
||||
public void drawForeground(int recipe) {
|
||||
super.drawForeground(recipe);
|
||||
fontRender.drawString(((CachedCompression)arecipes.get(recipe)).getCost() + "", 50, 38, 4210752);
|
||||
fontRender.drawString(((CachedCompression) arecipes.get(recipe)).getCost() + "", 50, 38, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,49 +1,45 @@
|
||||
package fox.spiteful.avaritia.compat.nei;
|
||||
|
||||
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeShapedOreRecipe;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeShapedRecipe;
|
||||
import fox.spiteful.avaritia.gui.GUIExtremeCrafting;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.RecipeInfo;
|
||||
import codechicken.nei.recipe.ShapedRecipeHandler;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ExtremeShapedRecipeHandler extends ShapedRecipeHandler
|
||||
{
|
||||
public class CachedExtremeRecipe extends CachedRecipe
|
||||
{
|
||||
public CachedExtremeRecipe(ExtremeShapedRecipe recipe)
|
||||
{
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.RecipeInfo;
|
||||
import codechicken.nei.recipe.ShapedRecipeHandler;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeShapedOreRecipe;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeShapedRecipe;
|
||||
import fox.spiteful.avaritia.gui.GUIExtremeCrafting;
|
||||
|
||||
public class ExtremeShapedRecipeHandler extends ShapedRecipeHandler {
|
||||
|
||||
public class CachedExtremeRecipe extends CachedRecipe {
|
||||
|
||||
public CachedExtremeRecipe(ExtremeShapedRecipe recipe) {
|
||||
this(recipe.recipeWidth, recipe.recipeHeight, recipe.recipeItems, recipe.getRecipeOutput());
|
||||
}
|
||||
|
||||
public CachedExtremeRecipe(int width, int height, Object[] items, ItemStack out)
|
||||
{
|
||||
public CachedExtremeRecipe(int width, int height, Object[] items, ItemStack out) {
|
||||
this.result = new PositionedStack(out, 201, 75);
|
||||
this.ingredients = new ArrayList<PositionedStack>();
|
||||
setIngredients(width, height, items);
|
||||
}
|
||||
|
||||
public void setIngredients(int width, int height, Object[] items)
|
||||
{
|
||||
for(int x = 0; x < width; x++)
|
||||
{
|
||||
for(int y = 0; y < height; y++)
|
||||
{
|
||||
if(items[y * width + x] == null)
|
||||
{
|
||||
public void setIngredients(int width, int height, Object[] items) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
if (items[y * width + x] == null) {
|
||||
continue;
|
||||
}
|
||||
PositionedStack stack = new PositionedStack(items[y * width + x], 3 + x * 18, 3 + y * 18);
|
||||
@@ -54,20 +50,19 @@ public class ExtremeShapedRecipeHandler extends ShapedRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<PositionedStack> getIngredients()
|
||||
{
|
||||
return (ArrayList<PositionedStack>) getCycledIngredients(ExtremeShapedRecipeHandler.this.cycleticks / 20, this.ingredients);
|
||||
public ArrayList<PositionedStack> getIngredients() {
|
||||
return (ArrayList<PositionedStack>) getCycledIngredients(
|
||||
ExtremeShapedRecipeHandler.this.cycleticks / 20,
|
||||
this.ingredients);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
public PositionedStack getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public void computeVisuals() {
|
||||
for (PositionedStack p : ingredients)
|
||||
p.generatePermutations();
|
||||
for (PositionedStack p : ingredients) p.generatePermutations();
|
||||
}
|
||||
|
||||
public ArrayList<PositionedStack> ingredients;
|
||||
@@ -75,20 +70,17 @@ public class ExtremeShapedRecipeHandler extends ShapedRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recipiesPerPage()
|
||||
{
|
||||
public int recipiesPerPage() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return GUIExtremeCrafting.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("crafting.extreme");
|
||||
}
|
||||
|
||||
@@ -102,8 +94,7 @@ public class ExtremeShapedRecipeHandler extends ShapedRecipeHandler
|
||||
else if (irecipe instanceof ExtremeShapedOreRecipe)
|
||||
recipe = forgeExtremeShapedRecipe((ExtremeShapedOreRecipe) irecipe);
|
||||
|
||||
if (recipe == null)
|
||||
continue;
|
||||
if (recipe == null) continue;
|
||||
|
||||
recipe.computeVisuals();
|
||||
arecipes.add(recipe);
|
||||
@@ -123,8 +114,7 @@ public class ExtremeShapedRecipeHandler extends ShapedRecipeHandler
|
||||
else if (irecipe instanceof ExtremeShapedOreRecipe)
|
||||
recipe = forgeExtremeShapedRecipe((ExtremeShapedOreRecipe) irecipe);
|
||||
|
||||
if (recipe == null)
|
||||
continue;
|
||||
if (recipe == null) continue;
|
||||
|
||||
recipe.computeVisuals();
|
||||
arecipes.add(recipe);
|
||||
@@ -136,13 +126,11 @@ public class ExtremeShapedRecipeHandler extends ShapedRecipeHandler
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for (IRecipe irecipe : (List<IRecipe>) ExtremeCraftingManager.getInstance().getRecipeList()) {
|
||||
CachedExtremeRecipe recipe = null;
|
||||
if (irecipe instanceof ExtremeShapedRecipe)
|
||||
recipe = new CachedExtremeRecipe((ExtremeShapedRecipe) irecipe);
|
||||
if (irecipe instanceof ExtremeShapedRecipe) recipe = new CachedExtremeRecipe((ExtremeShapedRecipe) irecipe);
|
||||
else if (irecipe instanceof ExtremeShapedOreRecipe)
|
||||
recipe = forgeExtremeShapedRecipe((ExtremeShapedOreRecipe) irecipe);
|
||||
|
||||
if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem()))
|
||||
continue;
|
||||
if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem())) continue;
|
||||
|
||||
recipe.computeVisuals();
|
||||
if (recipe.contains(recipe.ingredients, ingredient)) {
|
||||
@@ -157,9 +145,8 @@ public class ExtremeShapedRecipeHandler extends ShapedRecipeHandler
|
||||
int height = recipe.height;
|
||||
|
||||
Object[] items = recipe.getInput();
|
||||
for (Object item : items)
|
||||
if (item instanceof List && ((List<?>) item).isEmpty())//ore handler, no ores
|
||||
return null;
|
||||
for (Object item : items) if (item instanceof List && ((List<?>) item).isEmpty())// ore handler, no ores
|
||||
return null;
|
||||
|
||||
return new CachedExtremeRecipe(width, height, items, recipe.getRecipeOutput());
|
||||
}
|
||||
@@ -175,20 +162,17 @@ public class ExtremeShapedRecipeHandler extends ShapedRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture()
|
||||
{
|
||||
public String getGuiTexture() {
|
||||
return "avaritia:textures/gui/extreme_nei.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
{
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe) {
|
||||
return RecipeInfo.hasDefaultOverlay(gui, "extreme");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe)
|
||||
{
|
||||
public void drawBackground(int recipe) {
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
@@ -1,30 +1,32 @@
|
||||
package fox.spiteful.avaritia.compat.nei;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.recipe.RecipeInfo;
|
||||
import codechicken.nei.recipe.ShapelessRecipeHandler;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeShapelessRecipe;
|
||||
import fox.spiteful.avaritia.gui.GUIExtremeCrafting;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ExtremeShapelessRecipeHandler extends ShapelessRecipeHandler{
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.RecipeInfo;
|
||||
import codechicken.nei.recipe.ShapelessRecipeHandler;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeShapelessRecipe;
|
||||
import fox.spiteful.avaritia.gui.GUIExtremeCrafting;
|
||||
|
||||
public class ExtremeShapelessRecipeHandler extends ShapelessRecipeHandler {
|
||||
|
||||
public class CachedExtremeShapelessRecipe extends CachedRecipe {
|
||||
|
||||
public class CachedExtremeShapelessRecipe extends CachedRecipe
|
||||
{
|
||||
public CachedExtremeShapelessRecipe() {
|
||||
ingredients = new ArrayList<PositionedStack>();
|
||||
}
|
||||
@@ -46,7 +48,10 @@ public class ExtremeShapelessRecipeHandler extends ShapelessRecipeHandler{
|
||||
public void setIngredients(List<?> items) {
|
||||
ingredients.clear();
|
||||
for (int ingred = 0; ingred < items.size(); ingred++) {
|
||||
PositionedStack stack = new PositionedStack(items.get(ingred), 3 + (ingred % 9) * 18, 3 + (ingred / 9) * 18);
|
||||
PositionedStack stack = new PositionedStack(
|
||||
items.get(ingred),
|
||||
3 + (ingred % 9) * 18,
|
||||
3 + (ingred / 9) * 18);
|
||||
stack.setMaxSize(1);
|
||||
ingredients.add(stack);
|
||||
}
|
||||
@@ -85,8 +90,7 @@ public class ExtremeShapelessRecipeHandler extends ShapelessRecipeHandler{
|
||||
else if (irecipe instanceof ShapelessOreRecipe)
|
||||
recipe = forgeExtremeShapelessRecipe((ShapelessOreRecipe) irecipe);
|
||||
|
||||
if (recipe == null)
|
||||
continue;
|
||||
if (recipe == null) continue;
|
||||
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
@@ -106,8 +110,7 @@ public class ExtremeShapelessRecipeHandler extends ShapelessRecipeHandler{
|
||||
else if (irecipe instanceof ShapelessOreRecipe)
|
||||
recipe = forgeExtremeShapelessRecipe((ShapelessOreRecipe) irecipe);
|
||||
|
||||
if (recipe == null)
|
||||
continue;
|
||||
if (recipe == null) continue;
|
||||
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
@@ -119,13 +122,11 @@ public class ExtremeShapelessRecipeHandler extends ShapelessRecipeHandler{
|
||||
List<IRecipe> allrecipes = ExtremeCraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes) {
|
||||
CachedExtremeShapelessRecipe recipe = null;
|
||||
if (irecipe instanceof ExtremeShapelessRecipe)
|
||||
recipe = shapelessRecipe((ExtremeShapelessRecipe) irecipe);
|
||||
if (irecipe instanceof ExtremeShapelessRecipe) recipe = shapelessRecipe((ExtremeShapelessRecipe) irecipe);
|
||||
else if (irecipe instanceof ShapelessOreRecipe)
|
||||
recipe = forgeExtremeShapelessRecipe((ShapelessOreRecipe) irecipe);
|
||||
|
||||
if (recipe == null)
|
||||
continue;
|
||||
if (recipe == null) continue;
|
||||
|
||||
if (recipe.contains(recipe.ingredients, ingredient)) {
|
||||
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
|
||||
@@ -135,7 +136,7 @@ public class ExtremeShapelessRecipeHandler extends ShapelessRecipeHandler{
|
||||
}
|
||||
|
||||
private CachedExtremeShapelessRecipe shapelessRecipe(ExtremeShapelessRecipe recipe) {
|
||||
if(recipe.recipeItems == null) //because some mod subclasses actually do this
|
||||
if (recipe.recipeItems == null) // because some mod subclasses actually do this
|
||||
return null;
|
||||
|
||||
return new CachedExtremeShapelessRecipe(recipe.recipeItems, recipe.getRecipeOutput());
|
||||
@@ -144,9 +145,8 @@ public class ExtremeShapelessRecipeHandler extends ShapelessRecipeHandler{
|
||||
public CachedExtremeShapelessRecipe forgeExtremeShapelessRecipe(ShapelessOreRecipe recipe) {
|
||||
ArrayList<Object> items = recipe.getInput();
|
||||
|
||||
for (Object item : items)
|
||||
if (item instanceof List && ((List<?>) item).isEmpty())//ore handler, no ores
|
||||
return null;
|
||||
for (Object item : items) if (item instanceof List && ((List<?>) item).isEmpty())// ore handler, no ores
|
||||
return null;
|
||||
|
||||
return new CachedExtremeShapelessRecipe(items, recipe.getRecipeOutput());
|
||||
}
|
||||
@@ -162,20 +162,17 @@ public class ExtremeShapelessRecipeHandler extends ShapelessRecipeHandler{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture()
|
||||
{
|
||||
public String getGuiTexture() {
|
||||
return "avaritia:textures/gui/extreme_nei.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
{
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe) {
|
||||
return RecipeInfo.hasDefaultOverlay(gui, "extreme");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe)
|
||||
{
|
||||
public void drawBackground(int recipe) {
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
@@ -186,15 +183,13 @@ public class ExtremeShapelessRecipeHandler extends ShapelessRecipeHandler{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recipiesPerPage()
|
||||
{
|
||||
public int recipiesPerPage() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return GUIExtremeCrafting.class;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package fox.spiteful.avaritia.compat.nei;
|
||||
|
||||
import codechicken.nei.api.API;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import codechicken.nei.api.API;
|
||||
|
||||
public class NotEnough {
|
||||
|
||||
public static void items(){
|
||||
public static void items() {
|
||||
ExtremeShapedRecipeHandler shaped = new ExtremeShapedRecipeHandler();
|
||||
ExtremeShapelessRecipeHandler shapeless = new ExtremeShapelessRecipeHandler();
|
||||
CompressionHandler compress = new CompressionHandler();
|
||||
@@ -17,7 +18,7 @@ public class NotEnough {
|
||||
API.registerUsageHandler(compress);
|
||||
}
|
||||
|
||||
public static void hide(ItemStack stack){
|
||||
public static void hide(ItemStack stack) {
|
||||
API.hideItem(stack);
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,6 @@ package fox.spiteful.avaritia.compat.tails;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -13,6 +11,9 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -20,90 +21,117 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class InfiniteFoxes {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static FakeTailEntity fakeEntity;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static Object tailPartInfo;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static Object earPartInfo;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static Object foxTailRender;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static Object foxEarsRender;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static Method m_RenderPart_render;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static FakeTailEntity fakeEntity;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static Object tailPartInfo;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static Object earPartInfo;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static Object foxTailRender;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static Object foxEarsRender;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static Method m_RenderPart_render;
|
||||
|
||||
public static void floof() {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
|
||||
grabReflections();
|
||||
MinecraftForge.EVENT_BUS.register(new InfiniteFoxes());
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void grabReflections() {
|
||||
try {
|
||||
Class c_PartType = Class.forName("kihira.tails.common.PartsData$PartType");
|
||||
Class c_PartInfo = Class.forName("kihira.tails.common.PartInfo");
|
||||
|
||||
public static void floof(){
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
|
||||
grabReflections();
|
||||
MinecraftForge.EVENT_BUS.register(new InfiniteFoxes());
|
||||
}
|
||||
}
|
||||
// Setup Info
|
||||
Constructor constr = c_PartInfo.getConstructor(
|
||||
boolean.class,
|
||||
int.class,
|
||||
int.class,
|
||||
int.class,
|
||||
int[].class,
|
||||
c_PartType,
|
||||
ResourceLocation.class);
|
||||
tailPartInfo = constr.newInstance(
|
||||
true,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
new int[] { -5480951, -6594259, -5197647 },
|
||||
Enum.valueOf(c_PartType, "TAIL"),
|
||||
null);
|
||||
earPartInfo = constr.newInstance(
|
||||
true,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
new int[] { -5480951, 0xFF000000, -5197647 },
|
||||
Enum.valueOf(c_PartType, "EARS"),
|
||||
null);
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void grabReflections() {
|
||||
try {
|
||||
Class c_PartType = Class.forName("kihira.tails.common.PartsData$PartType");
|
||||
Class c_PartInfo = Class.forName("kihira.tails.common.PartInfo");
|
||||
// Grab renderparts + render method
|
||||
Class c_RenderPart = Class.forName("kihira.tails.client.render.RenderPart");
|
||||
Class c_PartRegistry = Class.forName("kihira.tails.client.PartRegistry");
|
||||
Method m_getRenderPart = c_PartRegistry.getMethod("getRenderPart", c_PartType, int.class);
|
||||
foxTailRender = m_getRenderPart.invoke(null, Enum.valueOf(c_PartType, "TAIL"), 0);
|
||||
foxEarsRender = m_getRenderPart.invoke(null, Enum.valueOf(c_PartType, "EARS"), 0);
|
||||
|
||||
//Setup Info
|
||||
Constructor constr = c_PartInfo.getConstructor(boolean.class, int.class, int.class, int.class, int[].class, c_PartType, ResourceLocation.class);
|
||||
tailPartInfo = constr.newInstance(true, 0, 2, 0, new int[]{-5480951, -6594259, -5197647}, Enum.valueOf(c_PartType, "TAIL"), null);
|
||||
earPartInfo = constr.newInstance(true, 0, 0, 0, new int[]{-5480951, 0xFF000000, -5197647}, Enum.valueOf(c_PartType, "EARS"), null);
|
||||
m_RenderPart_render = c_RenderPart.getMethod(
|
||||
"render",
|
||||
EntityLivingBase.class,
|
||||
c_PartInfo,
|
||||
double.class,
|
||||
double.class,
|
||||
double.class,
|
||||
float.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//Grab renderparts + render method
|
||||
Class c_RenderPart = Class.forName("kihira.tails.client.render.RenderPart");
|
||||
Class c_PartRegistry = Class.forName("kihira.tails.client.PartRegistry");
|
||||
Method m_getRenderPart = c_PartRegistry.getMethod("getRenderPart", c_PartType, int.class);
|
||||
foxTailRender = m_getRenderPart.invoke(null, Enum.valueOf(c_PartType, "TAIL"),0);
|
||||
foxEarsRender = m_getRenderPart.invoke(null, Enum.valueOf(c_PartType, "EARS"),0);
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void renderInfinitatoFluff(float partialTicks) {
|
||||
if (fakeEntity == null) {
|
||||
fakeEntity = new FakeTailEntity(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
|
||||
m_RenderPart_render = c_RenderPart.getMethod("render", EntityLivingBase.class, c_PartInfo, double.class, double.class, double.class, float.class);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (m_RenderPart_render != null) {
|
||||
try {
|
||||
GL11.glScalef(2, 2, 2);
|
||||
GL11.glTranslatef(0, .25f, .5f);
|
||||
m_RenderPart_render.invoke(foxTailRender, fakeEntity, tailPartInfo, 0, 0, 0, partialTicks);
|
||||
GL11.glTranslatef(0, .25f, -.75f);
|
||||
GL11.glScalef(2, 2, 2);
|
||||
m_RenderPart_render.invoke(foxEarsRender, fakeEntity, earPartInfo, 0, 0, 0, partialTicks);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void renderInfinitatoFluff(float partialTicks) {
|
||||
if (fakeEntity == null) {
|
||||
fakeEntity = new FakeTailEntity(Minecraft.getMinecraft().theWorld);
|
||||
}
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onWorldUnload(WorldEvent.Unload e) {
|
||||
if (fakeEntity != null) {
|
||||
fakeEntity.setDead();
|
||||
fakeEntity = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_RenderPart_render != null) {
|
||||
try {
|
||||
GL11.glScalef(2,2,2);
|
||||
GL11.glTranslatef(0,.25f,.5f);
|
||||
m_RenderPart_render.invoke(foxTailRender, fakeEntity, tailPartInfo, 0,0,0, partialTicks);
|
||||
GL11.glTranslatef(0,.25f,-.75f);
|
||||
GL11.glScalef(2,2,2);
|
||||
m_RenderPart_render.invoke(foxEarsRender, fakeEntity, earPartInfo, 0,0,0, partialTicks);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static class FakeTailEntity extends EntityLiving {
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onWorldUnload(WorldEvent.Unload e) {
|
||||
if (fakeEntity != null) {
|
||||
fakeEntity.setDead();
|
||||
fakeEntity = null;
|
||||
}
|
||||
}
|
||||
public FakeTailEntity(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static class FakeTailEntity extends EntityLiving {
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {}
|
||||
|
||||
public FakeTailEntity(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {}
|
||||
}
|
||||
}
|
||||
@@ -2,17 +2,26 @@ package fox.spiteful.avaritia.compat.thaumcraft;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.wands.IWandRodOnUpdate;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
public class CheatyWandUpdate implements IWandRodOnUpdate {
|
||||
|
||||
Aspect primals[] = Aspect.getPrimalAspects().toArray(new Aspect[0]);
|
||||
|
||||
public void onUpdate(ItemStack itemstack, EntityPlayer player) {
|
||||
for (int x = 0; x < primals.length; x++) {
|
||||
if (((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]) < ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack)) {
|
||||
((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]), true);
|
||||
if (((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x])
|
||||
< ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack)) {
|
||||
((ItemWandCasting) itemstack.getItem()).addVis(
|
||||
itemstack,
|
||||
primals[x],
|
||||
((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack)
|
||||
- ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]),
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
package fox.spiteful.avaritia.compat.thaumcraft;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -11,16 +9,19 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.lib.network.PacketHandler;
|
||||
import thaumcraft.common.lib.network.playerdata.PacketAspectPool;
|
||||
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
|
||||
public class ItemAkashicRecord extends Item {
|
||||
|
||||
public ItemAkashicRecord(){
|
||||
public ItemAkashicRecord() {
|
||||
setUnlocalizedName("akashic_record");
|
||||
setTextureName("avaritia:akashic_record");
|
||||
setCreativeTab(Avaritia.tab);
|
||||
@@ -28,16 +29,21 @@ public class ItemAkashicRecord extends Item {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if(world.isRemote)
|
||||
return stack;
|
||||
if (world.isRemote) return stack;
|
||||
|
||||
for(Aspect aspect : Aspect.aspects.values()) {
|
||||
for (Aspect aspect : Aspect.aspects.values()) {
|
||||
Thaumcraft.proxy.playerKnowledge.addAspectPool(player.getCommandSenderName(), aspect, (short) 999);
|
||||
PacketHandler.INSTANCE.sendTo(new PacketAspectPool(aspect.getTag(), (short)999, Short.valueOf(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(player.getCommandSenderName(), aspect))), (EntityPlayerMP) player);
|
||||
PacketHandler.INSTANCE.sendTo(
|
||||
new PacketAspectPool(
|
||||
aspect.getTag(),
|
||||
(short) 999,
|
||||
Short.valueOf(
|
||||
Thaumcraft.proxy.playerKnowledge
|
||||
.getAspectPoolFor(player.getCommandSenderName(), aspect))),
|
||||
(EntityPlayerMP) player);
|
||||
}
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
--stack.stackSize;
|
||||
}
|
||||
return stack;
|
||||
@@ -56,8 +62,7 @@ public class ItemAkashicRecord extends Item {
|
||||
tag.setString("rod", "infinity");
|
||||
cosmic.setTagCompound(tag);
|
||||
list.add(cosmic);
|
||||
}
|
||||
catch (Throwable e){}
|
||||
} catch (Throwable e) {}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
package fox.spiteful.avaritia.compat.thaumcraft;
|
||||
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
|
||||
public class ItemBigPearl extends Item {
|
||||
|
||||
public ItemBigPearl(){
|
||||
public ItemBigPearl() {
|
||||
setMaxStackSize(1);
|
||||
this.setUnlocalizedName("extremely_primordial_pearl");
|
||||
this.setTextureName("avaritia:big_pearl");
|
||||
@@ -21,20 +21,17 @@ public class ItemBigPearl extends Item {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasContainerItem()
|
||||
{
|
||||
public boolean hasContainerItem() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack)
|
||||
{
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem(ItemStack itemStack)
|
||||
{
|
||||
public ItemStack getContainerItem(ItemStack itemStack) {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
package fox.spiteful.avaritia.compat.thaumcraft;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.crafting.InfusionRecipe;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
import thaumcraft.api.wands.WandCap;
|
||||
import thaumcraft.api.wands.WandRod;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
@@ -8,22 +25,6 @@ import fox.spiteful.avaritia.compat.Compat;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
|
||||
import fox.spiteful.avaritia.crafting.Grinder;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.crafting.InfusionRecipe;
|
||||
import thaumcraft.api.research.ResearchCategories;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
import thaumcraft.api.wands.WandCap;
|
||||
import thaumcraft.api.wands.WandRod;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
public class Lucrum {
|
||||
|
||||
@@ -32,7 +33,12 @@ public class Lucrum {
|
||||
public static WandCap WAND_CAP_CRYSTAL;
|
||||
|
||||
public static void abracadabra() throws Compat.ItemNotFoundException {
|
||||
ULTRA_DEATH = new Aspect("terminus", 0xb90000, new Aspect[] { Aspect.GREED, Aspect.ELDRITCH }, new ResourceLocation("avaritia", "textures/misc/terminus.png"), 771);
|
||||
ULTRA_DEATH = new Aspect(
|
||||
"terminus",
|
||||
0xb90000,
|
||||
new Aspect[] { Aspect.GREED, Aspect.ELDRITCH },
|
||||
new ResourceLocation("avaritia", "textures/misc/terminus.png"),
|
||||
771);
|
||||
|
||||
LudicrousItems.akashic_record = new ItemAkashicRecord();
|
||||
GameRegistry.registerItem(LudicrousItems.akashic_record, "Akashic_Record");
|
||||
@@ -41,33 +47,74 @@ public class Lucrum {
|
||||
|
||||
Grinder.catalyst.getInput().add(new ItemStack(LudicrousItems.bigPearl));
|
||||
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(LudicrousItems.resource, 1, 1), new AspectList().add(ULTRA_DEATH, 1).add(Aspect.ENERGY, 8).add(Aspect.CRYSTAL, 32));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(LudicrousItems.resource, 1, 4), new AspectList().add(ULTRA_DEATH, 2).add(Aspect.METAL, 12).add(Aspect.ENERGY, 12));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(LudicrousItems.resource, 1, 5), new AspectList().add(ULTRA_DEATH, 5).add(Aspect.EXCHANGE, 12));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(LudicrousItems.resource, 1, 6), new AspectList().add(ULTRA_DEATH, 16).add(Aspect.ELDRITCH, 64));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(LudicrousBlocks.neutron_collector, 1, OreDictionary.WILDCARD_VALUE), new AspectList().add(ULTRA_DEATH, 5).add(Aspect.METAL, 64).add(Aspect.ENERGY, 64).add(Aspect.MECHANISM, 64));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(LudicrousItems.singularity, 1, 0), new AspectList().add(ULTRA_DEATH, 3).add(Aspect.METAL, 100));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(LudicrousItems.singularity, 1, 1), new AspectList().add(ULTRA_DEATH, 3).add(Aspect.METAL, 100).add(Aspect.GREED, 100));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(LudicrousItems.singularity, 1, 2), new AspectList().add(ULTRA_DEATH, 3).add(Aspect.SENSES, 100));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(LudicrousItems.singularity, 1, 3), new AspectList().add(ULTRA_DEATH, 3).add(Aspect.MECHANISM, 100).add(Aspect.ENERGY, 100));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(LudicrousItems.singularity, 1, 4), new AspectList().add(ULTRA_DEATH, 3).add(Aspect.CRYSTAL, 100).add(Aspect.ORDER, 100));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(LudicrousItems.singularity, 1, 5), new AspectList().add(ULTRA_DEATH, 3).add(Aspect.METAL, 100));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(LudicrousItems.singularity, 1, 6), new AspectList().add(ULTRA_DEATH, 3).add(Aspect.METAL, 100));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(LudicrousItems.singularity, 1, 7), new AspectList().add(ULTRA_DEATH, 3).add(Aspect.METAL, 100));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(LudicrousItems.singularity, 1, 8), new AspectList().add(ULTRA_DEATH, 3).add(Aspect.METAL, 100));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(LudicrousItems.infinity_sword), new AspectList().add(ULTRA_DEATH, 60).add(Aspect.WEAPON, 999).add(Aspect.DEATH, 999).add(Aspect.ELDRITCH, 100));
|
||||
ThaumcraftApi.registerComplexObjectTag(new ItemStack(LudicrousItems.skull_sword), new AspectList().add(ULTRA_DEATH, 1).add(Aspect.FIRE, 2).add(Aspect.CRYSTAL, 16).add(Aspect.DEATH, 4));
|
||||
ThaumcraftApi.registerObjectTag(
|
||||
new ItemStack(LudicrousItems.resource, 1, 1),
|
||||
new AspectList().add(ULTRA_DEATH, 1).add(Aspect.ENERGY, 8).add(Aspect.CRYSTAL, 32));
|
||||
ThaumcraftApi.registerObjectTag(
|
||||
new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
new AspectList().add(ULTRA_DEATH, 2).add(Aspect.METAL, 12).add(Aspect.ENERGY, 12));
|
||||
ThaumcraftApi.registerObjectTag(
|
||||
new ItemStack(LudicrousItems.resource, 1, 5),
|
||||
new AspectList().add(ULTRA_DEATH, 5).add(Aspect.EXCHANGE, 12));
|
||||
ThaumcraftApi.registerObjectTag(
|
||||
new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
new AspectList().add(ULTRA_DEATH, 16).add(Aspect.ELDRITCH, 64));
|
||||
ThaumcraftApi.registerObjectTag(
|
||||
new ItemStack(LudicrousBlocks.neutron_collector, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new AspectList().add(ULTRA_DEATH, 5).add(Aspect.METAL, 64).add(Aspect.ENERGY, 64)
|
||||
.add(Aspect.MECHANISM, 64));
|
||||
ThaumcraftApi.registerObjectTag(
|
||||
new ItemStack(LudicrousItems.singularity, 1, 0),
|
||||
new AspectList().add(ULTRA_DEATH, 3).add(Aspect.METAL, 100));
|
||||
ThaumcraftApi.registerObjectTag(
|
||||
new ItemStack(LudicrousItems.singularity, 1, 1),
|
||||
new AspectList().add(ULTRA_DEATH, 3).add(Aspect.METAL, 100).add(Aspect.GREED, 100));
|
||||
ThaumcraftApi.registerObjectTag(
|
||||
new ItemStack(LudicrousItems.singularity, 1, 2),
|
||||
new AspectList().add(ULTRA_DEATH, 3).add(Aspect.SENSES, 100));
|
||||
ThaumcraftApi.registerObjectTag(
|
||||
new ItemStack(LudicrousItems.singularity, 1, 3),
|
||||
new AspectList().add(ULTRA_DEATH, 3).add(Aspect.MECHANISM, 100).add(Aspect.ENERGY, 100));
|
||||
ThaumcraftApi.registerObjectTag(
|
||||
new ItemStack(LudicrousItems.singularity, 1, 4),
|
||||
new AspectList().add(ULTRA_DEATH, 3).add(Aspect.CRYSTAL, 100).add(Aspect.ORDER, 100));
|
||||
ThaumcraftApi.registerObjectTag(
|
||||
new ItemStack(LudicrousItems.singularity, 1, 5),
|
||||
new AspectList().add(ULTRA_DEATH, 3).add(Aspect.METAL, 100));
|
||||
ThaumcraftApi.registerObjectTag(
|
||||
new ItemStack(LudicrousItems.singularity, 1, 6),
|
||||
new AspectList().add(ULTRA_DEATH, 3).add(Aspect.METAL, 100));
|
||||
ThaumcraftApi.registerObjectTag(
|
||||
new ItemStack(LudicrousItems.singularity, 1, 7),
|
||||
new AspectList().add(ULTRA_DEATH, 3).add(Aspect.METAL, 100));
|
||||
ThaumcraftApi.registerObjectTag(
|
||||
new ItemStack(LudicrousItems.singularity, 1, 8),
|
||||
new AspectList().add(ULTRA_DEATH, 3).add(Aspect.METAL, 100));
|
||||
ThaumcraftApi.registerObjectTag(
|
||||
new ItemStack(LudicrousItems.infinity_sword),
|
||||
new AspectList().add(ULTRA_DEATH, 60).add(Aspect.WEAPON, 999).add(Aspect.DEATH, 999)
|
||||
.add(Aspect.ELDRITCH, 100));
|
||||
ThaumcraftApi.registerComplexObjectTag(
|
||||
new ItemStack(LudicrousItems.skull_sword),
|
||||
new AspectList().add(ULTRA_DEATH, 1).add(Aspect.FIRE, 2).add(Aspect.CRYSTAL, 16).add(Aspect.DEATH, 4));
|
||||
|
||||
WAND_ROD_NEUTRONIUM = new WandRod("infinity", 9999999, new ItemStack(LudicrousBlocks.resource_block, 1, 0), 9999, new CheatyWandUpdate(), new ResourceLocation("avaritia", "textures/models/wand_rod_neutronium.png"));
|
||||
WAND_ROD_NEUTRONIUM = new WandRod(
|
||||
"infinity",
|
||||
9999999,
|
||||
new ItemStack(LudicrousBlocks.resource_block, 1, 0),
|
||||
9999,
|
||||
new CheatyWandUpdate(),
|
||||
new ResourceLocation("avaritia", "textures/models/wand_rod_neutronium.png"));
|
||||
WAND_ROD_NEUTRONIUM.setGlowing(true);
|
||||
WAND_CAP_CRYSTAL = new WandCap("matrix", 0.0F, new ItemStack(Blocks.command_block), 1000);
|
||||
WAND_CAP_CRYSTAL.setTexture(new ResourceLocation("avaritia", "textures/models/wand_cap_crystal.png"));
|
||||
|
||||
ItemStack wand = new ItemStack(ConfigItems.itemWandCasting, 1, 9000);
|
||||
((ItemWandCasting)ConfigItems.itemWandCasting).setRod(wand, WAND_ROD_NEUTRONIUM);
|
||||
((ItemWandCasting)ConfigItems.itemWandCasting).setCap(wand, WAND_CAP_CRYSTAL);
|
||||
((ItemWandCasting) ConfigItems.itemWandCasting).setRod(wand, WAND_ROD_NEUTRONIUM);
|
||||
((ItemWandCasting) ConfigItems.itemWandCasting).setCap(wand, WAND_CAP_CRYSTAL);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addRecipe(wand,
|
||||
ExtremeCraftingManager.getInstance().addRecipe(
|
||||
wand,
|
||||
" C ",
|
||||
" CIC ",
|
||||
" NIIC",
|
||||
@@ -77,27 +124,74 @@ public class Lucrum {
|
||||
"CIIN ",
|
||||
" CIC ",
|
||||
" C ",
|
||||
'I', new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'C', new ItemStack(LudicrousItems.resource, 1, 1),
|
||||
'N', new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
'X', new ItemStack(LudicrousBlocks.resource_block, 1, 1));
|
||||
'I',
|
||||
new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'C',
|
||||
new ItemStack(LudicrousItems.resource, 1, 1),
|
||||
'N',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
'X',
|
||||
new ItemStack(LudicrousBlocks.resource_block, 1, 1));
|
||||
|
||||
//ResearchCategories.registerCategory("ASCENSION", new ResourceLocation("avaritia", "textures/misc/ascension.png"), new ResourceLocation("thaumcraft", "textures/gui/gui_researchbackeldritch.png"));
|
||||
// ResearchCategories.registerCategory("ASCENSION", new ResourceLocation("avaritia",
|
||||
// "textures/misc/ascension.png"), new ResourceLocation("thaumcraft",
|
||||
// "textures/gui/gui_researchbackeldritch.png"));
|
||||
|
||||
Item eldritch = Compat.getItem("Thaumcraft", "ItemEldritchObject");
|
||||
Item resource = Compat.getItem("Thaumcraft", "ItemResource");//9
|
||||
Item resource = Compat.getItem("Thaumcraft", "ItemResource");// 9
|
||||
|
||||
InfusionRecipe pearl_recipe = ThaumcraftApi.addInfusionCraftingRecipe("BIG_PEARL", new ItemStack(LudicrousItems.bigPearl), 12, (new AspectList()).add(Aspect.ELDRITCH, 64).add(Aspect.MAGIC, 64).add(Aspect.WATER, 64).add(Aspect.FIRE, 64).add(Aspect.EARTH, 64).add(Aspect.AIR, 64).add(Aspect.ORDER, 64).add(Aspect.ENTROPY, 64).add(ULTRA_DEATH, 32), new ItemStack(eldritch, 1, 3), new ItemStack[]{new ItemStack(eldritch, 1, 3), new ItemStack(eldritch, 1, 3), new ItemStack(eldritch, 1, 3), new ItemStack(eldritch, 1, 3), new ItemStack(eldritch, 1, 3), new ItemStack(eldritch, 1, 3), new ItemStack(eldritch, 1, 3)});
|
||||
(new LudicrousResearchItem("BIG_PEARL", "ELDRITCH", (new AspectList()).add(ULTRA_DEATH, 8).add(Aspect.MAGIC, 16), -1, 8, 5, new ItemStack(LudicrousItems.bigPearl))).setPages(new ResearchPage[]{new ResearchPage("avaritia.research_page.BIG_PEARL.1"), new ResearchPage(pearl_recipe)}).setParents(new String[]{"PRIMPEARL"}).setConcealed().setSecondary().registerResearchItem();
|
||||
InfusionRecipe pearl_recipe = ThaumcraftApi.addInfusionCraftingRecipe(
|
||||
"BIG_PEARL",
|
||||
new ItemStack(LudicrousItems.bigPearl),
|
||||
12,
|
||||
(new AspectList()).add(Aspect.ELDRITCH, 64).add(Aspect.MAGIC, 64).add(Aspect.WATER, 64)
|
||||
.add(Aspect.FIRE, 64).add(Aspect.EARTH, 64).add(Aspect.AIR, 64).add(Aspect.ORDER, 64)
|
||||
.add(Aspect.ENTROPY, 64).add(ULTRA_DEATH, 32),
|
||||
new ItemStack(eldritch, 1, 3),
|
||||
new ItemStack[] { new ItemStack(eldritch, 1, 3), new ItemStack(eldritch, 1, 3),
|
||||
new ItemStack(eldritch, 1, 3), new ItemStack(eldritch, 1, 3), new ItemStack(eldritch, 1, 3),
|
||||
new ItemStack(eldritch, 1, 3), new ItemStack(eldritch, 1, 3) });
|
||||
(new LudicrousResearchItem(
|
||||
"BIG_PEARL",
|
||||
"ELDRITCH",
|
||||
(new AspectList()).add(ULTRA_DEATH, 8).add(Aspect.MAGIC, 16),
|
||||
-1,
|
||||
8,
|
||||
5,
|
||||
new ItemStack(LudicrousItems.bigPearl)))
|
||||
.setPages(
|
||||
new ResearchPage[] { new ResearchPage("avaritia.research_page.BIG_PEARL.1"),
|
||||
new ResearchPage(pearl_recipe) })
|
||||
.setParents(new String[] { "PRIMPEARL" }).setConcealed().setSecondary().registerResearchItem();
|
||||
|
||||
InfusionRecipe akashic_recipe = ThaumcraftApi.addInfusionCraftingRecipe("AKASHIC", new ItemStack(LudicrousItems.akashic_record), 12, (new AspectList()).add(Aspect.MIND, 64).add(Aspect.MAGIC, 64).add(ULTRA_DEATH, 32), new ItemStack(resource, 1, 9), new ItemStack[]{new ItemStack(LudicrousItems.resource, 1, 6), new ItemStack(LudicrousItems.resource, 1, 6), new ItemStack(LudicrousItems.resource, 1, 6), new ItemStack(LudicrousItems.resource, 1, 6)});
|
||||
(new LudicrousResearchItem("AKASHIC", "ELDRITCH", (new AspectList()).add(ULTRA_DEATH, 8).add(Aspect.MIND, 16), -3, 8, 5, new ItemStack(LudicrousItems.akashic_record))).setPages(new ResearchPage[]{new ResearchPage("avaritia.research_page.AKASHIC.1"), new ResearchPage(akashic_recipe)}).setParents(new String[]{"BIG_PEARL"}).setConcealed().setSecondary().registerResearchItem();
|
||||
InfusionRecipe akashic_recipe = ThaumcraftApi.addInfusionCraftingRecipe(
|
||||
"AKASHIC",
|
||||
new ItemStack(LudicrousItems.akashic_record),
|
||||
12,
|
||||
(new AspectList()).add(Aspect.MIND, 64).add(Aspect.MAGIC, 64).add(ULTRA_DEATH, 32),
|
||||
new ItemStack(resource, 1, 9),
|
||||
new ItemStack[] { new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
new ItemStack(LudicrousItems.resource, 1, 6), new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
new ItemStack(LudicrousItems.resource, 1, 6) });
|
||||
(new LudicrousResearchItem(
|
||||
"AKASHIC",
|
||||
"ELDRITCH",
|
||||
(new AspectList()).add(ULTRA_DEATH, 8).add(Aspect.MIND, 16),
|
||||
-3,
|
||||
8,
|
||||
5,
|
||||
new ItemStack(LudicrousItems.akashic_record)))
|
||||
.setPages(
|
||||
new ResearchPage[] { new ResearchPage("avaritia.research_page.AKASHIC.1"),
|
||||
new ResearchPage(akashic_recipe) })
|
||||
.setParents(new String[] { "BIG_PEARL" }).setConcealed().setSecondary().registerResearchItem();
|
||||
|
||||
if(Loader.isModLoaded("ThaumicTinkerer")) {
|
||||
if (Loader.isModLoaded("ThaumicTinkerer")) {
|
||||
try {
|
||||
boolean kami = Class.forName("thaumic.tinkerer.common.core.handler.ConfigHandler").getField("enableKami").getBoolean(null);
|
||||
boolean kami = Class.forName("thaumic.tinkerer.common.core.handler.ConfigHandler")
|
||||
.getField("enableKami").getBoolean(null);
|
||||
if (kami) {
|
||||
//because ichorium get unificated from gt
|
||||
// because ichorium get unificated from gt
|
||||
Item kamiResource = Compat.getItem("gregtech", ":gt.metaitem.01");
|
||||
Grinder.catalyst.getInput().add(new ItemStack(kamiResource, 1, 11978));
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package fox.spiteful.avaritia.compat.thaumcraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -14,7 +15,8 @@ public class LudicrousResearchItem extends ResearchItem {
|
||||
super(par1, x);
|
||||
}
|
||||
|
||||
public LudicrousResearchItem(String par1, String x, AspectList tags, int y, int z, int par5, ResourceLocation icon) {
|
||||
public LudicrousResearchItem(String par1, String x, AspectList tags, int y, int z, int par5,
|
||||
ResourceLocation icon) {
|
||||
super(par1, x, tags, y, z, par5, icon);
|
||||
}
|
||||
|
||||
@@ -31,4 +33,4 @@ public class LudicrousResearchItem extends ResearchItem {
|
||||
public String getText() {
|
||||
return "[AV] " + StatCollector.translateToLocal("avaritia.research_text." + key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,185 +8,195 @@ import java.io.InputStream;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import codechicken.lib.math.MathHelper;
|
||||
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import codechicken.lib.math.MathHelper;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
|
||||
public class InfinityIcons extends TConTextureResourcePackBase {
|
||||
|
||||
protected BufferedImage infinityImage;
|
||||
|
||||
public InfinityIcons() {
|
||||
super(Tonkers.infinityMetalName);
|
||||
}
|
||||
protected BufferedImage infinityImage;
|
||||
|
||||
protected void loadInfinityImage() {
|
||||
if (infinityImage == null) {
|
||||
ResourceLocation res = new ResourceLocation("avaritia", "textures/items/ticoninfinity.png");
|
||||
try {
|
||||
InputStream stream = Minecraft.getMinecraft().getResourceManager().getResource(res).getInputStream();
|
||||
infinityImage = ImageIO.read(stream);
|
||||
} catch (Exception err) {
|
||||
Lumberjack.log(Level.WARN, "Unable to load overlay image for Infinity tool parts");
|
||||
}
|
||||
}
|
||||
}
|
||||
protected InputStream loadInfinityAnimation() {
|
||||
InputStream stream = null;
|
||||
ResourceLocation res = new ResourceLocation("avaritia", "textures/items/ticoninfinitymeta.png.mcmeta");
|
||||
try {
|
||||
stream = Minecraft.getMinecraft().getResourceManager().getResource(res).getInputStream();
|
||||
} catch (Exception err) {
|
||||
public InfinityIcons() {
|
||||
super(Tonkers.infinityMetalName);
|
||||
}
|
||||
|
||||
protected void loadInfinityImage() {
|
||||
if (infinityImage == null) {
|
||||
ResourceLocation res = new ResourceLocation("avaritia", "textures/items/ticoninfinity.png");
|
||||
try {
|
||||
InputStream stream = Minecraft.getMinecraft().getResourceManager().getResource(res).getInputStream();
|
||||
infinityImage = ImageIO.read(stream);
|
||||
} catch (Exception err) {
|
||||
Lumberjack.log(Level.WARN, "Unable to load overlay image for Infinity tool parts");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected InputStream loadInfinityAnimation() {
|
||||
InputStream stream = null;
|
||||
ResourceLocation res = new ResourceLocation("avaritia", "textures/items/ticoninfinitymeta.png.mcmeta");
|
||||
try {
|
||||
stream = Minecraft.getMinecraft().getResourceManager().getResource(res).getInputStream();
|
||||
} catch (Exception err) {
|
||||
Lumberjack.log(Level.WARN, "Unable to load animation data for Infinity tool parts");
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedImage modifyImage(BufferedImage image) {
|
||||
int w = image.getWidth();
|
||||
int h = image.getHeight();
|
||||
|
||||
if (image.getType() != BufferedImage.TYPE_INT_ARGB) {
|
||||
BufferedImage temp = new BufferedImage(w,h, BufferedImage.TYPE_INT_ARGB);
|
||||
int[] data = new int[w*h];
|
||||
image.getRGB(0, 0, w, h, data, 0, w);
|
||||
temp.setRGB(0, 0, w, h, data, 0, w);
|
||||
image = temp;
|
||||
}
|
||||
|
||||
int c, a, i, inf;
|
||||
int r, g, b;
|
||||
int fr,fg,fb;
|
||||
double l, frac;
|
||||
|
||||
int left = w-1;
|
||||
int right = 0;
|
||||
int top = h-1;
|
||||
int bottom = 0;
|
||||
boolean anyOpaque = false;
|
||||
int opaquecount = 0;
|
||||
|
||||
// get the extents of the opaque part of the image
|
||||
for (int y = 0; y<h; y++) {
|
||||
for (int x = 0; x<w; x++) {
|
||||
c = image.getRGB(x, y);
|
||||
a = rgb.getAlpha(c);
|
||||
|
||||
if (a != 0) {
|
||||
left = Math.min(x, left);
|
||||
right = Math.max(x, right);
|
||||
top = Math.min(y, top);
|
||||
bottom = Math.max(y, bottom);
|
||||
anyOpaque = true;
|
||||
opaquecount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int opaqueWidth = (right-left)+1;
|
||||
int opaqueHeight = (bottom-top)+1;
|
||||
int opaqueSquare = Math.max(w/2, Math.max(opaqueHeight, opaqueWidth));
|
||||
if (opaqueWidth < opaqueSquare) {
|
||||
int diff = opaqueSquare - opaqueWidth;
|
||||
left -= diff/2;
|
||||
} else if (opaqueHeight < opaqueSquare) {
|
||||
int diff = opaqueSquare - opaqueHeight;
|
||||
top -= diff/2;
|
||||
}
|
||||
|
||||
// scale the infinity image
|
||||
BufferedImage infinity = new BufferedImage(w,h, BufferedImage.TYPE_INT_ARGB);
|
||||
this.loadInfinityImage();
|
||||
if (anyOpaque && infinityImage != null) {
|
||||
int iw = infinityImage.getWidth();
|
||||
int ih = infinityImage.getHeight();
|
||||
int sx1 = 0;
|
||||
int sx2 = iw;
|
||||
int sy1 = 0;
|
||||
int sy2 = ih;
|
||||
if (opaquecount > w*h*0.3) {
|
||||
sx1 = MathHelper.floor_double(iw*0.25);
|
||||
sx2 = MathHelper.floor_double(iw*0.75);
|
||||
sy1 = MathHelper.floor_double(ih*0.25);
|
||||
sy2 = MathHelper.floor_double(ih*0.75);
|
||||
}
|
||||
|
||||
Graphics2D graphics = infinity.createGraphics();
|
||||
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
||||
graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
|
||||
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
//graphics.drawImage(infinityImage, left, top, opaqueSquare, opaqueSquare, null);
|
||||
|
||||
graphics.drawImage(infinityImage, left, top, left+opaqueSquare, top+opaqueSquare, sx1,sy1,sx2,sy2, null);
|
||||
}
|
||||
|
||||
//ok, now do stuff with it
|
||||
|
||||
/*int[] data = new int[w*h];
|
||||
infinity.getRGB(0, 0, w, h, data, 0, w);
|
||||
image.setRGB(0, 0, w, h, data, 0, w);*/
|
||||
|
||||
int frames = 9;
|
||||
|
||||
BufferedImage framesimage = new BufferedImage(w,h*frames, BufferedImage.TYPE_INT_ARGB);
|
||||
|
||||
double brighten = 1.3;
|
||||
for (int y = 0; y<h; y++) {
|
||||
for (int x = 0; x<w; x++) {
|
||||
c = image.getRGB(x, y);
|
||||
l = Math.min(1.0, Math.max(0.4,(this.brightness(c)/255.0)*1.4 - 0.4));
|
||||
a = rgb.getAlpha(c);
|
||||
|
||||
if (a != 0) {
|
||||
inf = infinity.getRGB(x, y);
|
||||
r = Math.min(255, MathHelper.floor_double(rgb.getRed(inf) * l * brighten));
|
||||
g = Math.min(255, MathHelper.floor_double(rgb.getGreen(inf) * l * brighten));
|
||||
b = Math.min(255, MathHelper.floor_double(rgb.getBlue(inf) * l * brighten));
|
||||
for (i=0; i<frames; i++) {
|
||||
frac = 0.125 * i;
|
||||
fr = MathHelper.floor_double((1-frac)*r + frac*255);
|
||||
fg = MathHelper.floor_double((1-frac)*g + frac*255);
|
||||
fb = MathHelper.floor_double((1-frac)*b + frac*255);
|
||||
framesimage.setRGB(x, y + h*i, colour(fr,fg,fb,a));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return framesimage;
|
||||
}
|
||||
|
||||
@Override
|
||||
return stream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedImage modifyImage(BufferedImage image) {
|
||||
int w = image.getWidth();
|
||||
int h = image.getHeight();
|
||||
|
||||
if (image.getType() != BufferedImage.TYPE_INT_ARGB) {
|
||||
BufferedImage temp = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
|
||||
int[] data = new int[w * h];
|
||||
image.getRGB(0, 0, w, h, data, 0, w);
|
||||
temp.setRGB(0, 0, w, h, data, 0, w);
|
||||
image = temp;
|
||||
}
|
||||
|
||||
int c, a, i, inf;
|
||||
int r, g, b;
|
||||
int fr, fg, fb;
|
||||
double l, frac;
|
||||
|
||||
int left = w - 1;
|
||||
int right = 0;
|
||||
int top = h - 1;
|
||||
int bottom = 0;
|
||||
boolean anyOpaque = false;
|
||||
int opaquecount = 0;
|
||||
|
||||
// get the extents of the opaque part of the image
|
||||
for (int y = 0; y < h; y++) {
|
||||
for (int x = 0; x < w; x++) {
|
||||
c = image.getRGB(x, y);
|
||||
a = rgb.getAlpha(c);
|
||||
|
||||
if (a != 0) {
|
||||
left = Math.min(x, left);
|
||||
right = Math.max(x, right);
|
||||
top = Math.min(y, top);
|
||||
bottom = Math.max(y, bottom);
|
||||
anyOpaque = true;
|
||||
opaquecount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int opaqueWidth = (right - left) + 1;
|
||||
int opaqueHeight = (bottom - top) + 1;
|
||||
int opaqueSquare = Math.max(w / 2, Math.max(opaqueHeight, opaqueWidth));
|
||||
if (opaqueWidth < opaqueSquare) {
|
||||
int diff = opaqueSquare - opaqueWidth;
|
||||
left -= diff / 2;
|
||||
} else if (opaqueHeight < opaqueSquare) {
|
||||
int diff = opaqueSquare - opaqueHeight;
|
||||
top -= diff / 2;
|
||||
}
|
||||
|
||||
// scale the infinity image
|
||||
BufferedImage infinity = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
|
||||
this.loadInfinityImage();
|
||||
if (anyOpaque && infinityImage != null) {
|
||||
int iw = infinityImage.getWidth();
|
||||
int ih = infinityImage.getHeight();
|
||||
int sx1 = 0;
|
||||
int sx2 = iw;
|
||||
int sy1 = 0;
|
||||
int sy2 = ih;
|
||||
if (opaquecount > w * h * 0.3) {
|
||||
sx1 = MathHelper.floor_double(iw * 0.25);
|
||||
sx2 = MathHelper.floor_double(iw * 0.75);
|
||||
sy1 = MathHelper.floor_double(ih * 0.25);
|
||||
sy2 = MathHelper.floor_double(ih * 0.75);
|
||||
}
|
||||
|
||||
Graphics2D graphics = infinity.createGraphics();
|
||||
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
||||
graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
|
||||
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
// graphics.drawImage(infinityImage, left, top, opaqueSquare, opaqueSquare, null);
|
||||
|
||||
graphics.drawImage(
|
||||
infinityImage,
|
||||
left,
|
||||
top,
|
||||
left + opaqueSquare,
|
||||
top + opaqueSquare,
|
||||
sx1,
|
||||
sy1,
|
||||
sx2,
|
||||
sy2,
|
||||
null);
|
||||
}
|
||||
|
||||
// ok, now do stuff with it
|
||||
|
||||
/*
|
||||
* int[] data = new int[w*h]; infinity.getRGB(0, 0, w, h, data, 0, w); image.setRGB(0, 0, w, h, data, 0, w);
|
||||
*/
|
||||
|
||||
int frames = 9;
|
||||
|
||||
BufferedImage framesimage = new BufferedImage(w, h * frames, BufferedImage.TYPE_INT_ARGB);
|
||||
|
||||
double brighten = 1.3;
|
||||
for (int y = 0; y < h; y++) {
|
||||
for (int x = 0; x < w; x++) {
|
||||
c = image.getRGB(x, y);
|
||||
l = Math.min(1.0, Math.max(0.4, (this.brightness(c) / 255.0) * 1.4 - 0.4));
|
||||
a = rgb.getAlpha(c);
|
||||
|
||||
if (a != 0) {
|
||||
inf = infinity.getRGB(x, y);
|
||||
r = Math.min(255, MathHelper.floor_double(rgb.getRed(inf) * l * brighten));
|
||||
g = Math.min(255, MathHelper.floor_double(rgb.getGreen(inf) * l * brighten));
|
||||
b = Math.min(255, MathHelper.floor_double(rgb.getBlue(inf) * l * brighten));
|
||||
for (i = 0; i < frames; i++) {
|
||||
frac = 0.125 * i;
|
||||
fr = MathHelper.floor_double((1 - frac) * r + frac * 255);
|
||||
fg = MathHelper.floor_double((1 - frac) * g + frac * 255);
|
||||
fb = MathHelper.floor_double((1 - frac) * b + frac * 255);
|
||||
framesimage.setRGB(x, y + h * i, colour(fr, fg, fb, a));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return framesimage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResourceManagerReload(IResourceManager manager) {
|
||||
super.onResourceManagerReload(manager);
|
||||
this.infinityImage = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean resourceExists(ResourceLocation resource) {
|
||||
String resourcePath = resource.getResourcePath();
|
||||
|
||||
if (resourcePath.endsWith(".mcmeta")) {
|
||||
String testpath = resourcePath.substring(0, resourcePath.length()-7);
|
||||
if (resourceExists(new ResourceLocation(resource.getResourceDomain(), testpath))) {
|
||||
return true;
|
||||
}
|
||||
String testpath = resourcePath.substring(0, resourcePath.length() - 7);
|
||||
if (resourceExists(new ResourceLocation(resource.getResourceDomain(), testpath))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.resourceExists(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream(ResourceLocation resource) throws IOException {
|
||||
if (resource.getResourcePath().endsWith(".mcmeta")) {
|
||||
return this.loadInfinityAnimation();
|
||||
}
|
||||
return super.getInputStream(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream(ResourceLocation resource) throws IOException {
|
||||
if (resource.getResourcePath().endsWith(".mcmeta")) {
|
||||
return this.loadInfinityAnimation();
|
||||
}
|
||||
return super.getInputStream(resource);
|
||||
}
|
||||
}
|
||||
@@ -7,69 +7,69 @@ import codechicken.lib.math.MathHelper;
|
||||
|
||||
public class NeutroniumIcons extends TConTextureResourcePackBase {
|
||||
|
||||
private double[] noise;
|
||||
|
||||
public NeutroniumIcons() {
|
||||
super(Tonkers.neutroniumName);
|
||||
|
||||
int len = 16*16;
|
||||
Random randy = new Random(12345);
|
||||
noise = new double[len];
|
||||
for (int i=0; i<len; i++) {
|
||||
noise[i] = randy.nextDouble();
|
||||
}
|
||||
}
|
||||
private double[] noise;
|
||||
|
||||
@Override
|
||||
public BufferedImage modifyImage(BufferedImage image) {
|
||||
int w = image.getWidth();
|
||||
int h = image.getHeight();
|
||||
|
||||
if (image.getType() != BufferedImage.TYPE_INT_ARGB) {
|
||||
BufferedImage temp = new BufferedImage(w,h, BufferedImage.TYPE_INT_ARGB);
|
||||
int[] data = new int[w*h];
|
||||
image.getRGB(0, 0, w, h, data, 0, w);
|
||||
temp.setRGB(0, 0, w, h, data, 0, w);
|
||||
image = temp;
|
||||
}
|
||||
|
||||
int c, l, a;
|
||||
int r, g, b;
|
||||
double e, n;
|
||||
for (int y = 0; y<h; y++) {
|
||||
for (int x = 0; x<w; x++) {
|
||||
c = image.getRGB(x, y);
|
||||
l = MathHelper.floor_double(Math.min(255, (255-this.brightness(c))*1.05));
|
||||
a = rgb.getAlpha(c);
|
||||
|
||||
if (isEdge(image, x, y, w, h, a)) {
|
||||
n = noise[(y*w+x) % noise.length];
|
||||
e = Math.min(1.0, (l / 255.0) * 0.5 + 0.5 + n*0.2);
|
||||
r = MathHelper.floor_double(e * 188);
|
||||
g = MathHelper.floor_double(e * 192);
|
||||
b = MathHelper.floor_double(e * 219);
|
||||
image.setRGB(x, y, colour(r,g,b,a));
|
||||
} else {
|
||||
image.setRGB(x, y, colour(l,l,l,a));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
private boolean isEdge(BufferedImage image, int x, int y, int w, int h, int a) {
|
||||
if (a != 0) {
|
||||
if (x == 0 || x == w-1 || y == 0 || y == h-1) { return true; }
|
||||
|
||||
if (rgb.getAlpha(image.getRGB(x-1, y)) != 255
|
||||
|| rgb.getAlpha(image.getRGB(x+1, y)) != 255
|
||||
|| rgb.getAlpha(image.getRGB(x, y-1)) != 255
|
||||
|| rgb.getAlpha(image.getRGB(x, y+1)) != 255
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public NeutroniumIcons() {
|
||||
super(Tonkers.neutroniumName);
|
||||
|
||||
int len = 16 * 16;
|
||||
Random randy = new Random(12345);
|
||||
noise = new double[len];
|
||||
for (int i = 0; i < len; i++) {
|
||||
noise[i] = randy.nextDouble();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedImage modifyImage(BufferedImage image) {
|
||||
int w = image.getWidth();
|
||||
int h = image.getHeight();
|
||||
|
||||
if (image.getType() != BufferedImage.TYPE_INT_ARGB) {
|
||||
BufferedImage temp = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
|
||||
int[] data = new int[w * h];
|
||||
image.getRGB(0, 0, w, h, data, 0, w);
|
||||
temp.setRGB(0, 0, w, h, data, 0, w);
|
||||
image = temp;
|
||||
}
|
||||
|
||||
int c, l, a;
|
||||
int r, g, b;
|
||||
double e, n;
|
||||
for (int y = 0; y < h; y++) {
|
||||
for (int x = 0; x < w; x++) {
|
||||
c = image.getRGB(x, y);
|
||||
l = MathHelper.floor_double(Math.min(255, (255 - this.brightness(c)) * 1.05));
|
||||
a = rgb.getAlpha(c);
|
||||
|
||||
if (isEdge(image, x, y, w, h, a)) {
|
||||
n = noise[(y * w + x) % noise.length];
|
||||
e = Math.min(1.0, (l / 255.0) * 0.5 + 0.5 + n * 0.2);
|
||||
r = MathHelper.floor_double(e * 188);
|
||||
g = MathHelper.floor_double(e * 192);
|
||||
b = MathHelper.floor_double(e * 219);
|
||||
image.setRGB(x, y, colour(r, g, b, a));
|
||||
} else {
|
||||
image.setRGB(x, y, colour(l, l, l, a));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
private boolean isEdge(BufferedImage image, int x, int y, int w, int h, int a) {
|
||||
if (a != 0) {
|
||||
if (x == 0 || x == w - 1 || y == 0 || y == h - 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (rgb.getAlpha(image.getRGB(x - 1, y)) != 255 || rgb.getAlpha(image.getRGB(x + 1, y)) != 255
|
||||
|| rgb.getAlpha(image.getRGB(x, y - 1)) != 255
|
||||
|| rgb.getAlpha(image.getRGB(x, y + 1)) != 255) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3,17 +3,6 @@
|
||||
|
||||
package fox.spiteful.avaritia.compat.ticon;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.*;
|
||||
import net.minecraft.client.resources.data.IMetadataSection;
|
||||
import net.minecraft.client.resources.data.IMetadataSerializer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DirectColorModel;
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -25,49 +14,65 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.*;
|
||||
import net.minecraft.client.resources.data.IMetadataSection;
|
||||
import net.minecraft.client.resources.data.IMetadataSerializer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
|
||||
/**
|
||||
* Original class by RWTema for Extra Utilities
|
||||
*/
|
||||
public abstract class TConTextureResourcePackBase implements IResourcePack, IResourceManagerReloadListener {
|
||||
|
||||
public static List<IResourcePack> packs;
|
||||
protected static DirectColorModel rgb = new DirectColorModel(32,
|
||||
0x00ff0000, // Red
|
||||
0x0000ff00, // Green
|
||||
0x000000ff, // Blue
|
||||
0xff000000 // Alpha
|
||||
protected static DirectColorModel rgb = new DirectColorModel(
|
||||
32,
|
||||
0x00ff0000, // Red
|
||||
0x0000ff00, // Green
|
||||
0x000000ff, // Blue
|
||||
0xff000000 // Alpha
|
||||
);
|
||||
protected final String name;
|
||||
public HashMap<ResourceLocation, byte[]> cachedImages = new HashMap<ResourceLocation, byte[]>();
|
||||
protected IResourcePack delegate;
|
||||
protected List<IResourcePack> resourcePackz = null;
|
||||
|
||||
|
||||
public TConTextureResourcePackBase(String name) {
|
||||
this.name = name.toLowerCase();
|
||||
this.delegate = FMLClientHandler.instance().getResourcePackFor("TConstruct");
|
||||
}
|
||||
|
||||
|
||||
public int brightness(int col) {
|
||||
return brightness(rgb.getRed(col), rgb.getGreen(col), rgb.getBlue(col));
|
||||
}
|
||||
|
||||
|
||||
public int brightness(int r, int g, int b) {
|
||||
return (int) (r * 0.2126F + g * 0.7152F + b * 0.0722F);
|
||||
}
|
||||
|
||||
|
||||
public void register() {
|
||||
List<IResourcePack> packs = getiResourcePacks();
|
||||
packs.add(this);
|
||||
((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(this);
|
||||
Lumberjack.info("Registered TCon Resource Pack (" + name + ") - " + this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
|
||||
public List<IResourcePack> getiResourcePacks() {
|
||||
List<IResourcePack> packs1 = packs;
|
||||
if (packs1 == null)
|
||||
packs1 = ObfuscationReflectionHelper.getPrivateValue(FMLClientHandler.class, FMLClientHandler.instance(), "resourcePackList");
|
||||
if (packs1 == null) packs1 = ObfuscationReflectionHelper
|
||||
.getPrivateValue(FMLClientHandler.class, FMLClientHandler.instance(), "resourcePackList");
|
||||
return packs1;
|
||||
}
|
||||
|
||||
|
||||
public InputStream getStream(ResourceLocation location) {
|
||||
InputStream stream = null;
|
||||
for (IResourcePack iResourcePack : getPacks()) {
|
||||
@@ -75,19 +80,20 @@ public abstract class TConTextureResourcePackBase implements IResourcePack, IRes
|
||||
try {
|
||||
stream = iResourcePack.getInputStream(location);
|
||||
} catch (IOException ignore) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<IResourcePack> getPacks() {
|
||||
public List<IResourcePack> getPacks() {
|
||||
if (resourcePackz == null) {
|
||||
resourcePackz = new ArrayList<IResourcePack>();
|
||||
resourcePackz.add(delegate);
|
||||
List<ResourcePackRepository.Entry> t = Minecraft.getMinecraft().getResourcePackRepository().getRepositoryEntries();
|
||||
List<ResourcePackRepository.Entry> t = Minecraft.getMinecraft().getResourcePackRepository()
|
||||
.getRepositoryEntries();
|
||||
for (ResourcePackRepository.Entry entry : t) {
|
||||
IResourcePack resourcePack = entry.getResourcePack();
|
||||
if (resourcePack.getResourceDomains().contains("tinker")) {
|
||||
@@ -95,37 +101,36 @@ public abstract class TConTextureResourcePackBase implements IResourcePack, IRes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return resourcePackz;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream(ResourceLocation p_110590_1_) throws IOException {
|
||||
byte[] bytes = cachedImages.get(p_110590_1_);
|
||||
if (bytes == null) {
|
||||
ResourceLocation location = new ResourceLocation("tinker", p_110590_1_.getResourcePath().replace(name, ""));
|
||||
InputStream inputStream = getStream(location);
|
||||
|
||||
|
||||
if (inputStream == null) {
|
||||
location = new ResourceLocation("tinker", p_110590_1_.getResourcePath().replace(name, "iron"));
|
||||
inputStream = getStream(location);
|
||||
}
|
||||
|
||||
|
||||
if (inputStream == null) {
|
||||
location = new ResourceLocation("tinker", p_110590_1_.getResourcePath().replace(name, "stone"));
|
||||
inputStream = getStream(location);
|
||||
}
|
||||
|
||||
if (inputStream == null)
|
||||
return delegate.getInputStream(p_110590_1_);
|
||||
|
||||
|
||||
if (inputStream == null) return delegate.getInputStream(p_110590_1_);
|
||||
|
||||
BufferedImage bufferedimage;
|
||||
try {
|
||||
bufferedimage = ImageIO.read(inputStream);
|
||||
} catch (IOException err) {
|
||||
throw Throwables.propagate(err);
|
||||
}
|
||||
|
||||
|
||||
BufferedImage image;
|
||||
try {
|
||||
image = modifyImage(bufferedimage);
|
||||
@@ -133,73 +138,69 @@ public abstract class TConTextureResourcePackBase implements IResourcePack, IRes
|
||||
t.printStackTrace();
|
||||
return delegate.getInputStream(location);
|
||||
}
|
||||
|
||||
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
ImageIO.write(image, "PNG", stream);
|
||||
bytes = stream.toByteArray();
|
||||
cachedImages.put(location, bytes);
|
||||
}
|
||||
|
||||
|
||||
return new ByteArrayInputStream(bytes);
|
||||
}
|
||||
|
||||
|
||||
public abstract BufferedImage modifyImage(BufferedImage image);
|
||||
|
||||
|
||||
@Override
|
||||
public boolean resourceExists(ResourceLocation p_110589_1_) {
|
||||
if (!"tinker".equals(p_110589_1_.getResourceDomain()))
|
||||
return false;
|
||||
|
||||
|
||||
if (!"tinker".equals(p_110589_1_.getResourceDomain())) return false;
|
||||
|
||||
String resourcePath = p_110589_1_.getResourcePath();
|
||||
if (!(resourcePath.startsWith("textures/items/") && resourcePath.endsWith(".png")))
|
||||
return false;
|
||||
|
||||
if (delegate.resourceExists(p_110589_1_))
|
||||
return false;
|
||||
|
||||
if (!resourcePath.contains(name))
|
||||
return false;
|
||||
|
||||
if (!(resourcePath.startsWith("textures/items/") && resourcePath.endsWith(".png"))) return false;
|
||||
|
||||
if (delegate.resourceExists(p_110589_1_)) return false;
|
||||
|
||||
if (!resourcePath.contains(name)) return false;
|
||||
|
||||
return delegate.resourceExists(new ResourceLocation("tinker", resourcePath.replace(name, "stone")))
|
||||
|| delegate.resourceExists(new ResourceLocation("tinker", resourcePath.replace(name, "iron")))
|
||||
|| delegate.resourceExists(new ResourceLocation("tinker", resourcePath.replace(name, "")));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
@Override
|
||||
public Set getResourceDomains() {
|
||||
return delegate.getResourceDomains();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IMetadataSection getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BufferedImage getPackImage() throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getPackName() {
|
||||
return "Avaritia_Delegate_Pack";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResourceManagerReload(IResourceManager p_110549_1_) {
|
||||
cachedImages.clear();
|
||||
resourcePackz = null;
|
||||
}
|
||||
|
||||
|
||||
private int[] colourarray = new int[4];
|
||||
|
||||
protected int colour(int r, int g, int b, int a) {
|
||||
colourarray[0] = r;
|
||||
colourarray[1] = g;
|
||||
colourarray[2] = b;
|
||||
colourarray[3] = a;
|
||||
return rgb.getDataElement(colourarray, 0);
|
||||
colourarray[0] = r;
|
||||
colourarray[1] = g;
|
||||
colourarray[2] = b;
|
||||
colourarray[3] = a;
|
||||
return rgb.getDataElement(colourarray, 0);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,10 @@
|
||||
package fox.spiteful.avaritia.compat.ticon;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.ModifyBuilder;
|
||||
import tconstruct.library.crafting.PatternBuilder;
|
||||
@@ -16,292 +12,393 @@ import tconstruct.library.tools.ToolMaterial;
|
||||
import tconstruct.modifiers.tools.ModExtraModifier;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
|
||||
public class Tonkers {
|
||||
|
||||
public static ToolMaterial neutronium;
|
||||
public static ToolMaterial infinityMetal;
|
||||
public static final int neutroniumId = 500;
|
||||
public static final int infinityMetalId = 501;
|
||||
public static final String neutroniumName = "avaritia_neutronium";
|
||||
public static final String infinityMetalName = "avaritia_infinitymetal";
|
||||
public static ToolMaterial neutronium;
|
||||
public static ToolMaterial infinityMetal;
|
||||
public static final int neutroniumId = 500;
|
||||
public static final int infinityMetalId = 501;
|
||||
public static final String neutroniumName = "avaritia_neutronium";
|
||||
public static final String infinityMetalName = "avaritia_infinitymetal";
|
||||
|
||||
public static void buildstruct() {
|
||||
|
||||
neutronium = new ToolMaterial(neutroniumName, "material."+neutroniumName, 5, 4800, 900, 8, 2.5f, 0, 0.0f, EnumChatFormatting.DARK_GRAY.toString(), 0x303030);
|
||||
infinityMetal = new ToolMaterial(infinityMetalName, "material."+infinityMetalName, 5, 10000, 6000, 50, 10.0f, 10, 0.0f, LudicrousItems.cosmic.rarityColor.toString(), 0xFFFFFF);
|
||||
public static void buildstruct() {
|
||||
|
||||
TConstructRegistry.addtoolMaterial(neutroniumId, neutronium);
|
||||
TConstructRegistry.addtoolMaterial(infinityMetalId, infinityMetal);
|
||||
|
||||
TConstructRegistry.addDefaultToolPartMaterial(neutroniumId);
|
||||
TConstructRegistry.addDefaultToolPartMaterial(infinityMetalId);
|
||||
|
||||
TConstructRegistry.addBowMaterial(neutroniumId, 109, 10.0f);
|
||||
TConstructRegistry.addBowMaterial(infinityMetalId, 10, 60.0f);
|
||||
|
||||
TConstructRegistry.addArrowMaterial(neutroniumId, 5.0f, 0.1f);
|
||||
TConstructRegistry.addArrowMaterial(infinityMetalId, 4.0f, 0.0f);
|
||||
|
||||
TConstructRegistry.addDefaultShardMaterial(neutroniumId);
|
||||
|
||||
// register neutronium ingot
|
||||
PatternBuilder pb = PatternBuilder.instance;
|
||||
pb.registerFullMaterial(new ItemStack(LudicrousItems.resource, 1, 4), 2, neutroniumName, new ItemStack(TinkerTools.toolShard, 1, neutroniumId), new ItemStack(TinkerTools.toolRod, 1, neutroniumId), neutroniumId);
|
||||
|
||||
// register patterns
|
||||
/*for (int m = 0; m < TinkerTools.patternOutputs.length; m++)
|
||||
{
|
||||
if (TinkerTools.patternOutputs[m] != null)
|
||||
TConstructRegistry.addPartMapping(TinkerTools.woodPattern, m + 1, neutroniumId, new ItemStack(TinkerTools.patternOutputs[m], 1, neutroniumId));
|
||||
}
|
||||
for (int m = 0; m < TinkerWeaponry.patternOutputs.length; m++) {
|
||||
TConstructRegistry.addPartMapping(TinkerWeaponry.woodPattern, m, neutroniumId, new ItemStack(TinkerWeaponry.patternOutputs[m], 1, neutroniumId));
|
||||
}
|
||||
TConstructRegistry.addPartMapping(TinkerTools.woodPattern, 25, neutroniumId, new ItemStack(TinkerWeaponry.arrowhead, 1, neutroniumId));
|
||||
*/
|
||||
TonkersEvents events = new TonkersEvents();
|
||||
MinecraftForge.EVENT_BUS.register(events);
|
||||
neutronium = new ToolMaterial(
|
||||
neutroniumName,
|
||||
"material." + neutroniumName,
|
||||
5,
|
||||
4800,
|
||||
900,
|
||||
8,
|
||||
2.5f,
|
||||
0,
|
||||
0.0f,
|
||||
EnumChatFormatting.DARK_GRAY.toString(),
|
||||
0x303030);
|
||||
infinityMetal = new ToolMaterial(
|
||||
infinityMetalName,
|
||||
"material." + infinityMetalName,
|
||||
5,
|
||||
10000,
|
||||
6000,
|
||||
50,
|
||||
10.0f,
|
||||
10,
|
||||
0.0f,
|
||||
LudicrousItems.cosmic.rarityColor.toString(),
|
||||
0xFFFFFF);
|
||||
|
||||
TConstructRegistry.addtoolMaterial(neutroniumId, neutronium);
|
||||
TConstructRegistry.addtoolMaterial(infinityMetalId, infinityMetal);
|
||||
|
||||
TConstructRegistry.addDefaultToolPartMaterial(neutroniumId);
|
||||
TConstructRegistry.addDefaultToolPartMaterial(infinityMetalId);
|
||||
|
||||
TConstructRegistry.addBowMaterial(neutroniumId, 109, 10.0f);
|
||||
TConstructRegistry.addBowMaterial(infinityMetalId, 10, 60.0f);
|
||||
|
||||
TConstructRegistry.addArrowMaterial(neutroniumId, 5.0f, 0.1f);
|
||||
TConstructRegistry.addArrowMaterial(infinityMetalId, 4.0f, 0.0f);
|
||||
|
||||
TConstructRegistry.addDefaultShardMaterial(neutroniumId);
|
||||
|
||||
// register neutronium ingot
|
||||
PatternBuilder pb = PatternBuilder.instance;
|
||||
pb.registerFullMaterial(
|
||||
new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
2,
|
||||
neutroniumName,
|
||||
new ItemStack(TinkerTools.toolShard, 1, neutroniumId),
|
||||
new ItemStack(TinkerTools.toolRod, 1, neutroniumId),
|
||||
neutroniumId);
|
||||
|
||||
// register patterns
|
||||
/*
|
||||
* for (int m = 0; m < TinkerTools.patternOutputs.length; m++) { if (TinkerTools.patternOutputs[m] != null)
|
||||
* TConstructRegistry.addPartMapping(TinkerTools.woodPattern, m + 1, neutroniumId, new
|
||||
* ItemStack(TinkerTools.patternOutputs[m], 1, neutroniumId)); } for (int m = 0; m <
|
||||
* TinkerWeaponry.patternOutputs.length; m++) { TConstructRegistry.addPartMapping(TinkerWeaponry.woodPattern, m,
|
||||
* neutroniumId, new ItemStack(TinkerWeaponry.patternOutputs[m], 1, neutroniumId)); }
|
||||
* TConstructRegistry.addPartMapping(TinkerTools.woodPattern, 25, neutroniumId, new
|
||||
* ItemStack(TinkerWeaponry.arrowhead, 1, neutroniumId));
|
||||
*/
|
||||
TonkersEvents events = new TonkersEvents();
|
||||
MinecraftForge.EVENT_BUS.register(events);
|
||||
FMLCommonHandler.instance().bus().register(events);
|
||||
|
||||
// recipes
|
||||
ItemStack ingot = new ItemStack(LudicrousItems.resource, 1, 6);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.toolRod, 1, infinityMetalId),
|
||||
" X",
|
||||
" X ",
|
||||
" X ",
|
||||
" X ",
|
||||
"X ",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.pickaxeHead, 1, infinityMetalId),
|
||||
"XXX ",
|
||||
" XX ",
|
||||
" XX",
|
||||
" X",
|
||||
" X",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.shovelHead, 1, infinityMetalId),
|
||||
" XXX",
|
||||
"XXXX",
|
||||
" XX",
|
||||
" X ",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.hatchetHead, 1, infinityMetalId),
|
||||
" X ",
|
||||
" XXX ",
|
||||
"XXXXX",
|
||||
" X ",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.binding, 1, infinityMetalId),
|
||||
"X X",
|
||||
" X ",
|
||||
"X X",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.toughBinding, 1, infinityMetalId),
|
||||
"X X",
|
||||
" X X ",
|
||||
" X ",
|
||||
" X X ",
|
||||
"X X",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.toughRod, 1, infinityMetalId),
|
||||
" X",
|
||||
" X ",
|
||||
" X ",
|
||||
" X ",
|
||||
" X ",
|
||||
" X ",
|
||||
" X ",
|
||||
" X ",
|
||||
"X ",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.largePlate, 1, infinityMetalId),
|
||||
"XXXXX",
|
||||
"X X X",
|
||||
"XXXXX",
|
||||
"X X",
|
||||
"XXXXX",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.swordBlade, 1, infinityMetalId),
|
||||
" XX",
|
||||
" XXX",
|
||||
" XXX ",
|
||||
"XXX ",
|
||||
" X ",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.wideGuard, 1, infinityMetalId),
|
||||
"X ",
|
||||
" X ",
|
||||
" XX ",
|
||||
" X",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.handGuard, 1, infinityMetalId),
|
||||
"XXX",
|
||||
" X",
|
||||
" X",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.crossbar, 1, infinityMetalId),
|
||||
"X ",
|
||||
"XX ",
|
||||
" XX",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.knifeBlade, 1, infinityMetalId),
|
||||
" XX",
|
||||
" XX ",
|
||||
"XX ",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.frypanHead, 1, infinityMetalId),
|
||||
" XX ",
|
||||
"XXXX",
|
||||
"XXXX",
|
||||
" XX ",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.signHead, 1, infinityMetalId),
|
||||
"XXXXX",
|
||||
"XXXXX",
|
||||
"XXXXX",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.chiselHead, 1, infinityMetalId),
|
||||
" X ",
|
||||
" XXX",
|
||||
" XX ",
|
||||
" X ",
|
||||
" X ",
|
||||
"X ",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.scytheBlade, 1, infinityMetalId),
|
||||
"XXXX ",
|
||||
" XXXX ",
|
||||
" XXX ",
|
||||
" XXX",
|
||||
" X ",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.broadAxeHead, 1, infinityMetalId),
|
||||
" XX",
|
||||
" XXX",
|
||||
"XXXX",
|
||||
"XXXX",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.excavatorHead, 1, infinityMetalId),
|
||||
" X ",
|
||||
" XXX ",
|
||||
"XXXXX",
|
||||
"XXXX ",
|
||||
" XX ",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.largeSwordBlade, 1, infinityMetalId),
|
||||
" XXXX",
|
||||
" XXXX ",
|
||||
" XXXX ",
|
||||
" XXXX ",
|
||||
"XXXX ",
|
||||
" XX ",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.hammerHead, 1, infinityMetalId),
|
||||
" X ",
|
||||
" XXX ",
|
||||
"XXXXX ",
|
||||
" XXXXX ",
|
||||
" XXXXX",
|
||||
" XXX ",
|
||||
" X ",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerWeaponry.arrowhead, 1, infinityMetalId),
|
||||
"XX ",
|
||||
"XXXX",
|
||||
" XX ",
|
||||
" X ",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerWeaponry.partShuriken, 1, infinityMetalId),
|
||||
" XX",
|
||||
"XXXX",
|
||||
" XX ",
|
||||
"X X ",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerWeaponry.partBowLimb, 1, infinityMetalId),
|
||||
"XXXXXXX",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerWeaponry.partCrossbowLimb, 1, infinityMetalId),
|
||||
" XXXX",
|
||||
" XX ",
|
||||
" XX ",
|
||||
"XX ",
|
||||
"X ",
|
||||
"X ",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerWeaponry.partCrossbowBody, 1, infinityMetalId),
|
||||
"X ",
|
||||
" XX ",
|
||||
" XXX ",
|
||||
" XXX ",
|
||||
" XX ",
|
||||
" X ",
|
||||
" X",
|
||||
'X', ingot);
|
||||
|
||||
/*ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerWeaponry.partBolt, 1, infinityMetalId),
|
||||
" X",
|
||||
" X ",
|
||||
" X ",
|
||||
"X ",
|
||||
'X', ingot);*/
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerTools.fullGuard, 1, infinityMetalId),
|
||||
" XXX",
|
||||
"XXX ",
|
||||
"XXX ",
|
||||
" XXX",
|
||||
'X', ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.toolRod, 1, infinityMetalId),
|
||||
" X",
|
||||
" X ",
|
||||
" X ",
|
||||
" X ",
|
||||
"X ",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.pickaxeHead, 1, infinityMetalId),
|
||||
"XXX ",
|
||||
" XX ",
|
||||
" XX",
|
||||
" X",
|
||||
" X",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.shovelHead, 1, infinityMetalId),
|
||||
" XXX",
|
||||
"XXXX",
|
||||
" XX",
|
||||
" X ",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.hatchetHead, 1, infinityMetalId),
|
||||
" X ",
|
||||
" XXX ",
|
||||
"XXXXX",
|
||||
" X ",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.binding, 1, infinityMetalId),
|
||||
"X X",
|
||||
" X ",
|
||||
"X X",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.toughBinding, 1, infinityMetalId),
|
||||
"X X",
|
||||
" X X ",
|
||||
" X ",
|
||||
" X X ",
|
||||
"X X",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.toughRod, 1, infinityMetalId),
|
||||
" X",
|
||||
" X ",
|
||||
" X ",
|
||||
" X ",
|
||||
" X ",
|
||||
" X ",
|
||||
" X ",
|
||||
" X ",
|
||||
"X ",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.largePlate, 1, infinityMetalId),
|
||||
"XXXXX",
|
||||
"X X X",
|
||||
"XXXXX",
|
||||
"X X",
|
||||
"XXXXX",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.swordBlade, 1, infinityMetalId),
|
||||
" XX",
|
||||
" XXX",
|
||||
" XXX ",
|
||||
"XXX ",
|
||||
" X ",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.wideGuard, 1, infinityMetalId),
|
||||
"X ",
|
||||
" X ",
|
||||
" XX ",
|
||||
" X",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.handGuard, 1, infinityMetalId),
|
||||
"XXX",
|
||||
" X",
|
||||
" X",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.crossbar, 1, infinityMetalId),
|
||||
"X ",
|
||||
"XX ",
|
||||
" XX",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.knifeBlade, 1, infinityMetalId),
|
||||
" XX",
|
||||
" XX ",
|
||||
"XX ",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.frypanHead, 1, infinityMetalId),
|
||||
" XX ",
|
||||
"XXXX",
|
||||
"XXXX",
|
||||
" XX ",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.signHead, 1, infinityMetalId),
|
||||
"XXXXX",
|
||||
"XXXXX",
|
||||
"XXXXX",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.chiselHead, 1, infinityMetalId),
|
||||
" X ",
|
||||
" XXX",
|
||||
" XX ",
|
||||
" X ",
|
||||
" X ",
|
||||
"X ",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.scytheBlade, 1, infinityMetalId),
|
||||
"XXXX ",
|
||||
" XXXX ",
|
||||
" XXX ",
|
||||
" XXX",
|
||||
" X ",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.broadAxeHead, 1, infinityMetalId),
|
||||
" XX",
|
||||
" XXX",
|
||||
"XXXX",
|
||||
"XXXX",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.excavatorHead, 1, infinityMetalId),
|
||||
" X ",
|
||||
" XXX ",
|
||||
"XXXXX",
|
||||
"XXXX ",
|
||||
" XX ",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.largeSwordBlade, 1, infinityMetalId),
|
||||
" XXXX",
|
||||
" XXXX ",
|
||||
" XXXX ",
|
||||
" XXXX ",
|
||||
"XXXX ",
|
||||
" XX ",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.hammerHead, 1, infinityMetalId),
|
||||
" X ",
|
||||
" XXX ",
|
||||
"XXXXX ",
|
||||
" XXXXX ",
|
||||
" XXXXX",
|
||||
" XXX ",
|
||||
" X ",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerWeaponry.arrowhead, 1, infinityMetalId),
|
||||
"XX ",
|
||||
"XXXX",
|
||||
" XX ",
|
||||
" X ",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerWeaponry.partShuriken, 1, infinityMetalId),
|
||||
" XX",
|
||||
"XXXX",
|
||||
" XX ",
|
||||
"X X ",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerWeaponry.partBowLimb, 1, infinityMetalId),
|
||||
"XXXXXXX",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerWeaponry.partCrossbowLimb, 1, infinityMetalId),
|
||||
" XXXX",
|
||||
" XX ",
|
||||
" XX ",
|
||||
"XX ",
|
||||
"X ",
|
||||
"X ",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerWeaponry.partCrossbowBody, 1, infinityMetalId),
|
||||
"X ",
|
||||
" XX ",
|
||||
" XXX ",
|
||||
" XXX ",
|
||||
" XX ",
|
||||
" X ",
|
||||
" X",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
/*
|
||||
* ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(TinkerWeaponry.partBolt, 1,
|
||||
* infinityMetalId), " X", " X ", " X ", "X ", 'X', ingot);
|
||||
*/
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.fullGuard, 1, infinityMetalId),
|
||||
" XXX",
|
||||
"XXX ",
|
||||
"XXX ",
|
||||
" XXX",
|
||||
'X',
|
||||
ingot);
|
||||
|
||||
// extra modifiers from catalyst
|
||||
ModifyBuilder.registerModifier(new ModExtraModifier(new ItemStack[] { new ItemStack(LudicrousItems.resource, 1, 5) }, "AvaritiaFree"){
|
||||
@Override
|
||||
public void modify (ItemStack[] recipe, ItemStack input)
|
||||
{
|
||||
NBTTagCompound tags = this.getModifierTag(input);
|
||||
tags.setBoolean(key, true);
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers += 5;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
}
|
||||
});
|
||||
ModifyBuilder.registerModifier(
|
||||
new ModExtraModifier(new ItemStack[] { new ItemStack(LudicrousItems.resource, 1, 5) }, "AvaritiaFree") {
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(getBolt(neutroniumId, neutroniumId),
|
||||
"XX", "RX", 'X', new ItemStack(LudicrousItems.resource, 1, 4), 'R', new ItemStack(TinkerTools.toolRod, 1, neutroniumId));
|
||||
@Override
|
||||
public void modify(ItemStack[] recipe, ItemStack input) {
|
||||
NBTTagCompound tags = this.getModifierTag(input);
|
||||
tags.setBoolean(key, true);
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers += 5;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
}
|
||||
});
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(getBolt(neutroniumId, infinityMetalId),
|
||||
"XX", "RX", 'X', new ItemStack(LudicrousItems.resource, 1, 6), 'R', new ItemStack(TinkerTools.toolRod, 1, neutroniumId));
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
getBolt(neutroniumId, neutroniumId),
|
||||
"XX",
|
||||
"RX",
|
||||
'X',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
'R',
|
||||
new ItemStack(TinkerTools.toolRod, 1, neutroniumId));
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(getBolt(infinityMetalId, infinityMetalId),
|
||||
"XX", "RX", 'X', new ItemStack(LudicrousItems.resource, 1, 6), 'R', new ItemStack(TinkerTools.toolRod, 1, infinityMetalId));
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
getBolt(neutroniumId, infinityMetalId),
|
||||
"XX",
|
||||
"RX",
|
||||
'X',
|
||||
new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'R',
|
||||
new ItemStack(TinkerTools.toolRod, 1, neutroniumId));
|
||||
|
||||
}
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
getBolt(infinityMetalId, infinityMetalId),
|
||||
"XX",
|
||||
"RX",
|
||||
'X',
|
||||
new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'R',
|
||||
new ItemStack(TinkerTools.toolRod, 1, infinityMetalId));
|
||||
|
||||
}
|
||||
|
||||
private static ItemStack getBolt(int main, int tip) {
|
||||
ItemStack bolt = new ItemStack(TinkerWeaponry.partBolt, 1, main);
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
package fox.spiteful.avaritia.compat.ticon;
|
||||
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import tconstruct.library.client.TConstructClientRegistry;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
|
||||
public class TonkersClient {
|
||||
|
||||
public static void dunkThosePaintbrushes() {
|
||||
Lumberjack.info("Registering TiCon renderer mappings");
|
||||
TConstructClientRegistry.addMaterialRenderMapping(Tonkers.neutroniumId, "tinker", Tonkers.neutroniumName, true);
|
||||
TConstructClientRegistry.addMaterialRenderMapping(Tonkers.infinityMetalId, "tinker", Tonkers.infinityMetalName, true);
|
||||
|
||||
NeutroniumIcons iconN = new NeutroniumIcons();
|
||||
iconN.register();
|
||||
InfinityIcons iconI = new InfinityIcons();
|
||||
iconI.register();
|
||||
}
|
||||
|
||||
public static void dunkThosePaintbrushes() {
|
||||
Lumberjack.info("Registering TiCon renderer mappings");
|
||||
TConstructClientRegistry.addMaterialRenderMapping(Tonkers.neutroniumId, "tinker", Tonkers.neutroniumName, true);
|
||||
TConstructClientRegistry
|
||||
.addMaterialRenderMapping(Tonkers.infinityMetalId, "tinker", Tonkers.infinityMetalName, true);
|
||||
|
||||
NeutroniumIcons iconN = new NeutroniumIcons();
|
||||
iconN.register();
|
||||
InfinityIcons iconI = new InfinityIcons();
|
||||
iconI.register();
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package fox.spiteful.avaritia.compat.ticon;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import fox.spiteful.avaritia.Config;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -11,178 +10,166 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent;
|
||||
|
||||
import tconstruct.library.event.ToolCraftEvent;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import fox.spiteful.avaritia.Config;
|
||||
import fox.spiteful.avaritia.LudicrousEvents;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import fox.spiteful.avaritia.items.tools.ToolHelper;
|
||||
|
||||
public class TonkersEvents {
|
||||
private Random randy = new Random();
|
||||
|
||||
@SubscribeEvent
|
||||
public void craftTool(ToolCraftEvent.NormalTool event)
|
||||
{
|
||||
NBTTagCompound toolTag = event.toolTag.getCompoundTag("InfiTool");
|
||||
handleInfinityMods(toolTag, event.tool);
|
||||
|
||||
private Random randy = new Random();
|
||||
|
||||
@SubscribeEvent
|
||||
public void craftTool(ToolCraftEvent.NormalTool event) {
|
||||
NBTTagCompound toolTag = event.toolTag.getCompoundTag("InfiTool");
|
||||
handleInfinityMods(toolTag, event.tool);
|
||||
}
|
||||
|
||||
private void handleInfinityMods (NBTTagCompound toolTag, ToolCore tool)
|
||||
{
|
||||
int plusmod = 5;
|
||||
|
||||
private void handleInfinityMods(NBTTagCompound toolTag, ToolCore tool) {
|
||||
int plusmod = 5;
|
||||
int modifiers = toolTag.getInteger("Modifiers");
|
||||
if (toolTag.getInteger("Head") == Tonkers.infinityMetalId)
|
||||
modifiers += plusmod;
|
||||
if (toolTag.getInteger("Handle") == Tonkers.infinityMetalId)
|
||||
modifiers += plusmod;
|
||||
if (toolTag.getInteger("Accessory") == Tonkers.infinityMetalId)
|
||||
modifiers += plusmod;
|
||||
if (toolTag.getInteger("Extra") == Tonkers.infinityMetalId)
|
||||
modifiers += plusmod;
|
||||
if (toolTag.getInteger("Head") == Tonkers.infinityMetalId) modifiers += plusmod;
|
||||
if (toolTag.getInteger("Handle") == Tonkers.infinityMetalId) modifiers += plusmod;
|
||||
if (toolTag.getInteger("Accessory") == Tonkers.infinityMetalId) modifiers += plusmod;
|
||||
if (toolTag.getInteger("Extra") == Tonkers.infinityMetalId) modifiers += plusmod;
|
||||
|
||||
// 2 part tools gain 2 modifiers for the head
|
||||
if (tool.getPartAmount() == 2 && toolTag.getInteger("Head") == Tonkers.infinityMetalId)
|
||||
modifiers += plusmod;
|
||||
if (tool.getPartAmount() == 2 && toolTag.getInteger("Head") == Tonkers.infinityMetalId) modifiers += plusmod;
|
||||
|
||||
toolTag.setInteger("Modifiers", modifiers);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@SubscribeEvent
|
||||
public void handleExtraLuck(HarvestDropsEvent event) {
|
||||
if(event.harvester == null)
|
||||
return;
|
||||
if(event.harvester.getHeldItem() == null)
|
||||
return;
|
||||
if (event.harvester == null) return;
|
||||
if (event.harvester.getHeldItem() == null) return;
|
||||
ItemStack held = event.harvester.getHeldItem();
|
||||
if (held != null && held.hasTagCompound() && held.getItem() instanceof ToolCore)
|
||||
{
|
||||
ToolCore tool = (ToolCore)held.getItem();
|
||||
NBTTagCompound toolTag = held.getTagCompound().getCompoundTag("InfiTool");
|
||||
|
||||
if (toolTag.getInteger("Head") == Tonkers.infinityMetalId) {
|
||||
int parts = 1;
|
||||
if (toolTag.getInteger("Handle") == Tonkers.infinityMetalId) {
|
||||
parts++;
|
||||
}
|
||||
if (held != null && held.hasTagCompound() && held.getItem() instanceof ToolCore) {
|
||||
ToolCore tool = (ToolCore) held.getItem();
|
||||
NBTTagCompound toolTag = held.getTagCompound().getCompoundTag("InfiTool");
|
||||
|
||||
if (toolTag.getInteger("Head") == Tonkers.infinityMetalId) {
|
||||
int parts = 1;
|
||||
if (toolTag.getInteger("Handle") == Tonkers.infinityMetalId) {
|
||||
parts++;
|
||||
}
|
||||
if (toolTag.getInteger("Accessory") == Tonkers.infinityMetalId) {
|
||||
parts++;
|
||||
parts++;
|
||||
}
|
||||
if (toolTag.getInteger("Extra") == Tonkers.infinityMetalId) {
|
||||
parts++;
|
||||
parts++;
|
||||
}
|
||||
|
||||
|
||||
int luck = Math.min(3, parts);
|
||||
if (parts == tool.getPartAmount()) {
|
||||
luck++;
|
||||
if (tool.getPartAmount() == 2) {
|
||||
luck++;
|
||||
}
|
||||
luck++;
|
||||
if (tool.getPartAmount() == 2) {
|
||||
luck++;
|
||||
}
|
||||
}
|
||||
|
||||
LudicrousEvents.extraLuck(event, luck);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onHurt(LivingHurtEvent event) {
|
||||
Entity damaged = event.entity;
|
||||
Entity damager = event.source.getSourceOfDamage();
|
||||
if (damager != null && damager instanceof EntityLivingBase && damaged instanceof EntityLivingBase) {
|
||||
EntityLivingBase attacker = (EntityLivingBase)damager;
|
||||
EntityLivingBase attacked = (EntityLivingBase)damaged;
|
||||
|
||||
ItemStack held = attacker.getHeldItem();
|
||||
if (held != null && held.hasTagCompound() && held.getItem() instanceof ToolCore) {
|
||||
ToolCore tool = (ToolCore)held.getItem();
|
||||
NBTTagCompound toolTag = held.getTagCompound().getCompoundTag("InfiTool");
|
||||
|
||||
float puntpower = 0.0f;
|
||||
float puntboost = 1.5f;
|
||||
if (toolTag.getInteger("Head") == Tonkers.neutroniumId) {
|
||||
puntpower += puntboost;
|
||||
}
|
||||
if (toolTag.getInteger("Handle") == Tonkers.neutroniumId) {
|
||||
puntpower += puntboost;
|
||||
}
|
||||
if (toolTag.getInteger("Accessory") == Tonkers.neutroniumId) {
|
||||
puntpower += puntboost;
|
||||
}
|
||||
if (toolTag.getInteger("Extra") == Tonkers.neutroniumId) {
|
||||
puntpower += puntboost;
|
||||
}
|
||||
|
||||
float knockback = (AbilityHelper.calcKnockback(attacker, attacked, held, tool, toolTag, 0) + 1) * puntpower;
|
||||
attacked.addVelocity((double) (-MathHelper.sin(attacker.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback * 0.5F), 0.1D, (double) (MathHelper.cos(attacker.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback * 0.5F));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*@SubscribeEvent
|
||||
public void onLivingUpdate(LivingUpdateEvent event) {
|
||||
ItemStack held = event.entityLiving.getHeldItem();
|
||||
if (held != null && held.hasTagCompound() && held.getItem() instanceof ToolCore) {
|
||||
ToolCore tool = (ToolCore)held.getItem();
|
||||
NBTTagCompound toolTag = held.getTagCompound().getCompoundTag("InfiTool");
|
||||
|
||||
int chance = 0;
|
||||
int per = 1;
|
||||
if (toolTag.getInteger("Head") == Tonkers.infinityMetalId) {
|
||||
chance += per;
|
||||
}
|
||||
if (toolTag.getInteger("Handle") == Tonkers.infinityMetalId) {
|
||||
chance += per;
|
||||
}
|
||||
if (toolTag.getInteger("Accessory") == Tonkers.infinityMetalId) {
|
||||
chance += per;
|
||||
}
|
||||
if (toolTag.getInteger("Extra") == Tonkers.infinityMetalId) {
|
||||
chance += per;
|
||||
}
|
||||
|
||||
if (randy.nextInt(60) < chance) {
|
||||
AbilityHelper.healTool(held, MathHelper.floor_float(tool.getDurabilityModifier()), event.entityLiving, true);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// bedrock SMASH!
|
||||
@SubscribeEvent
|
||||
LudicrousEvents.extraLuck(event, luck);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onHurt(LivingHurtEvent event) {
|
||||
Entity damaged = event.entity;
|
||||
Entity damager = event.source.getSourceOfDamage();
|
||||
if (damager != null && damager instanceof EntityLivingBase && damaged instanceof EntityLivingBase) {
|
||||
EntityLivingBase attacker = (EntityLivingBase) damager;
|
||||
EntityLivingBase attacked = (EntityLivingBase) damaged;
|
||||
|
||||
ItemStack held = attacker.getHeldItem();
|
||||
if (held != null && held.hasTagCompound() && held.getItem() instanceof ToolCore) {
|
||||
ToolCore tool = (ToolCore) held.getItem();
|
||||
NBTTagCompound toolTag = held.getTagCompound().getCompoundTag("InfiTool");
|
||||
|
||||
float puntpower = 0.0f;
|
||||
float puntboost = 1.5f;
|
||||
if (toolTag.getInteger("Head") == Tonkers.neutroniumId) {
|
||||
puntpower += puntboost;
|
||||
}
|
||||
if (toolTag.getInteger("Handle") == Tonkers.neutroniumId) {
|
||||
puntpower += puntboost;
|
||||
}
|
||||
if (toolTag.getInteger("Accessory") == Tonkers.neutroniumId) {
|
||||
puntpower += puntboost;
|
||||
}
|
||||
if (toolTag.getInteger("Extra") == Tonkers.neutroniumId) {
|
||||
puntpower += puntboost;
|
||||
}
|
||||
|
||||
float knockback = (AbilityHelper.calcKnockback(attacker, attacked, held, tool, toolTag, 0) + 1)
|
||||
* puntpower;
|
||||
attacked.addVelocity(
|
||||
(double) (-MathHelper.sin(attacker.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback
|
||||
* 0.5F),
|
||||
0.1D,
|
||||
(double) (MathHelper.cos(attacker.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback
|
||||
* 0.5F));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @SubscribeEvent public void onLivingUpdate(LivingUpdateEvent event) { ItemStack held =
|
||||
* event.entityLiving.getHeldItem(); if (held != null && held.hasTagCompound() && held.getItem() instanceof
|
||||
* ToolCore) { ToolCore tool = (ToolCore)held.getItem(); NBTTagCompound toolTag =
|
||||
* held.getTagCompound().getCompoundTag("InfiTool"); int chance = 0; int per = 1; if (toolTag.getInteger("Head") ==
|
||||
* Tonkers.infinityMetalId) { chance += per; } if (toolTag.getInteger("Handle") == Tonkers.infinityMetalId) { chance
|
||||
* += per; } if (toolTag.getInteger("Accessory") == Tonkers.infinityMetalId) { chance += per; } if
|
||||
* (toolTag.getInteger("Extra") == Tonkers.infinityMetalId) { chance += per; } if (randy.nextInt(60) < chance) {
|
||||
* AbilityHelper.healTool(held, MathHelper.floor_float(tool.getDurabilityModifier()), event.entityLiving, true); } }
|
||||
* }
|
||||
*/
|
||||
|
||||
// bedrock SMASH!
|
||||
@SubscribeEvent
|
||||
public void onPlayerMine(PlayerInteractEvent event) {
|
||||
if(!Config.bedrockBreaker || event.face == -1 || event.world.isRemote || event.action != PlayerInteractEvent.Action.LEFT_CLICK_BLOCK || event.entityPlayer.getHeldItem() == null || event.entityPlayer.capabilities.isCreativeMode)
|
||||
if (!Config.bedrockBreaker || event.face == -1
|
||||
|| event.world.isRemote
|
||||
|| event.action != PlayerInteractEvent.Action.LEFT_CLICK_BLOCK
|
||||
|| event.entityPlayer.getHeldItem() == null
|
||||
|| event.entityPlayer.capabilities.isCreativeMode)
|
||||
return;
|
||||
Block block = event.world.getBlock(event.x, event.y, event.z);
|
||||
int meta = event.world.getBlockMetadata(event.x, event.y, event.z);
|
||||
ItemStack held = event.entityPlayer.getHeldItem();
|
||||
if(block.getBlockHardness(event.entityPlayer.worldObj, event.x, event.y, event.z) <= -1 &&
|
||||
held.hasTagCompound() && held.getItem() instanceof ToolCore &&
|
||||
(block.getMaterial() == Material.rock || block.getMaterial() == Material.iron)){
|
||||
if (block.getBlockHardness(event.entityPlayer.worldObj, event.x, event.y, event.z) <= -1
|
||||
&& held.hasTagCompound()
|
||||
&& held.getItem() instanceof ToolCore
|
||||
&& (block.getMaterial() == Material.rock || block.getMaterial() == Material.iron)) {
|
||||
|
||||
NBTTagCompound toolTag = held.getTagCompound().getCompoundTag("InfiTool");
|
||||
ToolCore tool = (ToolCore)held.getItem();
|
||||
|
||||
if (toolTag != null && toolTag.getInteger("Head") == Tonkers.infinityMetalId && tool.canHarvestBlock(Blocks.stone, held)) {
|
||||
if(block.quantityDropped(randy) == 0) {
|
||||
ItemStack drop = block.getPickBlock(ToolHelper.raytraceFromEntity(event.world, event.entityPlayer, true, 10),
|
||||
event.world, event.x, event.y, event.z, event.entityPlayer);
|
||||
if(drop == null)
|
||||
drop = new ItemStack(block, 1, meta);
|
||||
LudicrousEvents.dropItem(drop, event.entityPlayer.worldObj, event.x, event.y, event.z);
|
||||
}
|
||||
else {
|
||||
block.harvestBlock(event.world, event.entityPlayer, event.x, event.y, event.z, meta);
|
||||
}
|
||||
event.entityPlayer.worldObj.setBlockToAir(event.x, event.y, event.z);
|
||||
event.world.playAuxSFX(2001, event.x, event.y, event.z, Block.getIdFromBlock(block) + (meta << 12));
|
||||
}
|
||||
NBTTagCompound toolTag = held.getTagCompound().getCompoundTag("InfiTool");
|
||||
ToolCore tool = (ToolCore) held.getItem();
|
||||
|
||||
if (toolTag != null && toolTag.getInteger("Head") == Tonkers.infinityMetalId
|
||||
&& tool.canHarvestBlock(Blocks.stone, held)) {
|
||||
if (block.quantityDropped(randy) == 0) {
|
||||
ItemStack drop = block.getPickBlock(
|
||||
ToolHelper.raytraceFromEntity(event.world, event.entityPlayer, true, 10),
|
||||
event.world,
|
||||
event.x,
|
||||
event.y,
|
||||
event.z,
|
||||
event.entityPlayer);
|
||||
if (drop == null) drop = new ItemStack(block, 1, meta);
|
||||
LudicrousEvents.dropItem(drop, event.entityPlayer.worldObj, event.x, event.y, event.z);
|
||||
} else {
|
||||
block.harvestBlock(event.world, event.entityPlayer, event.x, event.y, event.z, meta);
|
||||
}
|
||||
event.entityPlayer.worldObj.setBlockToAir(event.x, event.y, event.z);
|
||||
event.world.playAuxSFX(2001, event.x, event.y, event.z, Block.getIdFromBlock(block) + (meta << 12));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +1,42 @@
|
||||
package fox.spiteful.avaritia.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class CompressOreRecipe extends CompressorRecipe {
|
||||
|
||||
private int oreID;
|
||||
|
||||
public CompressOreRecipe(ItemStack output, int amount, String lex, boolean exact){
|
||||
public CompressOreRecipe(ItemStack output, int amount, String lex, boolean exact) {
|
||||
super(output, amount, null, exact);
|
||||
oreID = OreDictionary.getOreID(lex);
|
||||
}
|
||||
|
||||
public CompressOreRecipe(ItemStack output, int amount, String lex){
|
||||
public CompressOreRecipe(ItemStack output, int amount, String lex) {
|
||||
this(output, amount, lex, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validInput(ItemStack ingredient){
|
||||
public boolean validInput(ItemStack ingredient) {
|
||||
|
||||
int[] ids = OreDictionary.getOreIDs(ingredient);
|
||||
for(int x = 0;x < ids.length;x++){
|
||||
if(oreID == ids[x])
|
||||
return true;
|
||||
for (int x = 0; x < ids.length; x++) {
|
||||
if (oreID == ids[x]) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIngredientName(){
|
||||
public String getIngredientName() {
|
||||
ArrayList<ItemStack> ores = OreDictionary.getOres(OreDictionary.getOreName(oreID));
|
||||
if(!ores.isEmpty())
|
||||
return ores.get(0).getDisplayName();
|
||||
if (!ores.isEmpty()) return ores.get(0).getDisplayName();
|
||||
return OreDictionary.getOreName(oreID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getIngredient(){
|
||||
public Object getIngredient() {
|
||||
return OreDictionary.getOres(OreDictionary.getOreName(oreID));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,60 +1,54 @@
|
||||
package fox.spiteful.avaritia.crafting;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CompressorManager {
|
||||
|
||||
private static ArrayList<CompressorRecipe> recipes = new ArrayList<CompressorRecipe>();
|
||||
|
||||
public static void addRecipe(ItemStack output, int amount, ItemStack input){
|
||||
public static void addRecipe(ItemStack output, int amount, ItemStack input) {
|
||||
recipes.add(new CompressorRecipe(output, amount, input));
|
||||
}
|
||||
|
||||
public static void addOreRecipe(ItemStack output, int amount, String ore){
|
||||
public static void addOreRecipe(ItemStack output, int amount, String ore) {
|
||||
recipes.add(new CompressOreRecipe(output, amount, ore));
|
||||
}
|
||||
|
||||
public static ItemStack getOutput(ItemStack input){
|
||||
for(CompressorRecipe recipe : recipes){
|
||||
if(recipe.validInput(input))
|
||||
return recipe.getOutput();
|
||||
public static ItemStack getOutput(ItemStack input) {
|
||||
for (CompressorRecipe recipe : recipes) {
|
||||
if (recipe.validInput(input)) return recipe.getOutput();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getCost(ItemStack input){
|
||||
if(input == null)
|
||||
return 0;
|
||||
public static int getCost(ItemStack input) {
|
||||
if (input == null) return 0;
|
||||
|
||||
for(CompressorRecipe recipe : recipes){
|
||||
if(recipe.validInput(input))
|
||||
return recipe.getCost();
|
||||
for (CompressorRecipe recipe : recipes) {
|
||||
if (recipe.validInput(input)) return recipe.getCost();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int getPrice(ItemStack output){
|
||||
if(output == null)
|
||||
return 0;
|
||||
public static int getPrice(ItemStack output) {
|
||||
if (output == null) return 0;
|
||||
|
||||
for(CompressorRecipe recipe : recipes){
|
||||
if(recipe.getOutput().isItemEqual(output))
|
||||
return recipe.getCost();
|
||||
for (CompressorRecipe recipe : recipes) {
|
||||
if (recipe.getOutput().isItemEqual(output)) return recipe.getCost();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static String getName(ItemStack input){
|
||||
for(CompressorRecipe recipe : recipes){
|
||||
if(recipe.validInput(input))
|
||||
return recipe.getIngredientName();
|
||||
public static String getName(ItemStack input) {
|
||||
for (CompressorRecipe recipe : recipes) {
|
||||
if (recipe.validInput(input)) return recipe.getIngredientName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ArrayList<CompressorRecipe> getRecipes(){
|
||||
public static ArrayList<CompressorRecipe> getRecipes() {
|
||||
return recipes;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,37 +9,35 @@ public class CompressorRecipe {
|
||||
private ItemStack input;
|
||||
private boolean specific;
|
||||
|
||||
public CompressorRecipe(ItemStack output, int amount, ItemStack ingredient, boolean exact){
|
||||
public CompressorRecipe(ItemStack output, int amount, ItemStack ingredient, boolean exact) {
|
||||
product = output;
|
||||
cost = amount;
|
||||
input = ingredient;
|
||||
specific = exact;
|
||||
}
|
||||
|
||||
public CompressorRecipe(ItemStack output, int amount, ItemStack ingredient){
|
||||
public CompressorRecipe(ItemStack output, int amount, ItemStack ingredient) {
|
||||
this(output, amount, ingredient, false);
|
||||
}
|
||||
|
||||
public ItemStack getOutput(){
|
||||
public ItemStack getOutput() {
|
||||
return product.copy();
|
||||
}
|
||||
|
||||
public int getCost(){
|
||||
if(specific)
|
||||
return cost;
|
||||
else
|
||||
return Gregorizer.balanceCost(cost);
|
||||
public int getCost() {
|
||||
if (specific) return cost;
|
||||
else return Gregorizer.balanceCost(cost);
|
||||
}
|
||||
|
||||
public boolean validInput(ItemStack ingredient){
|
||||
public boolean validInput(ItemStack ingredient) {
|
||||
return ingredient.isItemEqual(input);
|
||||
}
|
||||
|
||||
public String getIngredientName(){
|
||||
public String getIngredientName() {
|
||||
return input.getDisplayName();
|
||||
}
|
||||
|
||||
public Object getIngredient(){
|
||||
public Object getIngredient() {
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package fox.spiteful.avaritia.crafting;
|
||||
|
||||
import fox.spiteful.avaritia.blocks.LudicrousBlocks;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -12,9 +10,10 @@ import net.minecraft.item.crafting.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import java.util.*;
|
||||
import fox.spiteful.avaritia.blocks.LudicrousBlocks;
|
||||
|
||||
public class ExtremeCraftingManager {
|
||||
|
||||
/** The static instance of this class */
|
||||
private static final ExtremeCraftingManager instance = new ExtremeCraftingManager();
|
||||
/** A list of all the recipes added */
|
||||
@@ -23,36 +22,29 @@ public class ExtremeCraftingManager {
|
||||
/**
|
||||
* Returns the static instance of this class
|
||||
*/
|
||||
public static final ExtremeCraftingManager getInstance()
|
||||
{
|
||||
public static final ExtremeCraftingManager getInstance() {
|
||||
/** The static instance of this class */
|
||||
return instance;
|
||||
}
|
||||
|
||||
public ExtremeShapedRecipe addRecipe(ItemStack result, Object ... recipe)
|
||||
{
|
||||
public ExtremeShapedRecipe addRecipe(ItemStack result, Object... recipe) {
|
||||
String s = "";
|
||||
int i = 0;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
|
||||
if (recipe[i] instanceof String[])
|
||||
{
|
||||
String[] astring = (String[])((String[])recipe[i++]);
|
||||
if (recipe[i] instanceof String[]) {
|
||||
String[] astring = (String[]) ((String[]) recipe[i++]);
|
||||
|
||||
for (int l = 0; l < astring.length; ++l)
|
||||
{
|
||||
for (int l = 0; l < astring.length; ++l) {
|
||||
String s1 = astring[l];
|
||||
++height;
|
||||
width = s1.length();
|
||||
s = s + s1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (recipe[i] instanceof String)
|
||||
{
|
||||
String s2 = (String)recipe[i++];
|
||||
} else {
|
||||
while (recipe[i] instanceof String) {
|
||||
String s2 = (String) recipe[i++];
|
||||
++height;
|
||||
width = s2.length();
|
||||
s = s + s2;
|
||||
@@ -61,22 +53,16 @@ public class ExtremeCraftingManager {
|
||||
|
||||
HashMap hashmap;
|
||||
|
||||
for (hashmap = new HashMap(); i < recipe.length; i += 2)
|
||||
{
|
||||
Character character = (Character)recipe[i];
|
||||
for (hashmap = new HashMap(); i < recipe.length; i += 2) {
|
||||
Character character = (Character) recipe[i];
|
||||
ItemStack itemstack1 = null;
|
||||
|
||||
if (recipe[i + 1] instanceof Item)
|
||||
{
|
||||
itemstack1 = new ItemStack((Item)recipe[i + 1]);
|
||||
}
|
||||
else if (recipe[i + 1] instanceof Block)
|
||||
{
|
||||
itemstack1 = new ItemStack((Block)recipe[i + 1], 1, 32767);
|
||||
}
|
||||
else if (recipe[i + 1] instanceof ItemStack)
|
||||
{
|
||||
itemstack1 = (ItemStack)recipe[i + 1];
|
||||
if (recipe[i + 1] instanceof Item) {
|
||||
itemstack1 = new ItemStack((Item) recipe[i + 1]);
|
||||
} else if (recipe[i + 1] instanceof Block) {
|
||||
itemstack1 = new ItemStack((Block) recipe[i + 1], 1, 32767);
|
||||
} else if (recipe[i + 1] instanceof ItemStack) {
|
||||
itemstack1 = (ItemStack) recipe[i + 1];
|
||||
}
|
||||
|
||||
hashmap.put(character, itemstack1);
|
||||
@@ -84,16 +70,12 @@ public class ExtremeCraftingManager {
|
||||
|
||||
ItemStack[] ingredients = new ItemStack[width * height];
|
||||
|
||||
for (int i1 = 0; i1 < width * height; ++i1)
|
||||
{
|
||||
for (int i1 = 0; i1 < width * height; ++i1) {
|
||||
char c0 = s.charAt(i1);
|
||||
|
||||
if (hashmap.containsKey(Character.valueOf(c0)))
|
||||
{
|
||||
ingredients[i1] = ((ItemStack)hashmap.get(Character.valueOf(c0))).copy();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hashmap.containsKey(Character.valueOf(c0))) {
|
||||
ingredients[i1] = ((ItemStack) hashmap.get(Character.valueOf(c0))).copy();
|
||||
} else {
|
||||
ingredients[i1] = null;
|
||||
}
|
||||
}
|
||||
@@ -103,14 +85,15 @@ public class ExtremeCraftingManager {
|
||||
return shapedrecipes;
|
||||
}
|
||||
|
||||
public ExtremeShapedOreRecipe addExtremeShapedOreRecipe(ItemStack result, Object... recipe){
|
||||
public ExtremeShapedOreRecipe addExtremeShapedOreRecipe(ItemStack result, Object... recipe) {
|
||||
ExtremeShapedOreRecipe craft = new ExtremeShapedOreRecipe(result, recipe);
|
||||
recipes.add(craft);
|
||||
return craft;
|
||||
}
|
||||
|
||||
public ExtremeShapedRecipe addSingularityRecipe(ItemStack result, ItemStack single){
|
||||
return addRecipe(result,
|
||||
public ExtremeShapedRecipe addSingularityRecipe(ItemStack result, ItemStack single) {
|
||||
return addRecipe(
|
||||
result,
|
||||
"IIIIIIIII",
|
||||
"IIIIIIIII",
|
||||
"IIIIIIIII",
|
||||
@@ -120,12 +103,15 @@ public class ExtremeCraftingManager {
|
||||
"IIIIIIIII",
|
||||
"IIIIIIIII",
|
||||
"IIIIIIIII",
|
||||
'I', single,
|
||||
'N', new ItemStack(LudicrousBlocks.resource_block, 1, 0));
|
||||
'I',
|
||||
single,
|
||||
'N',
|
||||
new ItemStack(LudicrousBlocks.resource_block, 1, 0));
|
||||
}
|
||||
|
||||
public void addOreSingularityRecipe(ItemStack result, String ore){
|
||||
IRecipe recipe = new ExtremeShapedOreRecipe(result,
|
||||
public void addOreSingularityRecipe(ItemStack result, String ore) {
|
||||
IRecipe recipe = new ExtremeShapedOreRecipe(
|
||||
result,
|
||||
"IIIIIIIII",
|
||||
"IIIIIIIII",
|
||||
"IIIIIIIII",
|
||||
@@ -135,37 +121,31 @@ public class ExtremeCraftingManager {
|
||||
"IIIIIIIII",
|
||||
"IIIIIIIII",
|
||||
"IIIIIIIII",
|
||||
'I', ore,
|
||||
'N', new ItemStack(LudicrousBlocks.resource_block, 1, 0));
|
||||
'I',
|
||||
ore,
|
||||
'N',
|
||||
new ItemStack(LudicrousBlocks.resource_block, 1, 0));
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
public ExtremeShapelessRecipe addShapelessRecipe(ItemStack result, Object ... ingredients)
|
||||
{
|
||||
public ExtremeShapelessRecipe addShapelessRecipe(ItemStack result, Object... ingredients) {
|
||||
ArrayList arraylist = new ArrayList();
|
||||
Object[] aobject = ingredients;
|
||||
int i = ingredients.length;
|
||||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
for (int j = 0; j < i; ++j) {
|
||||
Object object1 = aobject[j];
|
||||
|
||||
if (object1 instanceof ItemStack)
|
||||
{
|
||||
arraylist.add(((ItemStack)object1).copy());
|
||||
}
|
||||
else if (object1 instanceof Item)
|
||||
{
|
||||
arraylist.add(new ItemStack((Item)object1));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(object1 instanceof Block))
|
||||
{
|
||||
if (object1 instanceof ItemStack) {
|
||||
arraylist.add(((ItemStack) object1).copy());
|
||||
} else if (object1 instanceof Item) {
|
||||
arraylist.add(new ItemStack((Item) object1));
|
||||
} else {
|
||||
if (!(object1 instanceof Block)) {
|
||||
throw new RuntimeException("Invalid shapeless recipy!");
|
||||
}
|
||||
|
||||
arraylist.add(new ItemStack((Block)object1));
|
||||
arraylist.add(new ItemStack((Block) object1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,32 +154,27 @@ public class ExtremeCraftingManager {
|
||||
return recipe;
|
||||
}
|
||||
|
||||
public ShapelessOreRecipe addShapelessOreRecipe(ItemStack result, Object ... ingredients){
|
||||
public ShapelessOreRecipe addShapelessOreRecipe(ItemStack result, Object... ingredients) {
|
||||
ShapelessOreRecipe recipe = new ShapelessOreRecipe(result, ingredients);
|
||||
recipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
public ItemStack findMatchingRecipe(InventoryCrafting matrix, World world)
|
||||
{
|
||||
public ItemStack findMatchingRecipe(InventoryCrafting matrix, World world) {
|
||||
int i = 0;
|
||||
ItemStack itemstack = null;
|
||||
ItemStack itemstack1 = null;
|
||||
int j;
|
||||
|
||||
for (j = 0; j < matrix.getSizeInventory(); ++j)
|
||||
{
|
||||
for (j = 0; j < matrix.getSizeInventory(); ++j) {
|
||||
ItemStack itemstack2 = matrix.getStackInSlot(j);
|
||||
|
||||
if (itemstack2 != null)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
if (itemstack2 != null) {
|
||||
if (i == 0) {
|
||||
itemstack = itemstack2;
|
||||
}
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
if (i == 1) {
|
||||
itemstack1 = itemstack2;
|
||||
}
|
||||
|
||||
@@ -207,29 +182,26 @@ public class ExtremeCraftingManager {
|
||||
}
|
||||
}
|
||||
|
||||
if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && itemstack.getItem().isRepairable())
|
||||
{
|
||||
if (i == 2 && itemstack.getItem() == itemstack1.getItem()
|
||||
&& itemstack.stackSize == 1
|
||||
&& itemstack1.stackSize == 1
|
||||
&& itemstack.getItem().isRepairable()) {
|
||||
Item item = itemstack.getItem();
|
||||
int j1 = item.getMaxDamage() - itemstack.getItemDamageForDisplay();
|
||||
int k = item.getMaxDamage() - itemstack1.getItemDamageForDisplay();
|
||||
int l = j1 + k + item.getMaxDamage() * 5 / 100;
|
||||
int i1 = item.getMaxDamage() - l;
|
||||
|
||||
if (i1 < 0)
|
||||
{
|
||||
if (i1 < 0) {
|
||||
i1 = 0;
|
||||
}
|
||||
|
||||
return new ItemStack(itemstack.getItem(), 1, i1);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = 0; j < this.recipes.size(); ++j)
|
||||
{
|
||||
IRecipe irecipe = (IRecipe)this.recipes.get(j);
|
||||
} else {
|
||||
for (j = 0; j < this.recipes.size(); ++j) {
|
||||
IRecipe irecipe = (IRecipe) this.recipes.get(j);
|
||||
|
||||
if (irecipe.matches(matrix, world))
|
||||
{
|
||||
if (irecipe.matches(matrix, world)) {
|
||||
return irecipe.getCraftingResult(matrix);
|
||||
}
|
||||
}
|
||||
@@ -241,8 +213,7 @@ public class ExtremeCraftingManager {
|
||||
/**
|
||||
* returns the List<> of all recipes
|
||||
*/
|
||||
public List getRecipeList()
|
||||
{
|
||||
public List getRecipeList() {
|
||||
return this.recipes;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
package fox.spiteful.avaritia.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -10,13 +15,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
public class ExtremeShapedOreRecipe implements IRecipe {
|
||||
//Added in for future ease of change, but hard coded for now.
|
||||
|
||||
// Added in for future ease of change, but hard coded for now.
|
||||
private static final int MAX_CRAFT_GRID_WIDTH = 9;
|
||||
private static final int MAX_CRAFT_GRID_HEIGHT = 9;
|
||||
|
||||
@@ -26,55 +27,50 @@ public class ExtremeShapedOreRecipe implements IRecipe {
|
||||
public int height = 0;
|
||||
private boolean mirrored = true;
|
||||
|
||||
public ExtremeShapedOreRecipe(Block result, Object... recipe){ this(new ItemStack(result), recipe); }
|
||||
public ExtremeShapedOreRecipe(Item result, Object... recipe){ this(new ItemStack(result), recipe); }
|
||||
public ExtremeShapedOreRecipe(ItemStack result, Object... recipe){
|
||||
public ExtremeShapedOreRecipe(Block result, Object... recipe) {
|
||||
this(new ItemStack(result), recipe);
|
||||
}
|
||||
|
||||
public ExtremeShapedOreRecipe(Item result, Object... recipe) {
|
||||
this(new ItemStack(result), recipe);
|
||||
}
|
||||
|
||||
public ExtremeShapedOreRecipe(ItemStack result, Object... recipe) {
|
||||
output = result.copy();
|
||||
|
||||
String shape = "";
|
||||
int idx = 0;
|
||||
|
||||
if (recipe[idx] instanceof Boolean)
|
||||
{
|
||||
mirrored = (Boolean)recipe[idx];
|
||||
if (recipe[idx+1] instanceof Object[])
|
||||
{
|
||||
recipe = (Object[])recipe[idx+1];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (recipe[idx] instanceof Boolean) {
|
||||
mirrored = (Boolean) recipe[idx];
|
||||
if (recipe[idx + 1] instanceof Object[]) {
|
||||
recipe = (Object[]) recipe[idx + 1];
|
||||
} else {
|
||||
idx = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (recipe[idx] instanceof String[])
|
||||
{
|
||||
String[] parts = ((String[])recipe[idx++]);
|
||||
if (recipe[idx] instanceof String[]) {
|
||||
String[] parts = ((String[]) recipe[idx++]);
|
||||
|
||||
for (String s : parts)
|
||||
{
|
||||
for (String s : parts) {
|
||||
width = s.length();
|
||||
shape += s;
|
||||
}
|
||||
|
||||
height = parts.length;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (recipe[idx] instanceof String)
|
||||
{
|
||||
String s = (String)recipe[idx++];
|
||||
} else {
|
||||
while (recipe[idx] instanceof String) {
|
||||
String s = (String) recipe[idx++];
|
||||
shape += s;
|
||||
width = s.length();
|
||||
height++;
|
||||
}
|
||||
}
|
||||
|
||||
if (width * height != shape.length())
|
||||
{
|
||||
if (width * height != shape.length()) {
|
||||
String ret = "Invalid shaped ore recipe: ";
|
||||
for (Object tmp : recipe)
|
||||
{
|
||||
for (Object tmp : recipe) {
|
||||
ret += tmp + ", ";
|
||||
}
|
||||
ret += output;
|
||||
@@ -83,32 +79,21 @@ public class ExtremeShapedOreRecipe implements IRecipe {
|
||||
|
||||
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
|
||||
|
||||
for (; idx < recipe.length; idx += 2)
|
||||
{
|
||||
Character chr = (Character)recipe[idx];
|
||||
for (; idx < recipe.length; idx += 2) {
|
||||
Character chr = (Character) recipe[idx];
|
||||
Object in = recipe[idx + 1];
|
||||
|
||||
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));
|
||||
}
|
||||
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));
|
||||
} else {
|
||||
String ret = "Invalid shaped ore recipe: ";
|
||||
for (Object tmp : recipe)
|
||||
{
|
||||
for (Object tmp : recipe) {
|
||||
ret += tmp + ", ";
|
||||
}
|
||||
ret += output;
|
||||
@@ -118,32 +103,27 @@ public class ExtremeShapedOreRecipe implements IRecipe {
|
||||
|
||||
input = new Object[width * height];
|
||||
int x = 0;
|
||||
for (char chr : shape.toCharArray())
|
||||
{
|
||||
for (char chr : shape.toCharArray()) {
|
||||
input[x++] = itemMap.get(chr);
|
||||
}
|
||||
}
|
||||
|
||||
ExtremeShapedOreRecipe(ShapedRecipes recipe, Map<ItemStack, String> replacements)
|
||||
{
|
||||
ExtremeShapedOreRecipe(ShapedRecipes recipe, Map<ItemStack, String> replacements) {
|
||||
output = recipe.getRecipeOutput();
|
||||
width = recipe.recipeWidth;
|
||||
height = recipe.recipeHeight;
|
||||
|
||||
input = new Object[recipe.recipeItems.length];
|
||||
|
||||
for(int i = 0; i < input.length; i++)
|
||||
{
|
||||
for (int i = 0; i < input.length; i++) {
|
||||
ItemStack ingred = recipe.recipeItems[i];
|
||||
|
||||
if(ingred == null) continue;
|
||||
if (ingred == null) continue;
|
||||
|
||||
input[i] = recipe.recipeItems[i];
|
||||
|
||||
for(Map.Entry<ItemStack, String> replace : replacements.entrySet())
|
||||
{
|
||||
if(OreDictionary.itemMatches(replace.getKey(), ingred, true))
|
||||
{
|
||||
for (Map.Entry<ItemStack, String> replace : replacements.entrySet()) {
|
||||
if (OreDictionary.itemMatches(replace.getKey(), ingred, true)) {
|
||||
input[i] = OreDictionary.getOres(replace.getValue());
|
||||
break;
|
||||
}
|
||||
@@ -151,7 +131,7 @@ public class ExtremeShapedOreRecipe implements IRecipe {
|
||||
}
|
||||
}
|
||||
|
||||
public ExtremeShapedOreRecipe(ItemStack result, Object[] ingredients, int wid, int hei){
|
||||
public ExtremeShapedOreRecipe(ItemStack result, Object[] ingredients, int wid, int hei) {
|
||||
width = wid;
|
||||
height = hei;
|
||||
output = result;
|
||||
@@ -162,34 +142,35 @@ public class ExtremeShapedOreRecipe implements IRecipe {
|
||||
* Returns an Item that is the result of this recipe
|
||||
*/
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting var1){ return output.copy(); }
|
||||
public ItemStack getCraftingResult(InventoryCrafting var1) {
|
||||
return output.copy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the recipe area
|
||||
*/
|
||||
@Override
|
||||
public int getRecipeSize(){ return input.length; }
|
||||
public int getRecipeSize() {
|
||||
return input.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput(){ return output; }
|
||||
public ItemStack getRecipeOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World world)
|
||||
{
|
||||
for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++)
|
||||
{
|
||||
for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y)
|
||||
{
|
||||
if (checkMatch(inv, x, y, false))
|
||||
{
|
||||
public boolean matches(InventoryCrafting inv, World world) {
|
||||
for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++) {
|
||||
for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y) {
|
||||
if (checkMatch(inv, x, y, false)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mirrored && checkMatch(inv, x, y, true))
|
||||
{
|
||||
if (mirrored && checkMatch(inv, x, y, true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -199,69 +180,51 @@ public class ExtremeShapedOreRecipe implements IRecipe {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror)
|
||||
{
|
||||
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++)
|
||||
{
|
||||
for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++)
|
||||
{
|
||||
private boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror) {
|
||||
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++) {
|
||||
for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++) {
|
||||
int subX = x - startX;
|
||||
int subY = y - startY;
|
||||
Object target = null;
|
||||
|
||||
if (subX >= 0 && subY >= 0 && subX < width && subY < height)
|
||||
{
|
||||
if (mirror)
|
||||
{
|
||||
if (subX >= 0 && subY >= 0 && subX < width && subY < height) {
|
||||
if (mirror) {
|
||||
target = input[width - subX - 1 + subY * width];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
target = input[subX + subY * width];
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack slot = inv.getStackInRowAndColumn(x, y);
|
||||
|
||||
if (target instanceof ItemStack)
|
||||
{
|
||||
if (target instanceof ItemStack) {
|
||||
ItemStack targetStack = (ItemStack) target;
|
||||
if (!OreDictionary.itemMatches((ItemStack)target, slot, false))
|
||||
{
|
||||
if (!OreDictionary.itemMatches((ItemStack) target, slot, false)) {
|
||||
return false;
|
||||
}
|
||||
if (targetStack.hasTagCompound())
|
||||
{
|
||||
if (targetStack.hasTagCompound()) {
|
||||
NBTTagCompound tagCompound = targetStack.getTagCompound();
|
||||
if (!slot.hasTagCompound())
|
||||
{
|
||||
if (!slot.hasTagCompound()) {
|
||||
return false;
|
||||
}
|
||||
NBTTagCompound slotTagCompound = slot.getTagCompound();
|
||||
// I forget, how to compare NBT...
|
||||
if (!slotTagCompound.equals(tagCompound))
|
||||
{
|
||||
if (!slotTagCompound.equals(tagCompound)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (target instanceof ArrayList)
|
||||
{
|
||||
} else if (target instanceof ArrayList) {
|
||||
boolean matched = false;
|
||||
|
||||
Iterator<ItemStack> itr = ((ArrayList<ItemStack>)target).iterator();
|
||||
while (itr.hasNext() && !matched)
|
||||
{
|
||||
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) target).iterator();
|
||||
while (itr.hasNext() && !matched) {
|
||||
matched = OreDictionary.itemMatches(itr.next(), slot, false);
|
||||
}
|
||||
|
||||
if (!matched)
|
||||
{
|
||||
if (!matched) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (target == null && slot != null)
|
||||
{
|
||||
} else if (target == null && slot != null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -270,19 +233,18 @@ public class ExtremeShapedOreRecipe implements IRecipe {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ExtremeShapedOreRecipe setMirrored(boolean mirror)
|
||||
{
|
||||
public ExtremeShapedOreRecipe setMirrored(boolean mirror) {
|
||||
mirrored = mirror;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the input for this recipe, any mod accessing this value should never
|
||||
* manipulate the values in this array as it will effect the recipe itself.
|
||||
* Returns the input for this recipe, any mod accessing this value should never manipulate the values in this array
|
||||
* as it will effect the recipe itself.
|
||||
*
|
||||
* @return The recipes input vales.
|
||||
*/
|
||||
public Object[] getInput()
|
||||
{
|
||||
public Object[] getInput() {
|
||||
return this.input;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,10 @@ package fox.spiteful.avaritia.crafting;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ExtremeShapedRecipe implements IRecipe
|
||||
{
|
||||
public class ExtremeShapedRecipe implements IRecipe {
|
||||
|
||||
/** How many horizontal slots this recipe is wide. */
|
||||
public final int recipeWidth;
|
||||
/** How many vertical slots this recipe uses. */
|
||||
@@ -17,35 +16,28 @@ public class ExtremeShapedRecipe implements IRecipe
|
||||
/** Is the ItemStack that you get when craft the recipe. */
|
||||
private ItemStack recipeOutput;
|
||||
|
||||
public ExtremeShapedRecipe(int width, int height, ItemStack[] ingredients, ItemStack result)
|
||||
{
|
||||
public ExtremeShapedRecipe(int width, int height, ItemStack[] ingredients, ItemStack result) {
|
||||
this.recipeWidth = width;
|
||||
this.recipeHeight = height;
|
||||
this.recipeItems = ingredients;
|
||||
this.recipeOutput = result;
|
||||
}
|
||||
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
public ItemStack getRecipeOutput() {
|
||||
return this.recipeOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
*/
|
||||
public boolean matches(InventoryCrafting matrix, World world)
|
||||
{
|
||||
for (int i = 0; i <= 9 - this.recipeWidth; ++i)
|
||||
{
|
||||
for (int j = 0; j <= 9 - this.recipeHeight; ++j)
|
||||
{
|
||||
if (this.checkMatch(matrix, i, j, true))
|
||||
{
|
||||
public boolean matches(InventoryCrafting matrix, World world) {
|
||||
for (int i = 0; i <= 9 - this.recipeWidth; ++i) {
|
||||
for (int j = 0; j <= 9 - this.recipeHeight; ++j) {
|
||||
if (this.checkMatch(matrix, i, j, true)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.checkMatch(matrix, i, j, false))
|
||||
{
|
||||
if (this.checkMatch(matrix, i, j, false)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -57,49 +49,37 @@ public class ExtremeShapedRecipe implements IRecipe
|
||||
/**
|
||||
* Checks if the region of a crafting inventory is match for the recipe.
|
||||
*/
|
||||
private boolean checkMatch(InventoryCrafting matrix, int x, int y, boolean mirrored)
|
||||
{
|
||||
for (int k = 0; k < 9; ++k)
|
||||
{
|
||||
for (int l = 0; l < 9; ++l)
|
||||
{
|
||||
private boolean checkMatch(InventoryCrafting matrix, int x, int y, boolean mirrored) {
|
||||
for (int k = 0; k < 9; ++k) {
|
||||
for (int l = 0; l < 9; ++l) {
|
||||
int i1 = k - x;
|
||||
int j1 = l - y;
|
||||
ItemStack itemstack = null;
|
||||
|
||||
if (i1 >= 0 && j1 >= 0 && i1 < this.recipeWidth && j1 < this.recipeHeight)
|
||||
{
|
||||
if (mirrored)
|
||||
{
|
||||
if (i1 >= 0 && j1 >= 0 && i1 < this.recipeWidth && j1 < this.recipeHeight) {
|
||||
if (mirrored) {
|
||||
itemstack = this.recipeItems[this.recipeWidth - i1 - 1 + j1 * this.recipeWidth];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
itemstack = this.recipeItems[i1 + j1 * this.recipeWidth];
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack itemstack1 = matrix.getStackInRowAndColumn(k, l);
|
||||
|
||||
if (itemstack1 != null || itemstack != null)
|
||||
{
|
||||
if (itemstack1 == null && itemstack != null || itemstack1 != null && itemstack == null)
|
||||
{
|
||||
if (itemstack1 != null || itemstack != null) {
|
||||
if (itemstack1 == null && itemstack != null || itemstack1 != null && itemstack == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemstack.getItem() != itemstack1.getItem())
|
||||
{
|
||||
if (itemstack.getItem() != itemstack1.getItem()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemstack.getItemDamage() != 32767 && itemstack.getItemDamage() != itemstack1.getItemDamage())
|
||||
{
|
||||
if (itemstack.getItemDamage() != 32767 && itemstack.getItemDamage() != itemstack1.getItemDamage()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemstack.hasTagCompound() && !ItemStack.areItemStackTagsEqual(itemstack, itemstack1))
|
||||
{
|
||||
|
||||
if (itemstack.hasTagCompound() && !ItemStack.areItemStackTagsEqual(itemstack, itemstack1)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -112,8 +92,7 @@ public class ExtremeShapedRecipe implements IRecipe
|
||||
/**
|
||||
* Returns an Item that is the result of this recipe
|
||||
*/
|
||||
public ItemStack getCraftingResult(InventoryCrafting p_77572_1_)
|
||||
{
|
||||
public ItemStack getCraftingResult(InventoryCrafting p_77572_1_) {
|
||||
return this.getRecipeOutput().copy();
|
||||
|
||||
}
|
||||
@@ -121,9 +100,8 @@ public class ExtremeShapedRecipe implements IRecipe
|
||||
/**
|
||||
* Returns the size of the recipe area
|
||||
*/
|
||||
public int getRecipeSize()
|
||||
{
|
||||
public int getRecipeSize() {
|
||||
return this.recipeWidth * this.recipeHeight;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,58 +1,51 @@
|
||||
package fox.spiteful.avaritia.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
public class ExtremeShapelessRecipe implements IRecipe {
|
||||
|
||||
public class ExtremeShapelessRecipe implements IRecipe
|
||||
{
|
||||
/** Is the ItemStack that you get when craft the recipe. */
|
||||
private final ItemStack recipeOutput;
|
||||
/** Is a List of ItemStack that composes the recipe. */
|
||||
public final List recipeItems;
|
||||
|
||||
public ExtremeShapelessRecipe(ItemStack result, List ingredients)
|
||||
{
|
||||
public ExtremeShapelessRecipe(ItemStack result, List ingredients) {
|
||||
this.recipeOutput = result;
|
||||
this.recipeItems = ingredients;
|
||||
}
|
||||
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
public ItemStack getRecipeOutput() {
|
||||
return this.recipeOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
*/
|
||||
public boolean matches(InventoryCrafting matrix, World world)
|
||||
{
|
||||
public boolean matches(InventoryCrafting matrix, World world) {
|
||||
ArrayList arraylist = new ArrayList(this.recipeItems);
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
ItemStack itemstack = matrix.getStackInRowAndColumn(j, i);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (itemstack != null) {
|
||||
boolean flag = false;
|
||||
Iterator iterator = arraylist.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
ItemStack itemstack1 = (ItemStack)iterator.next();
|
||||
while (iterator.hasNext()) {
|
||||
ItemStack itemstack1 = (ItemStack) iterator.next();
|
||||
|
||||
if (itemstack.getItem() == itemstack1.getItem() && (itemstack1.getItemDamage() == 32767 || itemstack.getItemDamage() == itemstack1.getItemDamage()))
|
||||
{
|
||||
if (!itemstack1.hasTagCompound() || ItemStack.areItemStackTagsEqual(itemstack1, itemstack))
|
||||
{
|
||||
if (itemstack.getItem() == itemstack1.getItem() && (itemstack1.getItemDamage() == 32767
|
||||
|| itemstack.getItemDamage() == itemstack1.getItemDamage())) {
|
||||
if (!itemstack1.hasTagCompound()
|
||||
|| ItemStack.areItemStackTagsEqual(itemstack1, itemstack)) {
|
||||
flag = true;
|
||||
arraylist.remove(itemstack1);
|
||||
break;
|
||||
@@ -60,8 +53,7 @@ public class ExtremeShapelessRecipe implements IRecipe
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
if (!flag) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -74,16 +66,14 @@ public class ExtremeShapelessRecipe implements IRecipe
|
||||
/**
|
||||
* Returns an Item that is the result of this recipe
|
||||
*/
|
||||
public ItemStack getCraftingResult(InventoryCrafting matrix)
|
||||
{
|
||||
public ItemStack getCraftingResult(InventoryCrafting matrix) {
|
||||
return this.recipeOutput.copy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the recipe area
|
||||
*/
|
||||
public int getRecipeSize()
|
||||
{
|
||||
public int getRecipeSize() {
|
||||
return this.recipeItems.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,42 +8,30 @@ public class Gregorizer {
|
||||
public static int modifier = 0;
|
||||
public static int multiplier = 0;
|
||||
|
||||
public static void balance(){
|
||||
if(Loader.isModLoaded("Thaumcraft"))
|
||||
public static void balance() {
|
||||
if (Loader.isModLoaded("Thaumcraft")) modifier += 0;
|
||||
if (Loader.isModLoaded("TConstruct") || Loader.isModLoaded("HydCraft")) modifier += 0;
|
||||
if (Loader.isModLoaded("ThermalExpansion") || Loader.isModLoaded("TSteelworks")
|
||||
|| Loader.isModLoaded("IC2")
|
||||
|| Loader.isModLoaded("ThaumicTinkerer"))
|
||||
modifier += 0;
|
||||
if(Loader.isModLoaded("TConstruct") || Loader.isModLoaded("HydCraft"))
|
||||
modifier += 0;
|
||||
if(Loader.isModLoaded("ThermalExpansion") || Loader.isModLoaded("TSteelworks") || Loader.isModLoaded("IC2") || Loader.isModLoaded("ThaumicTinkerer"))
|
||||
modifier += 0;
|
||||
if(Loader.isModLoaded("technom"))
|
||||
modifier += 0;
|
||||
if(Loader.isModLoaded("magicalcrops"))
|
||||
multiplier += 0;
|
||||
if(Loader.isModLoaded("AgriCraft"))
|
||||
multiplier += 0;
|
||||
if(Loader.isModLoaded("MineFactoryReloaded"))
|
||||
multiplier += 0;
|
||||
if(Loader.isModLoaded("BigReactors"))
|
||||
modifier += 0;
|
||||
if(Loader.isModLoaded("EE3"))
|
||||
multiplier += 0;
|
||||
else if(Loader.isModLoaded("ProjectE"))
|
||||
multiplier += 0;
|
||||
if(Loader.isModLoaded("Botania"))
|
||||
modifier += 0;
|
||||
if(Loader.isModLoaded("ExtraUtilities"))
|
||||
modifier += 0;
|
||||
if(Loader.isModLoaded("appliedenergistics2"))
|
||||
modifier += 0;
|
||||
if(Loader.isModLoaded("ImmersiveEngineering"))
|
||||
modifier += 0;
|
||||
if(Loader.isModLoaded("Mekanism")) {
|
||||
if (Loader.isModLoaded("technom")) modifier += 0;
|
||||
if (Loader.isModLoaded("magicalcrops")) multiplier += 0;
|
||||
if (Loader.isModLoaded("AgriCraft")) multiplier += 0;
|
||||
if (Loader.isModLoaded("MineFactoryReloaded")) multiplier += 0;
|
||||
if (Loader.isModLoaded("BigReactors")) modifier += 0;
|
||||
if (Loader.isModLoaded("EE3")) multiplier += 0;
|
||||
else if (Loader.isModLoaded("ProjectE")) multiplier += 0;
|
||||
if (Loader.isModLoaded("Botania")) modifier += 0;
|
||||
if (Loader.isModLoaded("ExtraUtilities")) modifier += 0;
|
||||
if (Loader.isModLoaded("appliedenergistics2")) modifier += 0;
|
||||
if (Loader.isModLoaded("ImmersiveEngineering")) modifier += 0;
|
||||
if (Loader.isModLoaded("Mekanism")) {
|
||||
modifier += 0;
|
||||
multiplier += 0;
|
||||
}
|
||||
if(Loader.isModLoaded("Torcherino"))
|
||||
multiplier += 0;
|
||||
if(Loader.isModLoaded("DraconicEvolution")) {
|
||||
if (Loader.isModLoaded("Torcherino")) multiplier += 0;
|
||||
if (Loader.isModLoaded("DraconicEvolution")) {
|
||||
modifier += 0;
|
||||
multiplier += 0;
|
||||
}
|
||||
@@ -52,7 +40,7 @@ public class Gregorizer {
|
||||
multiplier = Math.max(multiplier + Config.multiplier, 0);
|
||||
}
|
||||
|
||||
public static int balanceCost(int cost){
|
||||
public static int balanceCost(int cost) {
|
||||
return (cost + modifier) * multiplier;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
package fox.spiteful.avaritia.crafting;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import fox.spiteful.avaritia.Config;
|
||||
import fox.spiteful.avaritia.blocks.LudicrousBlocks;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -14,11 +8,18 @@ import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import fox.spiteful.avaritia.Config;
|
||||
import fox.spiteful.avaritia.blocks.LudicrousBlocks;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
|
||||
public class Grinder {
|
||||
|
||||
public static ShapelessOreRecipe catalyst;
|
||||
|
||||
public static void artsAndCrafts(){
|
||||
public static void artsAndCrafts() {
|
||||
|
||||
OreDictionary.registerOre("blockCrystalMatrix", new ItemStack(LudicrousBlocks.crystal_matrix, 1, 0));
|
||||
OreDictionary.registerOre("blockCosmicNeutronium", new ItemStack(LudicrousBlocks.resource_block, 1, 0));
|
||||
@@ -27,32 +28,139 @@ public class Grinder {
|
||||
OreDictionary.registerOre("ingotCosmicNeutronium", new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
OreDictionary.registerOre("ingotInfinity", new ItemStack(LudicrousItems.resource, 1, 6));
|
||||
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousItems.resource, 1, 0), "X X", " X ", "X X", 'X', new ItemStack(Items.diamond));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousItems.resource, 1, 1), "DSD", "DSD", 'D', new ItemStack(LudicrousItems.resource, 1, 0), 'S', new ItemStack(Items.nether_star));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousBlocks.double_craft, 1), "CCC", "CCC", "CCC", 'C', new ItemStack(Blocks.crafting_table));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousBlocks.triple_craft, 1), "CCC", "CCC", "CCC", 'C', new ItemStack(LudicrousBlocks.double_craft));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(Blocks.crafting_table, 9), "C", 'C', new ItemStack(LudicrousBlocks.double_craft));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousBlocks.double_craft, 9), "C", 'C', new ItemStack(LudicrousBlocks.triple_craft));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousBlocks.dire_crafting, 1), "CCC", "CXC", "CCC", 'C', new ItemStack(LudicrousItems.resource, 1, 1), 'X', new ItemStack(LudicrousBlocks.triple_craft));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousItems.resource, 1, 0),
|
||||
"X X",
|
||||
" X ",
|
||||
"X X",
|
||||
'X',
|
||||
new ItemStack(Items.diamond));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousItems.resource, 1, 1),
|
||||
"DSD",
|
||||
"DSD",
|
||||
'D',
|
||||
new ItemStack(LudicrousItems.resource, 1, 0),
|
||||
'S',
|
||||
new ItemStack(Items.nether_star));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousBlocks.double_craft, 1),
|
||||
"CCC",
|
||||
"CCC",
|
||||
"CCC",
|
||||
'C',
|
||||
new ItemStack(Blocks.crafting_table));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousBlocks.triple_craft, 1),
|
||||
"CCC",
|
||||
"CCC",
|
||||
"CCC",
|
||||
'C',
|
||||
new ItemStack(LudicrousBlocks.double_craft));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(Blocks.crafting_table, 9),
|
||||
"C",
|
||||
'C',
|
||||
new ItemStack(LudicrousBlocks.double_craft));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousBlocks.double_craft, 9),
|
||||
"C",
|
||||
'C',
|
||||
new ItemStack(LudicrousBlocks.triple_craft));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousBlocks.dire_crafting, 1),
|
||||
"CCC",
|
||||
"CXC",
|
||||
"CCC",
|
||||
'C',
|
||||
new ItemStack(LudicrousItems.resource, 1, 1),
|
||||
'X',
|
||||
new ItemStack(LudicrousBlocks.triple_craft));
|
||||
|
||||
if(Config.craftingOnly)
|
||||
return;
|
||||
if (Config.craftingOnly) return;
|
||||
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousBlocks.crystal_matrix, 1, 0), "CCC", "CCC", "CCC", 'C', new ItemStack(LudicrousItems.resource, 1, 1));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousItems.resource, 9, 1), "C", 'C', new ItemStack(LudicrousBlocks.crystal_matrix, 1, 0));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousItems.resource, 1, 3), "CCC", "CCC", "CCC", 'C', new ItemStack(LudicrousItems.resource, 1, 2));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousItems.resource, 1, 4), "CCC", "CCC", "CCC", 'C', new ItemStack(LudicrousItems.resource, 1, 3));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousItems.resource, 9, 3), "C", 'C', new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousItems.resource, 9, 2), "C", 'C', new ItemStack(LudicrousItems.resource, 1, 3));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousBlocks.resource_block, 1, 0), "CCC", "CCC", "CCC", 'C', new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousItems.resource, 9, 4), "C", 'C', new ItemStack(LudicrousBlocks.resource_block, 1, 0));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousBlocks.resource_block, 1, 1), "CCC", "CCC", "CCC", 'C', new ItemStack(LudicrousItems.resource, 1, 6));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousItems.resource, 9, 6), "C", 'C', new ItemStack(LudicrousBlocks.resource_block, 1, 1));
|
||||
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousItems.resource, 13, 8), "CCC", "CIC", "CCC", 'C', new ItemStack(Blocks.coal_block, 1), 'I', new ItemStack(LudicrousItems.resource, 1, 1));
|
||||
GameRegistry.addShapedRecipe(new ItemStack(LudicrousItems.resource, 1, 9), " I ", "ISI", " I ", 'I', new ItemStack(LudicrousItems.resource, 1, 4), 'S', new ItemStack(Items.stick));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousBlocks.crystal_matrix, 1, 0),
|
||||
"CCC",
|
||||
"CCC",
|
||||
"CCC",
|
||||
'C',
|
||||
new ItemStack(LudicrousItems.resource, 1, 1));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousItems.resource, 9, 1),
|
||||
"C",
|
||||
'C',
|
||||
new ItemStack(LudicrousBlocks.crystal_matrix, 1, 0));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousItems.resource, 1, 3),
|
||||
"CCC",
|
||||
"CCC",
|
||||
"CCC",
|
||||
'C',
|
||||
new ItemStack(LudicrousItems.resource, 1, 2));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
"CCC",
|
||||
"CCC",
|
||||
"CCC",
|
||||
'C',
|
||||
new ItemStack(LudicrousItems.resource, 1, 3));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousItems.resource, 9, 3),
|
||||
"C",
|
||||
'C',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousItems.resource, 9, 2),
|
||||
"C",
|
||||
'C',
|
||||
new ItemStack(LudicrousItems.resource, 1, 3));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousBlocks.resource_block, 1, 0),
|
||||
"CCC",
|
||||
"CCC",
|
||||
"CCC",
|
||||
'C',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousItems.resource, 9, 4),
|
||||
"C",
|
||||
'C',
|
||||
new ItemStack(LudicrousBlocks.resource_block, 1, 0));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousBlocks.resource_block, 1, 1),
|
||||
"CCC",
|
||||
"CCC",
|
||||
"CCC",
|
||||
'C',
|
||||
new ItemStack(LudicrousItems.resource, 1, 6));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousItems.resource, 9, 6),
|
||||
"C",
|
||||
'C',
|
||||
new ItemStack(LudicrousBlocks.resource_block, 1, 1));
|
||||
|
||||
ExtremeCraftingManager.getInstance().addRecipe(new ItemStack(LudicrousBlocks.neutron_collector, 1),
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousItems.resource, 13, 8),
|
||||
"CCC",
|
||||
"CIC",
|
||||
"CCC",
|
||||
'C',
|
||||
new ItemStack(Blocks.coal_block, 1),
|
||||
'I',
|
||||
new ItemStack(LudicrousItems.resource, 1, 1));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(LudicrousItems.resource, 1, 9),
|
||||
" I ",
|
||||
"ISI",
|
||||
" I ",
|
||||
'I',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
'S',
|
||||
new ItemStack(Items.stick));
|
||||
|
||||
ExtremeCraftingManager.getInstance().addRecipe(
|
||||
new ItemStack(LudicrousBlocks.neutron_collector, 1),
|
||||
"IIQQQQQII",
|
||||
"I QQQQQ I",
|
||||
"I RRR I",
|
||||
@@ -62,31 +170,45 @@ public class Grinder {
|
||||
"I RRR I",
|
||||
"I I",
|
||||
"IIIXIXIII",
|
||||
'X', new ItemStack(LudicrousItems.resource, 1, 1),
|
||||
'I', new ItemStack(Blocks.iron_block, 1),
|
||||
'Q', new ItemStack(Blocks.quartz_block, 1),
|
||||
'R', new ItemStack(Blocks.redstone_block, 1));
|
||||
'X',
|
||||
new ItemStack(LudicrousItems.resource, 1, 1),
|
||||
'I',
|
||||
new ItemStack(Blocks.iron_block, 1),
|
||||
'Q',
|
||||
new ItemStack(Blocks.quartz_block, 1),
|
||||
'R',
|
||||
new ItemStack(Blocks.redstone_block, 1));
|
||||
|
||||
ExtremeCraftingManager.getInstance().addRecipe(new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
ExtremeCraftingManager.getInstance().addRecipe(
|
||||
new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
"NNNNNNNNN",
|
||||
"NCXXCXXCN",
|
||||
"NXCCXCCXN",
|
||||
"NCXXCXXCN",
|
||||
"NNNNNNNNN",
|
||||
'C', new ItemStack(LudicrousItems.resource, 1, 1),
|
||||
'N', new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
'X', new ItemStack(LudicrousItems.resource, 1, 5));
|
||||
'C',
|
||||
new ItemStack(LudicrousItems.resource, 1, 1),
|
||||
'N',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
'X',
|
||||
new ItemStack(LudicrousItems.resource, 1, 5));
|
||||
|
||||
catalyst = ExtremeCraftingManager.getInstance().addShapelessOreRecipe(new ItemStack(LudicrousItems.resource, 1, 5),
|
||||
catalyst = ExtremeCraftingManager.getInstance().addShapelessOreRecipe(
|
||||
new ItemStack(LudicrousItems.resource, 1, 5),
|
||||
new ItemStack(Blocks.emerald_block, 1),
|
||||
new ItemStack(LudicrousItems.singularity, 1, 0), new ItemStack(LudicrousItems.singularity, 1, 1),
|
||||
new ItemStack(LudicrousItems.singularity, 1, 2), new ItemStack(LudicrousItems.singularity, 1, 3),
|
||||
new ItemStack(LudicrousItems.singularity, 1, 4), new ItemStack(LudicrousItems.ultimate_stew),
|
||||
new ItemStack(LudicrousItems.cosmic_meatballs), new ItemStack(LudicrousItems.endest_pearl));
|
||||
new ItemStack(LudicrousItems.singularity, 1, 0),
|
||||
new ItemStack(LudicrousItems.singularity, 1, 1),
|
||||
new ItemStack(LudicrousItems.singularity, 1, 2),
|
||||
new ItemStack(LudicrousItems.singularity, 1, 3),
|
||||
new ItemStack(LudicrousItems.singularity, 1, 4),
|
||||
new ItemStack(LudicrousItems.ultimate_stew),
|
||||
new ItemStack(LudicrousItems.cosmic_meatballs),
|
||||
new ItemStack(LudicrousItems.endest_pearl));
|
||||
|
||||
ItemStack result = new ItemStack(LudicrousItems.infinity_pickaxe, 1);
|
||||
result.addEnchantment(Enchantment.fortune, 10);
|
||||
ExtremeCraftingManager.getInstance().addRecipe(result,
|
||||
ExtremeCraftingManager.getInstance().addRecipe(
|
||||
result,
|
||||
" IIIIIII ",
|
||||
"IIIICIIII",
|
||||
"II N II",
|
||||
@@ -96,11 +218,15 @@ public class Grinder {
|
||||
" N ",
|
||||
" N ",
|
||||
" N ",
|
||||
'I', new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'C', new ItemStack(LudicrousBlocks.crystal_matrix, 1),
|
||||
'N', new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
'I',
|
||||
new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'C',
|
||||
new ItemStack(LudicrousBlocks.crystal_matrix, 1),
|
||||
'N',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
|
||||
ExtremeCraftingManager.getInstance().addRecipe(new ItemStack(LudicrousItems.infinity_sword),
|
||||
ExtremeCraftingManager.getInstance().addRecipe(
|
||||
new ItemStack(LudicrousItems.infinity_sword),
|
||||
" II",
|
||||
" III",
|
||||
" III ",
|
||||
@@ -110,12 +236,17 @@ public class Grinder {
|
||||
" NC ",
|
||||
" N C ",
|
||||
"X ",
|
||||
'I', new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'X', new ItemStack(LudicrousItems.resource, 1, 5),
|
||||
'C', new ItemStack(LudicrousItems.resource, 1, 1),
|
||||
'N', new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
'I',
|
||||
new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'X',
|
||||
new ItemStack(LudicrousItems.resource, 1, 5),
|
||||
'C',
|
||||
new ItemStack(LudicrousItems.resource, 1, 1),
|
||||
'N',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
|
||||
ExtremeCraftingManager.getInstance().addRecipe(new ItemStack(LudicrousItems.infinity_shovel),
|
||||
ExtremeCraftingManager.getInstance().addRecipe(
|
||||
new ItemStack(LudicrousItems.infinity_shovel),
|
||||
" III",
|
||||
" IIXI",
|
||||
" III",
|
||||
@@ -125,11 +256,15 @@ public class Grinder {
|
||||
" N ",
|
||||
" N ",
|
||||
"N ",
|
||||
'I', new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'X', new ItemStack(LudicrousBlocks.resource_block, 1, 1),
|
||||
'N', new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
'I',
|
||||
new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'X',
|
||||
new ItemStack(LudicrousBlocks.resource_block, 1, 1),
|
||||
'N',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
|
||||
ExtremeCraftingManager.getInstance().addRecipe(new ItemStack(LudicrousItems.infinity_axe),
|
||||
ExtremeCraftingManager.getInstance().addRecipe(
|
||||
new ItemStack(LudicrousItems.infinity_axe),
|
||||
" I ",
|
||||
"IIIII",
|
||||
"IIII ",
|
||||
@@ -139,10 +274,13 @@ public class Grinder {
|
||||
" N ",
|
||||
" N ",
|
||||
" N ",
|
||||
'I', new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'N', new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
'I',
|
||||
new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'N',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
|
||||
ExtremeCraftingManager.getInstance().addRecipe(new ItemStack(LudicrousItems.infinity_bow),
|
||||
ExtremeCraftingManager.getInstance().addRecipe(
|
||||
new ItemStack(LudicrousItems.infinity_bow),
|
||||
" II",
|
||||
" I W",
|
||||
" I W",
|
||||
@@ -152,11 +290,15 @@ public class Grinder {
|
||||
" I W",
|
||||
" I W",
|
||||
" II",
|
||||
'I', new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'X', new ItemStack(LudicrousBlocks.crystal_matrix, 1),
|
||||
'W', new ItemStack(Blocks.wool, 1, 0));
|
||||
'I',
|
||||
new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'X',
|
||||
new ItemStack(LudicrousBlocks.crystal_matrix, 1),
|
||||
'W',
|
||||
new ItemStack(Blocks.wool, 1, 0));
|
||||
|
||||
ExtremeCraftingManager.getInstance().addRecipe(new ItemStack(LudicrousItems.infinity_armor),
|
||||
ExtremeCraftingManager.getInstance().addRecipe(
|
||||
new ItemStack(LudicrousItems.infinity_armor),
|
||||
" NN NN ",
|
||||
"NNN NNN",
|
||||
"NNN NNN",
|
||||
@@ -166,22 +308,30 @@ public class Grinder {
|
||||
" NIIIIIN ",
|
||||
" NIIIIIN ",
|
||||
" NNNNN ",
|
||||
'I', new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'X', new ItemStack(LudicrousBlocks.crystal_matrix, 1),
|
||||
'N', new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
'I',
|
||||
new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'X',
|
||||
new ItemStack(LudicrousBlocks.crystal_matrix, 1),
|
||||
'N',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
|
||||
ExtremeCraftingManager.getInstance().addRecipe(new ItemStack(LudicrousItems.infinity_helm),
|
||||
ExtremeCraftingManager.getInstance().addRecipe(
|
||||
new ItemStack(LudicrousItems.infinity_helm),
|
||||
" NNNNN ",
|
||||
" NIIIIIN ",
|
||||
" N XIX N ",
|
||||
" NIIIIIN ",
|
||||
" NIIIIIN ",
|
||||
" NI I IN ",
|
||||
'I', new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'X', new ItemStack(LudicrousItems.resource, 1, 5),
|
||||
'N', new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
'I',
|
||||
new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'X',
|
||||
new ItemStack(LudicrousItems.resource, 1, 5),
|
||||
'N',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
|
||||
ExtremeCraftingManager.getInstance().addRecipe(new ItemStack(LudicrousItems.infinity_pants),
|
||||
ExtremeCraftingManager.getInstance().addRecipe(
|
||||
new ItemStack(LudicrousItems.infinity_pants),
|
||||
"NNNNNNNNN",
|
||||
"NIIIXIIIN",
|
||||
"NINNXNNIN",
|
||||
@@ -191,22 +341,30 @@ public class Grinder {
|
||||
"NIN NIN",
|
||||
"NIN NIN",
|
||||
"NNN NNN",
|
||||
'I', new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'X', new ItemStack(LudicrousItems.resource, 1, 5),
|
||||
'C', new ItemStack(LudicrousBlocks.crystal_matrix, 1),
|
||||
'N', new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
'I',
|
||||
new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'X',
|
||||
new ItemStack(LudicrousItems.resource, 1, 5),
|
||||
'C',
|
||||
new ItemStack(LudicrousBlocks.crystal_matrix, 1),
|
||||
'N',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
|
||||
ExtremeCraftingManager.getInstance().addRecipe(new ItemStack(LudicrousItems.infinity_shoes),
|
||||
ExtremeCraftingManager.getInstance().addRecipe(
|
||||
new ItemStack(LudicrousItems.infinity_shoes),
|
||||
" NNN NNN ",
|
||||
" NIN NIN ",
|
||||
" NIN NIN ",
|
||||
"NNIN NINN",
|
||||
"NIIN NIIN",
|
||||
"NNNN NNNN",
|
||||
'I', new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'N', new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
'I',
|
||||
new ItemStack(LudicrousItems.resource, 1, 6),
|
||||
'N',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(LudicrousItems.skull_sword),
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(LudicrousItems.skull_sword),
|
||||
" IX",
|
||||
" IXI",
|
||||
" IXI ",
|
||||
@@ -216,20 +374,34 @@ public class Grinder {
|
||||
" WB ",
|
||||
" W B ",
|
||||
"D ",
|
||||
'I', new ItemStack(LudicrousItems.resource, 1, 1),
|
||||
'X', new ItemStack(Items.blaze_powder),
|
||||
'B', new ItemStack(Items.bone),
|
||||
'D', new ItemStack(Items.nether_star),
|
||||
'W', "logWood");
|
||||
'I',
|
||||
new ItemStack(LudicrousItems.resource, 1, 1),
|
||||
'X',
|
||||
new ItemStack(Items.blaze_powder),
|
||||
'B',
|
||||
new ItemStack(Items.bone),
|
||||
'D',
|
||||
new ItemStack(Items.nether_star),
|
||||
'W',
|
||||
"logWood");
|
||||
|
||||
CompressorManager.addRecipe(new ItemStack(LudicrousItems.singularity, 1, 0), 7296, new ItemStack(Blocks.iron_block));
|
||||
CompressorManager.addRecipe(new ItemStack(LudicrousItems.singularity, 1, 1), 1215, new ItemStack(Blocks.gold_block, 1));
|
||||
CompressorManager.addRecipe(new ItemStack(LudicrousItems.singularity, 1, 2), 1215, new ItemStack(Blocks.lapis_block, 1));
|
||||
CompressorManager.addRecipe(new ItemStack(LudicrousItems.singularity, 1, 3), 7296, new ItemStack(Blocks.redstone_block, 1));
|
||||
CompressorManager.addRecipe(new ItemStack(LudicrousItems.singularity, 1, 4), 1215, new ItemStack(Blocks.quartz_block, 1));
|
||||
CompressorManager
|
||||
.addRecipe(new ItemStack(LudicrousItems.singularity, 1, 0), 7296, new ItemStack(Blocks.iron_block));
|
||||
CompressorManager
|
||||
.addRecipe(new ItemStack(LudicrousItems.singularity, 1, 1), 1215, new ItemStack(Blocks.gold_block, 1));
|
||||
CompressorManager
|
||||
.addRecipe(new ItemStack(LudicrousItems.singularity, 1, 2), 1215, new ItemStack(Blocks.lapis_block, 1));
|
||||
CompressorManager.addRecipe(
|
||||
new ItemStack(LudicrousItems.singularity, 1, 3),
|
||||
7296,
|
||||
new ItemStack(Blocks.redstone_block, 1));
|
||||
CompressorManager.addRecipe(
|
||||
new ItemStack(LudicrousItems.singularity, 1, 4),
|
||||
1215,
|
||||
new ItemStack(Blocks.quartz_block, 1));
|
||||
|
||||
if(Config.endStone)
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(LudicrousItems.endest_pearl),
|
||||
if (Config.endStone) ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(LudicrousItems.endest_pearl),
|
||||
" EEE ",
|
||||
" EEPPPEE ",
|
||||
" EPPPPPE ",
|
||||
@@ -239,12 +411,16 @@ public class Grinder {
|
||||
" EPPPPPE ",
|
||||
" EEPPPEE ",
|
||||
" EEE ",
|
||||
'E', new ItemStack(Blocks.end_stone),
|
||||
'P', new ItemStack(Items.ender_pearl),
|
||||
'S', new ItemStack(Items.nether_star),
|
||||
'N', new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
else
|
||||
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(LudicrousItems.endest_pearl),
|
||||
'E',
|
||||
new ItemStack(Blocks.end_stone),
|
||||
'P',
|
||||
new ItemStack(Items.ender_pearl),
|
||||
'S',
|
||||
new ItemStack(Items.nether_star),
|
||||
'N',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
else ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(
|
||||
new ItemStack(LudicrousItems.endest_pearl),
|
||||
" EEE ",
|
||||
" EEPPPEE ",
|
||||
" EPPPPPE ",
|
||||
@@ -254,11 +430,15 @@ public class Grinder {
|
||||
" EPPPPPE ",
|
||||
" EEPPPEE ",
|
||||
" EEE ",
|
||||
'P', new ItemStack(Items.ender_pearl),
|
||||
'S', new ItemStack(Items.nether_star),
|
||||
'N', new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
'P',
|
||||
new ItemStack(Items.ender_pearl),
|
||||
'S',
|
||||
new ItemStack(Items.nether_star),
|
||||
'N',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4));
|
||||
|
||||
ExtremeCraftingManager.getInstance().addRecipe(new ItemStack(LudicrousBlocks.compressor),
|
||||
ExtremeCraftingManager.getInstance().addRecipe(
|
||||
new ItemStack(LudicrousBlocks.compressor),
|
||||
"IIIHHHIII",
|
||||
"X N N X",
|
||||
"I N N I",
|
||||
@@ -268,68 +448,77 @@ public class Grinder {
|
||||
"I N N I",
|
||||
"X N N X",
|
||||
"IIIXIXIII",
|
||||
'X', new ItemStack(LudicrousItems.resource, 1, 1),
|
||||
'N', new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
'I', new ItemStack(Blocks.iron_block, 1),
|
||||
'H', new ItemStack(Blocks.hopper, 1),
|
||||
'R', new ItemStack(Blocks.redstone_block, 1),
|
||||
'O', new ItemStack(LudicrousBlocks.resource_block, 1, 0));
|
||||
'X',
|
||||
new ItemStack(LudicrousItems.resource, 1, 1),
|
||||
'N',
|
||||
new ItemStack(LudicrousItems.resource, 1, 4),
|
||||
'I',
|
||||
new ItemStack(Blocks.iron_block, 1),
|
||||
'H',
|
||||
new ItemStack(Blocks.hopper, 1),
|
||||
'R',
|
||||
new ItemStack(Blocks.redstone_block, 1),
|
||||
'O',
|
||||
new ItemStack(LudicrousBlocks.resource_block, 1, 0));
|
||||
}
|
||||
|
||||
public static void lastMinuteChanges(){
|
||||
if (Compat.mfr) {
|
||||
catalyst.getInput().add(OreDictionary.getOres("record"));
|
||||
} else {
|
||||
catalyst.getInput().add(new ItemStack(LudicrousItems.resource, 1, 7));
|
||||
IRecipe smashysmashy;
|
||||
//if (Compat.botan) {
|
||||
// smashysmashy = new ShapelessOreRecipe(new ItemStack(LudicrousItems.resource, 4, 7), "record");
|
||||
//} else {
|
||||
smashysmashy = new ShapelessOreRecipe(new ItemStack(LudicrousItems.resource, 8, 7), "record");
|
||||
//}
|
||||
GameRegistry.addRecipe(smashysmashy);
|
||||
}
|
||||
|
||||
if(Config.copper && !OreDictionary.getOres("blockCopper").isEmpty()){
|
||||
public static void lastMinuteChanges() {
|
||||
if (Compat.mfr) {
|
||||
catalyst.getInput().add(OreDictionary.getOres("record"));
|
||||
} else {
|
||||
catalyst.getInput().add(new ItemStack(LudicrousItems.resource, 1, 7));
|
||||
IRecipe smashysmashy;
|
||||
// if (Compat.botan) {
|
||||
// smashysmashy = new ShapelessOreRecipe(new ItemStack(LudicrousItems.resource, 4, 7), "record");
|
||||
// } else {
|
||||
smashysmashy = new ShapelessOreRecipe(new ItemStack(LudicrousItems.resource, 8, 7), "record");
|
||||
// }
|
||||
GameRegistry.addRecipe(smashysmashy);
|
||||
}
|
||||
|
||||
if (Config.copper && !OreDictionary.getOres("blockCopper").isEmpty()) {
|
||||
CompressorManager.addOreRecipe(new ItemStack(LudicrousItems.singularity, 1, 5), 3648, "blockCopper");
|
||||
catalyst.getInput().add(new ItemStack(LudicrousItems.singularity, 1, 5));
|
||||
}
|
||||
if(Config.tin && !OreDictionary.getOres("blockTin").isEmpty()){
|
||||
if (Config.tin && !OreDictionary.getOres("blockTin").isEmpty()) {
|
||||
CompressorManager.addOreRecipe(new ItemStack(LudicrousItems.singularity, 1, 6), 3648, "blockTin");
|
||||
catalyst.getInput().add(new ItemStack(LudicrousItems.singularity, 1, 6));
|
||||
}
|
||||
if(Config.lead && !OreDictionary.getOres("blockLead").isEmpty()){
|
||||
if (Config.lead && !OreDictionary.getOres("blockLead").isEmpty()) {
|
||||
CompressorManager.addOreRecipe(new ItemStack(LudicrousItems.singularity, 1, 7), 3648, "blockLead");
|
||||
catalyst.getInput().add(new ItemStack(LudicrousItems.singularity, 1, 7));
|
||||
}
|
||||
if(Config.silver && !OreDictionary.getOres("blockSilver").isEmpty()){
|
||||
if (Config.silver && !OreDictionary.getOres("blockSilver").isEmpty()) {
|
||||
CompressorManager.addOreRecipe(new ItemStack(LudicrousItems.singularity, 1, 8), 7296, "blockSilver");
|
||||
catalyst.getInput().add(new ItemStack(LudicrousItems.singularity, 1, 8));
|
||||
}
|
||||
if(Config.nickel && !OreDictionary.getOres("blockNickel").isEmpty()){
|
||||
if (Config.nickel && !OreDictionary.getOres("blockNickel").isEmpty()) {
|
||||
CompressorManager.addOreRecipe(new ItemStack(LudicrousItems.singularity, 1, 9), 3648, "blockNickel");
|
||||
catalyst.getInput().add(new ItemStack(LudicrousItems.singularity, 1, 9));
|
||||
}
|
||||
if(Config.enderium && !OreDictionary.getOres("blockEnderium").isEmpty()){
|
||||
if (Config.enderium && !OreDictionary.getOres("blockEnderium").isEmpty()) {
|
||||
CompressorManager.addOreRecipe(new ItemStack(LudicrousItems.singularity, 1, 10), 608, "blockEnderium");
|
||||
catalyst.getInput().add(new ItemStack(LudicrousItems.singularity, 1, 10));
|
||||
}
|
||||
if(Config.steel &&!OreDictionary.getOres("blockSteel").isEmpty()){
|
||||
if (Config.steel && !OreDictionary.getOres("blockSteel").isEmpty()) {
|
||||
catalyst.getInput().add(OreDictionary.getOres("blockSteel"));
|
||||
}
|
||||
if(Config.metallurgy && !OreDictionary.getOres("ingotTartarite").isEmpty()){
|
||||
if (Config.metallurgy && !OreDictionary.getOres("ingotTartarite").isEmpty()) {
|
||||
catalyst.getInput().add(OreDictionary.getOres("ingotTartarite"));
|
||||
}
|
||||
if(Config.numanuma && !OreDictionary.getOres("blockIronCompressed").isEmpty()){
|
||||
if (Config.numanuma && !OreDictionary.getOres("blockIronCompressed").isEmpty()) {
|
||||
catalyst.getInput().add(OreDictionary.getOres("blockIronCompressed"));
|
||||
}
|
||||
if(Config.darksteel && !OreDictionary.getOres("blockDarkSteel").isEmpty()){
|
||||
if (Config.darksteel && !OreDictionary.getOres("blockDarkSteel").isEmpty()) {
|
||||
catalyst.getInput().add(OreDictionary.getOres("blockDarkSteel"));
|
||||
}
|
||||
|
||||
if(Config.ultimateBalance && (Loader.isModLoaded("Botania") || Loader.isModLoaded("Mekanism"))) {
|
||||
if (Config.ultimateBalance && (Loader.isModLoaded("Botania") || Loader.isModLoaded("Mekanism"))) {
|
||||
catalyst.getInput().add(new ItemStack(LudicrousItems.singularity, 1, 11));
|
||||
CompressorManager.addRecipe(new ItemStack(LudicrousItems.singularity, 1, 11), 150, new ItemStack(Items.clay_ball, 1));
|
||||
CompressorManager.addRecipe(
|
||||
new ItemStack(LudicrousItems.singularity, 1, 11),
|
||||
150,
|
||||
new ItemStack(Items.clay_ball, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,311 +2,340 @@ package fox.spiteful.avaritia.crafting;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import fox.spiteful.avaritia.Config;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import fox.spiteful.avaritia.Config;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
|
||||
public class Mincer {
|
||||
|
||||
public static ShapelessOreRecipe stewRecipe;
|
||||
public static ShapelessOreRecipe meatballRecipe;
|
||||
|
||||
// here's where all the food magic goes on
|
||||
private static final String[] sacredCropNames = new String[]{"cropWheat", "cropCarrot", "cropPotato", "cropApple", "cropMelon", "cropPumpkin", "cropCactus", "cropMushroomRed", "cropMushroomBrown", "cropCherry"};
|
||||
private static final String[] forbiddenCropNames = new String[] {"cropEdibleroot", "cropWhitemushroom", "cropBeet", "cropCotton", "cropPoppy", "cropTulipRed", "cropTulipWhite", "cropDaisy",
|
||||
"cropTulipPink", "cropAllium", "cropOrchid", "cropTulipOrange", "cropDandelion", "cropShroomRed", "cropShroomBrown",
|
||||
"cropFerranium", "cropAurigold", "cropDiamahlia", "cropLapender", "cropEmeryllis", "cropRedstodendron", "cropCuprosia",
|
||||
"cropPetinia", "cropPlombean", "cropSilverweed", "cropJaslumine", "cropNiccissus", "cropPlatiolus", "cropOsmonium",
|
||||
"cropSandPear", "cropCitron"};
|
||||
private static final String[] knownMeatEntries = new String[]{"ingotMeatRaw", "dustMeat", "rawMutton"};
|
||||
private static List<ItemStack> knownMeats = new ArrayList<ItemStack>();
|
||||
// here's where all the food magic goes on
|
||||
private static final String[] sacredCropNames = new String[] { "cropWheat", "cropCarrot", "cropPotato", "cropApple",
|
||||
"cropMelon", "cropPumpkin", "cropCactus", "cropMushroomRed", "cropMushroomBrown", "cropCherry" };
|
||||
private static final String[] forbiddenCropNames = new String[] { "cropEdibleroot", "cropWhitemushroom", "cropBeet",
|
||||
"cropCotton", "cropPoppy", "cropTulipRed", "cropTulipWhite", "cropDaisy", "cropTulipPink", "cropAllium",
|
||||
"cropOrchid", "cropTulipOrange", "cropDandelion", "cropShroomRed", "cropShroomBrown", "cropFerranium",
|
||||
"cropAurigold", "cropDiamahlia", "cropLapender", "cropEmeryllis", "cropRedstodendron", "cropCuprosia",
|
||||
"cropPetinia", "cropPlombean", "cropSilverweed", "cropJaslumine", "cropNiccissus", "cropPlatiolus",
|
||||
"cropOsmonium", "cropSandPear", "cropCitron" };
|
||||
private static final String[] knownMeatEntries = new String[] { "ingotMeatRaw", "dustMeat", "rawMutton" };
|
||||
private static List<ItemStack> knownMeats = new ArrayList<ItemStack>();
|
||||
|
||||
static {
|
||||
knownMeats.add(new ItemStack(Items.beef));
|
||||
knownMeats.add(new ItemStack(Items.chicken));
|
||||
knownMeats.add(new ItemStack(Items.porkchop));
|
||||
|
||||
/*for (int i=0; i<ItemFishFood.FishType.values().length; i++) {
|
||||
knownMeats.add(new ItemStack(Items.fish, 1, i));
|
||||
}*/
|
||||
knownMeats.add(new ItemStack(Items.fish));
|
||||
knownMeats.add(new ItemStack(Items.beef));
|
||||
knownMeats.add(new ItemStack(Items.chicken));
|
||||
knownMeats.add(new ItemStack(Items.porkchop));
|
||||
|
||||
/*
|
||||
* for (int i=0; i<ItemFishFood.FishType.values().length; i++) { knownMeats.add(new ItemStack(Items.fish, 1,
|
||||
* i)); }
|
||||
*/
|
||||
knownMeats.add(new ItemStack(Items.fish));
|
||||
OreDictionary.registerOre("cropCactus", new ItemStack(Blocks.cactus));
|
||||
OreDictionary.registerOre("cropMushroomRed", new ItemStack(Blocks.red_mushroom));
|
||||
OreDictionary.registerOre("cropMushroomBrown", new ItemStack(Blocks.brown_mushroom));
|
||||
}
|
||||
private static Random randy;
|
||||
|
||||
public static void countThoseCalories() {
|
||||
|
||||
if(Config.boringFood){
|
||||
stewRecipe = ExtremeCraftingManager.getInstance().addShapelessOreRecipe(new ItemStack(LudicrousItems.ultimate_stew, 1), new ItemStack(Items.wheat, 1), new ItemStack(Items.carrot), new ItemStack(Items.potato), new ItemStack(Items.apple), new ItemStack(Items.melon), new ItemStack(Blocks.pumpkin), new ItemStack(Blocks.cactus), new ItemStack(Blocks.red_mushroom), new ItemStack(Blocks.brown_mushroom));
|
||||
meatballRecipe = ExtremeCraftingManager.getInstance().addShapelessOreRecipe(new ItemStack(LudicrousItems.cosmic_meatballs, 1), new ItemStack(Items.beef), new ItemStack(Items.beef), new ItemStack(Items.chicken), new ItemStack(Items.chicken), new ItemStack(Items.porkchop), new ItemStack(Items.porkchop), new ItemStack(Items.fish), new ItemStack(Items.fish));
|
||||
}
|
||||
private static Random randy;
|
||||
|
||||
public static void countThoseCalories() {
|
||||
|
||||
if (Config.boringFood) {
|
||||
stewRecipe = ExtremeCraftingManager.getInstance().addShapelessOreRecipe(
|
||||
new ItemStack(LudicrousItems.ultimate_stew, 1),
|
||||
new ItemStack(Items.wheat, 1),
|
||||
new ItemStack(Items.carrot),
|
||||
new ItemStack(Items.potato),
|
||||
new ItemStack(Items.apple),
|
||||
new ItemStack(Items.melon),
|
||||
new ItemStack(Blocks.pumpkin),
|
||||
new ItemStack(Blocks.cactus),
|
||||
new ItemStack(Blocks.red_mushroom),
|
||||
new ItemStack(Blocks.brown_mushroom));
|
||||
meatballRecipe = ExtremeCraftingManager.getInstance().addShapelessOreRecipe(
|
||||
new ItemStack(LudicrousItems.cosmic_meatballs, 1),
|
||||
new ItemStack(Items.beef),
|
||||
new ItemStack(Items.beef),
|
||||
new ItemStack(Items.chicken),
|
||||
new ItemStack(Items.chicken),
|
||||
new ItemStack(Items.porkchop),
|
||||
new ItemStack(Items.porkchop),
|
||||
new ItemStack(Items.fish),
|
||||
new ItemStack(Items.fish));
|
||||
return;
|
||||
}
|
||||
|
||||
String[] orenames = OreDictionary.getOreNames();
|
||||
|
||||
List<String> rawCrops = new ArrayList<String>();
|
||||
List<String> crops = new ArrayList<String>();
|
||||
List<String> meatNames = new ArrayList<String>();
|
||||
List<String> rawMeats = new ArrayList<String>();
|
||||
List<String> meats = new ArrayList<String>();
|
||||
|
||||
String orename;
|
||||
for (int i=0; i<orenames.length; i++) {
|
||||
orename = orenames[i];
|
||||
if (orename.startsWith("crop") && !bannedCrop(orename) && !orename.startsWith("cropBotania")) {
|
||||
rawCrops.add(orename);
|
||||
}
|
||||
}
|
||||
|
||||
//Lumberjack.info("End of ore crop names: "+rawCrops.size()+" names found.");
|
||||
|
||||
// Ultimate Stew recipe
|
||||
|
||||
// move the sacred crops if they exist... THEY CANNOT BE DEFILED!
|
||||
for (int i=0; i<sacredCropNames.length; i++) {
|
||||
String crop = sacredCropNames[i];
|
||||
if (rawCrops.contains(crop)) {
|
||||
rawCrops.remove(crop);
|
||||
crops.add(crop);
|
||||
}
|
||||
}
|
||||
|
||||
// prepare for culling
|
||||
List<FoodInfo> cropSortingList = new ArrayList<FoodInfo>();
|
||||
randy = new Random(12345);
|
||||
|
||||
for (int i=0; i<rawCrops.size(); i++) {
|
||||
List<ItemStack> ores = OreDictionary.getOres(rawCrops.get(i));
|
||||
|
||||
if (ores.size() > 0) {
|
||||
cropSortingList.add(new FoodInfo(rawCrops.get(i), ores.size()));
|
||||
}
|
||||
}
|
||||
|
||||
//Lumberjack.info("pre-sort: "+cropSortingList);
|
||||
|
||||
// sort into size/alphabetic order first to standardise them
|
||||
Collections.sort(cropSortingList, new Comparator<FoodInfo>(){
|
||||
@Override
|
||||
public int compare(FoodInfo a, FoodInfo b) {
|
||||
if (a.count != b.count) {
|
||||
return b.count > a.count ? 1 : -1;
|
||||
}
|
||||
|
||||
return a.orename.compareTo(b.orename);
|
||||
}
|
||||
});
|
||||
|
||||
//Lumberjack.info("first sort: "+cropSortingList);
|
||||
|
||||
// sort into size/random order, should be deterministic because previous sort
|
||||
Collections.shuffle(cropSortingList, randy);
|
||||
|
||||
Collections.sort(cropSortingList, new Comparator<FoodInfo>(){
|
||||
@Override
|
||||
public int compare(FoodInfo a, FoodInfo b) {
|
||||
if (a.count != b.count) {
|
||||
return b.count > a.count ? 1 : -1;
|
||||
}
|
||||
List<String> rawCrops = new ArrayList<String>();
|
||||
List<String> crops = new ArrayList<String>();
|
||||
List<String> meatNames = new ArrayList<String>();
|
||||
List<String> rawMeats = new ArrayList<String>();
|
||||
List<String> meats = new ArrayList<String>();
|
||||
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
//Lumberjack.info("second sort: "+cropSortingList);
|
||||
|
||||
// CULL!
|
||||
|
||||
if (cropSortingList.size() > 80 - crops.size()) {
|
||||
int shouldHave = 80 - crops.size();
|
||||
cropSortingList = cropSortingList.subList(0, shouldHave);
|
||||
}
|
||||
for (int i=0; i<cropSortingList.size(); i++) {
|
||||
crops.add(cropSortingList.get(i).orename);
|
||||
}
|
||||
|
||||
// calculate how much stew the recipe makes!
|
||||
//int types = Math.min(80,crops.size());
|
||||
int croptypes = crops.size();
|
||||
int cropmultiplier = 1;
|
||||
|
||||
while (croptypes * cropmultiplier < 8) {
|
||||
cropmultiplier++;
|
||||
}
|
||||
|
||||
int makesstew = (int) Math.round(croptypes*cropmultiplier/9.0);
|
||||
|
||||
//Lumberjack.info(types+" types x"+multiplier+" = "+(multiplier*types)+" items, makes "+makes+" pots of stew");
|
||||
|
||||
// time to actually MAKE the damn thing...
|
||||
|
||||
stewRecipe = ExtremeCraftingManager.getInstance().addShapelessOreRecipe(new ItemStack(LudicrousItems.ultimate_stew, makesstew), new ItemStack(LudicrousItems.resource, 1, 2));
|
||||
|
||||
List<Object> stewInputs = stewRecipe.getInput();
|
||||
for (int i=0; i<crops.size(); i++) {
|
||||
for (int j=0; j<cropmultiplier; j++) {
|
||||
stewInputs.add(OreDictionary.getOres(crops.get(i)));
|
||||
}
|
||||
}
|
||||
|
||||
// ok, now on to the meatballs!
|
||||
|
||||
//#####################################################################
|
||||
|
||||
// Cosmic Meatball recipe
|
||||
List<FoodInfo> meatSortingList = new ArrayList<FoodInfo>();
|
||||
randy = new Random(54321);
|
||||
String orename;
|
||||
for (int i = 0; i < orenames.length; i++) {
|
||||
orename = orenames[i];
|
||||
if (orename.startsWith("crop") && !bannedCrop(orename) && !orename.startsWith("cropBotania")) {
|
||||
rawCrops.add(orename);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<knownMeatEntries.length; i++) {
|
||||
if(OreDictionary.doesOreNameExist(knownMeatEntries[i])) {
|
||||
List<ItemStack> meatstacks = OreDictionary.getOres(knownMeatEntries[i]);
|
||||
if (!meatstacks.isEmpty()) {
|
||||
rawMeats.add(knownMeatEntries[i]);
|
||||
meatSortingList.add(new FoodInfo(knownMeatEntries[i], meatstacks.size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*for (int i=0; i<meatNames.size(); i++) {
|
||||
if (!rawMeats.contains(meatNames.get(i))) {
|
||||
List<ItemStack> meatstacks = OreDictionary.getOres(meatNames.get(i));
|
||||
if (!meatstacks.isEmpty()) {
|
||||
meatSortingList.add(new FoodInfo(meatNames.get(i), meatstacks.size()));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
// Lumberjack.info("End of ore crop names: "+rawCrops.size()+" names found.");
|
||||
|
||||
if(Loader.isModLoaded("TwilightForest") && Config.twilight){
|
||||
// Ultimate Stew recipe
|
||||
|
||||
// move the sacred crops if they exist... THEY CANNOT BE DEFILED!
|
||||
for (int i = 0; i < sacredCropNames.length; i++) {
|
||||
String crop = sacredCropNames[i];
|
||||
if (rawCrops.contains(crop)) {
|
||||
rawCrops.remove(crop);
|
||||
crops.add(crop);
|
||||
}
|
||||
}
|
||||
|
||||
// prepare for culling
|
||||
List<FoodInfo> cropSortingList = new ArrayList<FoodInfo>();
|
||||
randy = new Random(12345);
|
||||
|
||||
for (int i = 0; i < rawCrops.size(); i++) {
|
||||
List<ItemStack> ores = OreDictionary.getOres(rawCrops.get(i));
|
||||
|
||||
if (ores.size() > 0) {
|
||||
cropSortingList.add(new FoodInfo(rawCrops.get(i), ores.size()));
|
||||
}
|
||||
}
|
||||
|
||||
// Lumberjack.info("pre-sort: "+cropSortingList);
|
||||
|
||||
// sort into size/alphabetic order first to standardise them
|
||||
Collections.sort(cropSortingList, new Comparator<FoodInfo>() {
|
||||
|
||||
@Override
|
||||
public int compare(FoodInfo a, FoodInfo b) {
|
||||
if (a.count != b.count) {
|
||||
return b.count > a.count ? 1 : -1;
|
||||
}
|
||||
|
||||
return a.orename.compareTo(b.orename);
|
||||
}
|
||||
});
|
||||
|
||||
// Lumberjack.info("first sort: "+cropSortingList);
|
||||
|
||||
// sort into size/random order, should be deterministic because previous sort
|
||||
Collections.shuffle(cropSortingList, randy);
|
||||
|
||||
Collections.sort(cropSortingList, new Comparator<FoodInfo>() {
|
||||
|
||||
@Override
|
||||
public int compare(FoodInfo a, FoodInfo b) {
|
||||
if (a.count != b.count) {
|
||||
return b.count > a.count ? 1 : -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
// Lumberjack.info("second sort: "+cropSortingList);
|
||||
|
||||
// CULL!
|
||||
|
||||
if (cropSortingList.size() > 80 - crops.size()) {
|
||||
int shouldHave = 80 - crops.size();
|
||||
cropSortingList = cropSortingList.subList(0, shouldHave);
|
||||
}
|
||||
for (int i = 0; i < cropSortingList.size(); i++) {
|
||||
crops.add(cropSortingList.get(i).orename);
|
||||
}
|
||||
|
||||
// calculate how much stew the recipe makes!
|
||||
// int types = Math.min(80,crops.size());
|
||||
int croptypes = crops.size();
|
||||
int cropmultiplier = 1;
|
||||
|
||||
while (croptypes * cropmultiplier < 8) {
|
||||
cropmultiplier++;
|
||||
}
|
||||
|
||||
int makesstew = (int) Math.round(croptypes * cropmultiplier / 9.0);
|
||||
|
||||
// Lumberjack.info(types+" types x"+multiplier+" = "+(multiplier*types)+" items, makes "+makes+" pots of stew");
|
||||
|
||||
// time to actually MAKE the damn thing...
|
||||
|
||||
stewRecipe = ExtremeCraftingManager.getInstance().addShapelessOreRecipe(
|
||||
new ItemStack(LudicrousItems.ultimate_stew, makesstew),
|
||||
new ItemStack(LudicrousItems.resource, 1, 2));
|
||||
|
||||
List<Object> stewInputs = stewRecipe.getInput();
|
||||
for (int i = 0; i < crops.size(); i++) {
|
||||
for (int j = 0; j < cropmultiplier; j++) {
|
||||
stewInputs.add(OreDictionary.getOres(crops.get(i)));
|
||||
}
|
||||
}
|
||||
|
||||
// ok, now on to the meatballs!
|
||||
|
||||
// #####################################################################
|
||||
|
||||
// Cosmic Meatball recipe
|
||||
List<FoodInfo> meatSortingList = new ArrayList<FoodInfo>();
|
||||
randy = new Random(54321);
|
||||
|
||||
for (int i = 0; i < knownMeatEntries.length; i++) {
|
||||
if (OreDictionary.doesOreNameExist(knownMeatEntries[i])) {
|
||||
List<ItemStack> meatstacks = OreDictionary.getOres(knownMeatEntries[i]);
|
||||
if (!meatstacks.isEmpty()) {
|
||||
rawMeats.add(knownMeatEntries[i]);
|
||||
meatSortingList.add(new FoodInfo(knownMeatEntries[i], meatstacks.size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* for (int i=0; i<meatNames.size(); i++) { if (!rawMeats.contains(meatNames.get(i))) { List<ItemStack>
|
||||
* meatstacks = OreDictionary.getOres(meatNames.get(i)); if (!meatstacks.isEmpty()) { meatSortingList.add(new
|
||||
* FoodInfo(meatNames.get(i), meatstacks.size())); } } }
|
||||
*/
|
||||
|
||||
if (Loader.isModLoaded("TwilightForest") && Config.twilight) {
|
||||
try {
|
||||
Item venison = Compat.getItem("TwilightForest", "item.venisonRaw");
|
||||
Item meef = Compat.getItem("TwilightForest", "item.meefRaw");
|
||||
knownMeats.add(new ItemStack(venison));
|
||||
knownMeats.add(new ItemStack(meef));
|
||||
}
|
||||
catch(Exception e){}
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
if(Loader.isModLoaded("Natura")){
|
||||
if (Loader.isModLoaded("Natura")) {
|
||||
try {
|
||||
Item imp = Compat.getItem("Natura", "impmeat");
|
||||
knownMeats.add(new ItemStack(imp));
|
||||
}
|
||||
catch(Exception e){}
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
if(Compat.am2){
|
||||
if (Compat.am2) {
|
||||
try {
|
||||
Item stuff = Compat.getItem("arsmagica2", "itemOre");
|
||||
knownMeats.add(new ItemStack(stuff, 1, 8));
|
||||
}
|
||||
catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
Lumberjack.log(Level.INFO, e, "Avaritia got sick of the arcane guardian's healspam.");
|
||||
Compat.am2 = false;
|
||||
}
|
||||
}
|
||||
|
||||
Lumberjack.info("rawMeats: "+rawMeats);
|
||||
Lumberjack.info("knownMeats: "+knownMeats);
|
||||
|
||||
//Lumberjack.info("pre-sort: "+meatSortingList);
|
||||
|
||||
// sort into size/alphabetic order first to standardise them
|
||||
Collections.sort(meatSortingList, new Comparator<FoodInfo>(){
|
||||
@Override
|
||||
public int compare(FoodInfo a, FoodInfo b) {
|
||||
if (a.count != b.count) {
|
||||
return b.count > a.count ? 1 : -1;
|
||||
}
|
||||
|
||||
return a.orename.compareTo(b.orename);
|
||||
}
|
||||
});
|
||||
|
||||
//Lumberjack.info("first sort: "+meatSortingList);
|
||||
|
||||
// sort into size/random order, should be deterministic because previous sort
|
||||
Collections.sort(meatSortingList, new Comparator<FoodInfo>(){
|
||||
@Override
|
||||
public int compare(FoodInfo a, FoodInfo b) {
|
||||
if (a.count != b.count) {
|
||||
return b.count > a.count ? 1 : -1;
|
||||
}
|
||||
|
||||
return randy.nextBoolean() ? 1 : -1;
|
||||
}
|
||||
});
|
||||
|
||||
//Lumberjack.info("second sort: "+meatSortingList);
|
||||
|
||||
// CULL!
|
||||
|
||||
if (meatSortingList.size() > 80 - meats.size() - knownMeats.size()) {
|
||||
int shouldHave = 80 - crops.size() - knownMeats.size();
|
||||
meatSortingList = meatSortingList.subList(0, shouldHave);
|
||||
}
|
||||
for (int i=0; i<meatSortingList.size(); i++) {
|
||||
meats.add(meatSortingList.get(i).orename);
|
||||
}
|
||||
|
||||
// calculate how many meatballs the recipe makes!
|
||||
int meattypes = meats.size() + knownMeats.size();
|
||||
int meatmultiplier = 1;
|
||||
|
||||
while (meattypes * meatmultiplier < 8) {
|
||||
meatmultiplier++;
|
||||
}
|
||||
|
||||
int makesmeatballs = (int) Math.round(meattypes*meatmultiplier/9.0);
|
||||
|
||||
//Lumberjack.info(types+" types x"+multiplier+" = "+(multiplier*types)+" items, makes "+makes+" pots of stew");
|
||||
|
||||
// time to actually MAKE the damn thing...
|
||||
|
||||
meatballRecipe = ExtremeCraftingManager.getInstance().addShapelessOreRecipe(new ItemStack(LudicrousItems.cosmic_meatballs, makesmeatballs), new ItemStack(LudicrousItems.resource, 1, 2));
|
||||
|
||||
List<Object> meatballInputs = meatballRecipe.getInput();
|
||||
|
||||
for (int i=0; i<knownMeats.size(); i++) {
|
||||
for (int j=0; j<meatmultiplier; j++) {
|
||||
meatballInputs.add(knownMeats.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<meats.size(); i++) {
|
||||
for (int j=0; j<meatmultiplier; j++) {
|
||||
meatballInputs.add(OreDictionary.getOres(meats.get(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class FoodInfo {
|
||||
public final String orename;
|
||||
public final int count;
|
||||
public FoodInfo(String orename, int count) {
|
||||
this.orename = orename;
|
||||
this.count = count;
|
||||
}
|
||||
public String toString() {
|
||||
return this.orename+": "+this.count;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean bannedCrop(String crop){
|
||||
for(String ban : forbiddenCropNames){
|
||||
if(ban.equals(crop))
|
||||
return true;
|
||||
Lumberjack.info("rawMeats: " + rawMeats);
|
||||
Lumberjack.info("knownMeats: " + knownMeats);
|
||||
|
||||
// Lumberjack.info("pre-sort: "+meatSortingList);
|
||||
|
||||
// sort into size/alphabetic order first to standardise them
|
||||
Collections.sort(meatSortingList, new Comparator<FoodInfo>() {
|
||||
|
||||
@Override
|
||||
public int compare(FoodInfo a, FoodInfo b) {
|
||||
if (a.count != b.count) {
|
||||
return b.count > a.count ? 1 : -1;
|
||||
}
|
||||
|
||||
return a.orename.compareTo(b.orename);
|
||||
}
|
||||
});
|
||||
|
||||
// Lumberjack.info("first sort: "+meatSortingList);
|
||||
|
||||
// sort into size/random order, should be deterministic because previous sort
|
||||
Collections.sort(meatSortingList, new Comparator<FoodInfo>() {
|
||||
|
||||
@Override
|
||||
public int compare(FoodInfo a, FoodInfo b) {
|
||||
if (a.count != b.count) {
|
||||
return b.count > a.count ? 1 : -1;
|
||||
}
|
||||
|
||||
return randy.nextBoolean() ? 1 : -1;
|
||||
}
|
||||
});
|
||||
|
||||
// Lumberjack.info("second sort: "+meatSortingList);
|
||||
|
||||
// CULL!
|
||||
|
||||
if (meatSortingList.size() > 80 - meats.size() - knownMeats.size()) {
|
||||
int shouldHave = 80 - crops.size() - knownMeats.size();
|
||||
meatSortingList = meatSortingList.subList(0, shouldHave);
|
||||
}
|
||||
for (int i = 0; i < meatSortingList.size(); i++) {
|
||||
meats.add(meatSortingList.get(i).orename);
|
||||
}
|
||||
|
||||
// calculate how many meatballs the recipe makes!
|
||||
int meattypes = meats.size() + knownMeats.size();
|
||||
int meatmultiplier = 1;
|
||||
|
||||
while (meattypes * meatmultiplier < 8) {
|
||||
meatmultiplier++;
|
||||
}
|
||||
|
||||
int makesmeatballs = (int) Math.round(meattypes * meatmultiplier / 9.0);
|
||||
|
||||
// Lumberjack.info(types+" types x"+multiplier+" = "+(multiplier*types)+" items, makes "+makes+" pots of stew");
|
||||
|
||||
// time to actually MAKE the damn thing...
|
||||
|
||||
meatballRecipe = ExtremeCraftingManager.getInstance().addShapelessOreRecipe(
|
||||
new ItemStack(LudicrousItems.cosmic_meatballs, makesmeatballs),
|
||||
new ItemStack(LudicrousItems.resource, 1, 2));
|
||||
|
||||
List<Object> meatballInputs = meatballRecipe.getInput();
|
||||
|
||||
for (int i = 0; i < knownMeats.size(); i++) {
|
||||
for (int j = 0; j < meatmultiplier; j++) {
|
||||
meatballInputs.add(knownMeats.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < meats.size(); i++) {
|
||||
for (int j = 0; j < meatmultiplier; j++) {
|
||||
meatballInputs.add(OreDictionary.getOres(meats.get(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class FoodInfo {
|
||||
|
||||
public final String orename;
|
||||
public final int count;
|
||||
|
||||
public FoodInfo(String orename, int count) {
|
||||
this.orename = orename;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.orename + ": " + this.count;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean bannedCrop(String crop) {
|
||||
for (String ban : forbiddenCropNames) {
|
||||
if (ban.equals(crop)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,9 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -20,150 +17,144 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
|
||||
@Deprecated // maybe someday... but not today
|
||||
public class EntityCollationItem extends EntityItem {
|
||||
public static final String ITEMTAG = "item";
|
||||
|
||||
public EntityCollationItem(World world, double x, double y, double z, Collection<ItemStack> items) {
|
||||
super(world, x,y,z);
|
||||
ItemStack watchstack = new ItemStack(Blocks.bedrock);
|
||||
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
NBTTagList itemlist = new NBTTagList();
|
||||
|
||||
for (ItemStack stack : items) {
|
||||
NBTTagCompound itemtag = stack.writeToNBT(new NBTTagCompound());
|
||||
itemlist.appendTag(itemtag);
|
||||
}
|
||||
|
||||
tag.setTag(ITEMTAG, itemlist);
|
||||
watchstack.setTagCompound(tag);
|
||||
|
||||
this.setEntityItemStack(watchstack);
|
||||
|
||||
this.lifespan = 18000;
|
||||
this.delayBeforeCanPickup = 20;
|
||||
this.isImmuneToFire = true;
|
||||
}
|
||||
|
||||
// default constructors
|
||||
public EntityCollationItem(World world, double x, double y, double z, ItemStack stack) {
|
||||
super(world, x, y, z, stack);
|
||||
}
|
||||
public static final String ITEMTAG = "item";
|
||||
|
||||
public EntityCollationItem(World world, double x, double y, double z) {
|
||||
super(world, x, y, z);
|
||||
}
|
||||
public EntityCollationItem(World world, double x, double y, double z, Collection<ItemStack> items) {
|
||||
super(world, x, y, z);
|
||||
ItemStack watchstack = new ItemStack(Blocks.bedrock);
|
||||
|
||||
public EntityCollationItem(World world) {
|
||||
super(world);
|
||||
}
|
||||
// end that junk
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
ItemStack stack = this.getEntityItem();
|
||||
NBTTagList list = stack.getTagCompound().getTagList(ITEMTAG, 10);
|
||||
if (list.tagCount() == 0) {
|
||||
this.setDead();
|
||||
}
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
NBTTagList itemlist = new NBTTagList();
|
||||
|
||||
for (ItemStack stack : items) {
|
||||
NBTTagCompound itemtag = stack.writeToNBT(new NBTTagCompound());
|
||||
itemlist.appendTag(itemtag);
|
||||
}
|
||||
|
||||
tag.setTag(ITEMTAG, itemlist);
|
||||
watchstack.setTagCompound(tag);
|
||||
|
||||
this.setEntityItemStack(watchstack);
|
||||
|
||||
this.lifespan = 18000;
|
||||
this.delayBeforeCanPickup = 20;
|
||||
this.isImmuneToFire = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean combineItems(EntityItem other) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// and the big one!
|
||||
@Override
|
||||
public void onCollideWithPlayer(EntityPlayer player)
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.delayBeforeCanPickup > 0)
|
||||
{
|
||||
|
||||
// default constructors
|
||||
public EntityCollationItem(World world, double x, double y, double z, ItemStack stack) {
|
||||
super(world, x, y, z, stack);
|
||||
}
|
||||
|
||||
public EntityCollationItem(World world, double x, double y, double z) {
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
public EntityCollationItem(World world) {
|
||||
super(world);
|
||||
}
|
||||
// end that junk
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
ItemStack stack = this.getEntityItem();
|
||||
NBTTagList list = stack.getTagCompound().getTagList(ITEMTAG, 10);
|
||||
if (list.tagCount() == 0) {
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean combineItems(EntityItem other) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// and the big one!
|
||||
@Override
|
||||
public void onCollideWithPlayer(EntityPlayer player) {
|
||||
if (!this.worldObj.isRemote) {
|
||||
if (this.delayBeforeCanPickup > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityItemPickupEvent event = new EntityItemPickupEvent(player, this);
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
if (MinecraftForge.EVENT_BUS.post(event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String owner = this.func_145798_i();
|
||||
|
||||
|
||||
ItemStack basestack = this.getEntityItem();
|
||||
NBTTagList list = basestack.getTagCompound().getTagList(ITEMTAG, 10);
|
||||
List<Integer> removed = new ArrayList<Integer>();
|
||||
|
||||
for (int i=0; i<list.tagCount(); i++) {
|
||||
|
||||
ItemStack itemstack = ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i));
|
||||
|
||||
if (this.delayBeforeCanPickup <= 0
|
||||
&& (owner == null || lifespan - this.age <= 200 || owner.equals(player.getCommandSenderName()))
|
||||
&& (event.getResult() == Result.ALLOW || player.inventory.addItemStackToInventory(itemstack)))
|
||||
{
|
||||
if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log))
|
||||
{
|
||||
player.triggerAchievement(AchievementList.mineWood);
|
||||
}
|
||||
|
||||
if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log2))
|
||||
{
|
||||
player.triggerAchievement(AchievementList.mineWood);
|
||||
}
|
||||
|
||||
if (itemstack.getItem() == Items.leather)
|
||||
{
|
||||
player.triggerAchievement(AchievementList.killCow);
|
||||
}
|
||||
|
||||
if (itemstack.getItem() == Items.diamond)
|
||||
{
|
||||
player.triggerAchievement(AchievementList.diamonds);
|
||||
}
|
||||
|
||||
if (itemstack.getItem() == Items.blaze_rod)
|
||||
{
|
||||
player.triggerAchievement(AchievementList.blazeRod);
|
||||
}
|
||||
|
||||
if (itemstack.getItem() == Items.diamond && this.func_145800_j() != null)
|
||||
{
|
||||
EntityPlayer entityplayer1 = this.worldObj.getPlayerEntityByName(this.func_145800_j());
|
||||
|
||||
if (entityplayer1 != null && entityplayer1 != player)
|
||||
{
|
||||
entityplayer1.triggerAchievement(AchievementList.field_150966_x);
|
||||
}
|
||||
}
|
||||
|
||||
FMLCommonHandler.instance().firePlayerItemPickupEvent(player, this);
|
||||
|
||||
this.worldObj.playSoundAtEntity(player, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
//player.onItemPickup(this, itemstack.stackSize);
|
||||
|
||||
if (itemstack.stackSize <= 0)
|
||||
{
|
||||
removed.add(0, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<removed.size(); i++) {
|
||||
int index = removed.get(i);
|
||||
list.removeTag(index);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
|
||||
ItemStack itemstack = ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i));
|
||||
|
||||
if (this.delayBeforeCanPickup <= 0
|
||||
&& (owner == null || lifespan - this.age <= 200 || owner.equals(player.getCommandSenderName()))
|
||||
&& (event.getResult() == Result.ALLOW || player.inventory.addItemStackToInventory(itemstack))) {
|
||||
if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log)) {
|
||||
player.triggerAchievement(AchievementList.mineWood);
|
||||
}
|
||||
|
||||
if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log2)) {
|
||||
player.triggerAchievement(AchievementList.mineWood);
|
||||
}
|
||||
|
||||
if (itemstack.getItem() == Items.leather) {
|
||||
player.triggerAchievement(AchievementList.killCow);
|
||||
}
|
||||
|
||||
if (itemstack.getItem() == Items.diamond) {
|
||||
player.triggerAchievement(AchievementList.diamonds);
|
||||
}
|
||||
|
||||
if (itemstack.getItem() == Items.blaze_rod) {
|
||||
player.triggerAchievement(AchievementList.blazeRod);
|
||||
}
|
||||
|
||||
if (itemstack.getItem() == Items.diamond && this.func_145800_j() != null) {
|
||||
EntityPlayer entityplayer1 = this.worldObj.getPlayerEntityByName(this.func_145800_j());
|
||||
|
||||
if (entityplayer1 != null && entityplayer1 != player) {
|
||||
entityplayer1.triggerAchievement(AchievementList.field_150966_x);
|
||||
}
|
||||
}
|
||||
|
||||
FMLCommonHandler.instance().firePlayerItemPickupEvent(player, this);
|
||||
|
||||
this.worldObj.playSoundAtEntity(
|
||||
player,
|
||||
"random.pop",
|
||||
0.2F,
|
||||
((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
// player.onItemPickup(this, itemstack.stackSize);
|
||||
|
||||
if (itemstack.stackSize <= 0) {
|
||||
removed.add(0, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < removed.size(); i++) {
|
||||
int index = removed.get(i);
|
||||
list.removeTag(index);
|
||||
}
|
||||
|
||||
if (list.tagCount() == 0) {
|
||||
this.setDead();
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
|
||||
this.setEntityItemStack(basestack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package fox.spiteful.avaritia.entity;
|
||||
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.passive.EntityChicken;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
@@ -12,42 +10,51 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class EntityEndestPearl extends EntityThrowable {
|
||||
|
||||
public EntityEndestPearl(World world, double x, double y, double z) {
|
||||
super(world, x, y, z);
|
||||
}
|
||||
public EntityEndestPearl(World world, double x, double y, double z) {
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
public EntityEndestPearl(World world, EntityLivingBase ent) {
|
||||
super(world, ent);
|
||||
}
|
||||
public EntityEndestPearl(World world, EntityLivingBase ent) {
|
||||
super(world, ent);
|
||||
}
|
||||
|
||||
public EntityEndestPearl(World world) {
|
||||
super(world);
|
||||
}
|
||||
public EntityEndestPearl(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition pos) {
|
||||
if (pos.entityHit != null)
|
||||
{
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition pos) {
|
||||
if (pos.entityHit != null) {
|
||||
pos.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 100; ++i)
|
||||
{
|
||||
this.worldObj.spawnParticle("portal", this.posX, this.posY, this.posZ, this.rand.nextGaussian()*3, this.rand.nextGaussian()*3, this.rand.nextGaussian()*3);
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
this.worldObj.spawnParticle(
|
||||
"portal",
|
||||
this.posX,
|
||||
this.posY,
|
||||
this.posZ,
|
||||
this.rand.nextGaussian() * 3,
|
||||
this.rand.nextGaussian() * 3,
|
||||
this.rand.nextGaussian() * 3);
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
//this.worldObj.createExplosion(this, pos.hitVec.xCoord, pos.hitVec.yCoord, pos.hitVec.zCoord, 4.0f, true);
|
||||
if (!this.worldObj.isRemote) {
|
||||
// this.worldObj.createExplosion(this, pos.hitVec.xCoord, pos.hitVec.yCoord, pos.hitVec.zCoord, 4.0f, true);
|
||||
|
||||
Entity ent = new EntityGapingVoid(this.worldObj);
|
||||
//Entity ent = new EntityChicken(this.worldObj);
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(pos.sideHit);
|
||||
ent.setLocationAndAngles(this.posX + dir.offsetX*0.25, this.posY + dir.offsetY*0.25, this.posZ + dir.offsetZ*0.25, this.rotationYaw, 0.0F);
|
||||
Entity ent = new EntityGapingVoid(this.worldObj);
|
||||
// Entity ent = new EntityChicken(this.worldObj);
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(pos.sideHit);
|
||||
ent.setLocationAndAngles(
|
||||
this.posX + dir.offsetX * 0.25,
|
||||
this.posY + dir.offsetY * 0.25,
|
||||
this.posZ + dir.offsetZ * 0.25,
|
||||
this.rotationYaw,
|
||||
0.0F);
|
||||
this.worldObj.spawnEntityInWorld(ent);
|
||||
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,243 +3,267 @@ package fox.spiteful.avaritia.entity;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.command.IEntitySelector;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class EntityGapingVoid extends Entity {
|
||||
|
||||
private static Random randy = new Random();
|
||||
public static final int maxLifetime = 186;
|
||||
public static double collapse = .95;
|
||||
public static double suckrange = 20.0;
|
||||
|
||||
public static final IEntitySelector sucklector = new IEntitySelector() {
|
||||
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity ent) {
|
||||
if (ent instanceof EntityPlayer) {
|
||||
EntityPlayer p = (EntityPlayer)ent;
|
||||
if (p.capabilities.isCreativeMode && p.capabilities.isFlying) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public static final IEntitySelector nomlector = new IEntitySelector() {
|
||||
private static Random randy = new Random();
|
||||
public static final int maxLifetime = 186;
|
||||
public static double collapse = .95;
|
||||
public static double suckrange = 20.0;
|
||||
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity ent) {
|
||||
if(!(ent instanceof EntityLivingBase)) { return false; }
|
||||
|
||||
if (ent instanceof EntityPlayer) {
|
||||
EntityPlayer p = (EntityPlayer)ent;
|
||||
if (p.capabilities.isCreativeMode) {
|
||||
return false;
|
||||
}
|
||||
} else if (ent instanceof EntityImmortalItem) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public EntityGapingVoid(World world) {
|
||||
super(world);
|
||||
this.isImmuneToFire = true;
|
||||
this.setSize(0.1F, 0.1F);
|
||||
this.ignoreFrustumCheck = true;
|
||||
this.renderDistanceWeight = 100.0;
|
||||
}
|
||||
public static final IEntitySelector sucklector = new IEntitySelector() {
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
dataWatcher.addObject(12, 0);
|
||||
dataWatcher.setObjectWatched(12);
|
||||
}
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity ent) {
|
||||
if (ent instanceof EntityPlayer) {
|
||||
EntityPlayer p = (EntityPlayer) ent;
|
||||
if (p.capabilities.isCreativeMode && p.capabilities.isFlying) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
// tick, tock
|
||||
int age = this.getAge();
|
||||
|
||||
if (age >= maxLifetime) {
|
||||
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 6.0f, true);
|
||||
this.setDead();
|
||||
} else {
|
||||
if (age == 0) {
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "Avaritia:gapingVoid", 8.0F, 1.0F);
|
||||
}
|
||||
this.setAge(age+1);
|
||||
}
|
||||
|
||||
// poot poot
|
||||
double particlespeed = 4.5;
|
||||
|
||||
double size = getVoidScale(age)*0.5 - 0.2;
|
||||
for(int i=0; i<50; i++) {
|
||||
Vec3 pootdir = Vec3.createVectorHelper(0, 0, size);
|
||||
pootdir.rotateAroundY(randy.nextFloat()*180f);
|
||||
pootdir.rotateAroundX(randy.nextFloat()*360f);
|
||||
|
||||
Vec3 pootspeed = pootdir.normalize();
|
||||
pootspeed.xCoord *= particlespeed;
|
||||
pootspeed.yCoord *= particlespeed;
|
||||
pootspeed.zCoord *= particlespeed;
|
||||
|
||||
this.worldObj.spawnParticle("portal", this.posX + pootdir.xCoord, this.posY + pootdir.yCoord, this.posZ + pootdir.zCoord, pootspeed.xCoord, pootspeed.yCoord, pootspeed.zCoord);
|
||||
}
|
||||
|
||||
// *slurping noises*
|
||||
AxisAlignedBB suckzone = AxisAlignedBB.getBoundingBox(this.posX - suckrange, this.posY - suckrange, this.posZ - suckrange, this.posX + suckrange, this.posY + suckrange, this.posZ + suckrange);
|
||||
List<Entity> sucked = this.worldObj.selectEntitiesWithinAABB(Entity.class, suckzone, sucklector);
|
||||
|
||||
double radius = getVoidScale(age)*0.5;
|
||||
|
||||
for (Entity suckee : sucked) {
|
||||
if (suckee != this) {
|
||||
double dx = this.posX - suckee.posX;
|
||||
double dy = this.posY - suckee.posY;
|
||||
double dz = this.posZ - suckee.posZ;
|
||||
|
||||
double lensquared = dx*dx + dy*dy + dz*dz;
|
||||
double len = Math.sqrt(lensquared);
|
||||
double lenn = len/suckrange;
|
||||
|
||||
if (len <= suckrange) {
|
||||
double strength = (1-lenn)*(1-lenn);
|
||||
double power = 0.075 * radius;
|
||||
|
||||
suckee.motionX += (dx/len)*strength*power;
|
||||
suckee.motionY += (dy/len)*strength*power;
|
||||
suckee.motionZ += (dz/len)*strength*power;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// om nom nom
|
||||
double nomrange = radius*0.95;
|
||||
AxisAlignedBB nomzone = AxisAlignedBB.getBoundingBox(this.posX - nomrange, this.posY - nomrange, this.posZ - nomrange, this.posX + nomrange, this.posY + nomrange, this.posZ + nomrange);
|
||||
List<Entity> nommed = this.worldObj.selectEntitiesWithinAABB(EntityLivingBase.class, nomzone, nomlector);
|
||||
|
||||
for (Entity nommee : nommed) {
|
||||
if (nommee != this) {
|
||||
double dx = this.posX - nommee.posX;
|
||||
double dy = this.posY - nommee.posY;
|
||||
double dz = this.posZ - nommee.posZ;
|
||||
|
||||
double lensquared = dx*dx + dy*dy + dz*dz;
|
||||
double len = Math.sqrt(lensquared);
|
||||
|
||||
if (len <= nomrange) {
|
||||
nommee.attackEntityFrom(DamageSource.outOfWorld, 3.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// every half second, SMASH STUFF
|
||||
if (age % 10 == 0) {
|
||||
int bx = (int) Math.floor(this.posX);
|
||||
int by = (int) Math.floor(this.posY);
|
||||
int bz = (int) Math.floor(this.posZ);
|
||||
|
||||
int blockrange = (int) Math.round(nomrange);
|
||||
int lx,ly,lz;
|
||||
|
||||
for (int y = -blockrange; y <= blockrange; y++) {
|
||||
for (int z = -blockrange; z <= blockrange; z++) {
|
||||
for (int x = -blockrange; x <= blockrange; x++) {
|
||||
lx = bx+x;
|
||||
ly = by+y;
|
||||
lz = bz+z;
|
||||
|
||||
if (ly < 0 || ly > 255) {
|
||||
continue;
|
||||
}
|
||||
|
||||
double dist = Math.sqrt(x*x+y*y+z*z);
|
||||
if (dist <= nomrange && !this.worldObj.isAirBlock(lx, ly, lz)) {
|
||||
Block b = this.worldObj.getBlock(lx, ly, lz);
|
||||
int meta = this.worldObj.getBlockMetadata(lx, ly, lz);
|
||||
float resist = b.getExplosionResistance(this, this.worldObj, lx, ly, lz, this.posX, this.posY, this.posZ);
|
||||
if (resist <= 10.0) {
|
||||
b.dropBlockAsItemWithChance(worldObj, lx, ly, lz, meta, 0.9f, 0);
|
||||
this.worldObj.setBlockToAir(lx, ly, lz);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private void setAge(int age) {
|
||||
dataWatcher.updateObject(12, age);
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
return dataWatcher.getWatchableObjectInt(12);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound tag) {
|
||||
this.setAge(tag.getInteger("age"));
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger("age", this.getAge());
|
||||
}
|
||||
|
||||
public static double getVoidScale(double age) {
|
||||
double life = age / (double)maxLifetime;
|
||||
|
||||
double curve;
|
||||
if (life < collapse) {
|
||||
curve = 0.005 + ease(1-((collapse-life)/collapse))* 0.995;
|
||||
} else {
|
||||
curve = ease(1-((life-collapse)/(1-collapse)));
|
||||
}
|
||||
return 10.0*curve;
|
||||
}
|
||||
|
||||
private static double ease(double in) {
|
||||
double t = in-1;
|
||||
return Math.sqrt(1 - t*t);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getShadowSize()
|
||||
{
|
||||
public static final IEntitySelector nomlector = new IEntitySelector() {
|
||||
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity ent) {
|
||||
if (!(ent instanceof EntityLivingBase)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ent instanceof EntityPlayer) {
|
||||
EntityPlayer p = (EntityPlayer) ent;
|
||||
if (p.capabilities.isCreativeMode) {
|
||||
return false;
|
||||
}
|
||||
} else if (ent instanceof EntityImmortalItem) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public EntityGapingVoid(World world) {
|
||||
super(world);
|
||||
this.isImmuneToFire = true;
|
||||
this.setSize(0.1F, 0.1F);
|
||||
this.ignoreFrustumCheck = true;
|
||||
this.renderDistanceWeight = 100.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
dataWatcher.addObject(12, 0);
|
||||
dataWatcher.setObjectWatched(12);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
// tick, tock
|
||||
int age = this.getAge();
|
||||
|
||||
if (age >= maxLifetime) {
|
||||
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 6.0f, true);
|
||||
this.setDead();
|
||||
} else {
|
||||
if (age == 0) {
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "Avaritia:gapingVoid", 8.0F, 1.0F);
|
||||
}
|
||||
this.setAge(age + 1);
|
||||
}
|
||||
|
||||
// poot poot
|
||||
double particlespeed = 4.5;
|
||||
|
||||
double size = getVoidScale(age) * 0.5 - 0.2;
|
||||
for (int i = 0; i < 50; i++) {
|
||||
Vec3 pootdir = Vec3.createVectorHelper(0, 0, size);
|
||||
pootdir.rotateAroundY(randy.nextFloat() * 180f);
|
||||
pootdir.rotateAroundX(randy.nextFloat() * 360f);
|
||||
|
||||
Vec3 pootspeed = pootdir.normalize();
|
||||
pootspeed.xCoord *= particlespeed;
|
||||
pootspeed.yCoord *= particlespeed;
|
||||
pootspeed.zCoord *= particlespeed;
|
||||
|
||||
this.worldObj.spawnParticle(
|
||||
"portal",
|
||||
this.posX + pootdir.xCoord,
|
||||
this.posY + pootdir.yCoord,
|
||||
this.posZ + pootdir.zCoord,
|
||||
pootspeed.xCoord,
|
||||
pootspeed.yCoord,
|
||||
pootspeed.zCoord);
|
||||
}
|
||||
|
||||
// *slurping noises*
|
||||
AxisAlignedBB suckzone = AxisAlignedBB.getBoundingBox(
|
||||
this.posX - suckrange,
|
||||
this.posY - suckrange,
|
||||
this.posZ - suckrange,
|
||||
this.posX + suckrange,
|
||||
this.posY + suckrange,
|
||||
this.posZ + suckrange);
|
||||
List<Entity> sucked = this.worldObj.selectEntitiesWithinAABB(Entity.class, suckzone, sucklector);
|
||||
|
||||
double radius = getVoidScale(age) * 0.5;
|
||||
|
||||
for (Entity suckee : sucked) {
|
||||
if (suckee != this) {
|
||||
double dx = this.posX - suckee.posX;
|
||||
double dy = this.posY - suckee.posY;
|
||||
double dz = this.posZ - suckee.posZ;
|
||||
|
||||
double lensquared = dx * dx + dy * dy + dz * dz;
|
||||
double len = Math.sqrt(lensquared);
|
||||
double lenn = len / suckrange;
|
||||
|
||||
if (len <= suckrange) {
|
||||
double strength = (1 - lenn) * (1 - lenn);
|
||||
double power = 0.075 * radius;
|
||||
|
||||
suckee.motionX += (dx / len) * strength * power;
|
||||
suckee.motionY += (dy / len) * strength * power;
|
||||
suckee.motionZ += (dz / len) * strength * power;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// om nom nom
|
||||
double nomrange = radius * 0.95;
|
||||
AxisAlignedBB nomzone = AxisAlignedBB.getBoundingBox(
|
||||
this.posX - nomrange,
|
||||
this.posY - nomrange,
|
||||
this.posZ - nomrange,
|
||||
this.posX + nomrange,
|
||||
this.posY + nomrange,
|
||||
this.posZ + nomrange);
|
||||
List<Entity> nommed = this.worldObj.selectEntitiesWithinAABB(EntityLivingBase.class, nomzone, nomlector);
|
||||
|
||||
for (Entity nommee : nommed) {
|
||||
if (nommee != this) {
|
||||
double dx = this.posX - nommee.posX;
|
||||
double dy = this.posY - nommee.posY;
|
||||
double dz = this.posZ - nommee.posZ;
|
||||
|
||||
double lensquared = dx * dx + dy * dy + dz * dz;
|
||||
double len = Math.sqrt(lensquared);
|
||||
|
||||
if (len <= nomrange) {
|
||||
nommee.attackEntityFrom(DamageSource.outOfWorld, 3.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// every half second, SMASH STUFF
|
||||
if (age % 10 == 0) {
|
||||
int bx = (int) Math.floor(this.posX);
|
||||
int by = (int) Math.floor(this.posY);
|
||||
int bz = (int) Math.floor(this.posZ);
|
||||
|
||||
int blockrange = (int) Math.round(nomrange);
|
||||
int lx, ly, lz;
|
||||
|
||||
for (int y = -blockrange; y <= blockrange; y++) {
|
||||
for (int z = -blockrange; z <= blockrange; z++) {
|
||||
for (int x = -blockrange; x <= blockrange; x++) {
|
||||
lx = bx + x;
|
||||
ly = by + y;
|
||||
lz = bz + z;
|
||||
|
||||
if (ly < 0 || ly > 255) {
|
||||
continue;
|
||||
}
|
||||
|
||||
double dist = Math.sqrt(x * x + y * y + z * z);
|
||||
if (dist <= nomrange && !this.worldObj.isAirBlock(lx, ly, lz)) {
|
||||
Block b = this.worldObj.getBlock(lx, ly, lz);
|
||||
int meta = this.worldObj.getBlockMetadata(lx, ly, lz);
|
||||
float resist = b.getExplosionResistance(
|
||||
this,
|
||||
this.worldObj,
|
||||
lx,
|
||||
ly,
|
||||
lz,
|
||||
this.posX,
|
||||
this.posY,
|
||||
this.posZ);
|
||||
if (resist <= 10.0) {
|
||||
b.dropBlockAsItemWithChance(worldObj, lx, ly, lz, meta, 0.9f, 0);
|
||||
this.worldObj.setBlockToAir(lx, ly, lz);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setAge(int age) {
|
||||
dataWatcher.updateObject(12, age);
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
return dataWatcher.getWatchableObjectInt(12);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound tag) {
|
||||
this.setAge(tag.getInteger("age"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger("age", this.getAge());
|
||||
}
|
||||
|
||||
public static double getVoidScale(double age) {
|
||||
double life = age / (double) maxLifetime;
|
||||
|
||||
double curve;
|
||||
if (life < collapse) {
|
||||
curve = 0.005 + ease(1 - ((collapse - life) / collapse)) * 0.995;
|
||||
} else {
|
||||
curve = ease(1 - ((life - collapse) / (1 - collapse)));
|
||||
}
|
||||
return 10.0 * curve;
|
||||
}
|
||||
|
||||
private static double ease(double in) {
|
||||
double t = in - 1;
|
||||
return Math.sqrt(1 - t * t);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getShadowSize() {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeCollidedWith()
|
||||
{
|
||||
@Override
|
||||
public boolean canBeCollidedWith() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3,127 +3,127 @@ package fox.spiteful.avaritia.entity;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
|
||||
public class EntityHeavenArrow extends EntityArrow {
|
||||
public static Field inGroundField;
|
||||
public static Field ticksInGroundField;
|
||||
static {
|
||||
|
||||
public static Field inGroundField;
|
||||
public static Field ticksInGroundField;
|
||||
static {
|
||||
try {
|
||||
inGroundField = ReflectionHelper.findField(EntityArrow.class, "inGround", "field_70254_i");
|
||||
ticksInGroundField = ReflectionHelper.findField(EntityArrow.class, "ticksInGround", "field_70252_j");
|
||||
}
|
||||
catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
Lumberjack.log(Level.ERROR, e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean impacted = false;
|
||||
public Random randy = new Random();
|
||||
|
||||
public EntityHeavenArrow(World world, double x, double y, double z) {
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
public EntityHeavenArrow(World world, EntityLivingBase entity, EntityLivingBase entity2, float something, float otherthing) {
|
||||
super(world, entity, entity2, something, otherthing);
|
||||
}
|
||||
public boolean impacted = false;
|
||||
public Random randy = new Random();
|
||||
|
||||
public EntityHeavenArrow(World world, EntityLivingBase entity, float something) {
|
||||
super(world, entity, something);
|
||||
|
||||
}
|
||||
public EntityHeavenArrow(World world, double x, double y, double z) {
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
public EntityHeavenArrow(World world) {
|
||||
super(world);
|
||||
}
|
||||
public EntityHeavenArrow(World world, EntityLivingBase entity, EntityLivingBase entity2, float something,
|
||||
float otherthing) {
|
||||
super(world, entity, entity2, something, otherthing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
this.rotationPitch = 0;
|
||||
this.rotationYaw = 0;
|
||||
super.onUpdate();
|
||||
if (!this.impacted) {
|
||||
try {
|
||||
if (inGroundField.getBoolean(this)) {
|
||||
this.impacted = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (this.impacted) {
|
||||
if (!this.worldObj.isRemote) {
|
||||
this.barrage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (getInGround(this) && getTicksInGround(this) >= 100) {
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeEntityToNBT(tag);
|
||||
public EntityHeavenArrow(World world, EntityLivingBase entity, float something) {
|
||||
super(world, entity, something);
|
||||
|
||||
}
|
||||
|
||||
public EntityHeavenArrow(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
this.rotationPitch = 0;
|
||||
this.rotationYaw = 0;
|
||||
super.onUpdate();
|
||||
if (!this.impacted) {
|
||||
try {
|
||||
if (inGroundField.getBoolean(this)) {
|
||||
this.impacted = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (this.impacted) {
|
||||
if (!this.worldObj.isRemote) {
|
||||
this.barrage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (getInGround(this) && getTicksInGround(this) >= 100) {
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound tag) {
|
||||
super.writeEntityToNBT(tag);
|
||||
tag.setBoolean("impacted", this.impacted);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
public void readEntityFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readEntityFromNBT(tag);
|
||||
this.impacted = tag.getBoolean("impacted");
|
||||
public void readEntityFromNBT(NBTTagCompound tag) {
|
||||
super.readEntityFromNBT(tag);
|
||||
this.impacted = tag.getBoolean("impacted");
|
||||
}
|
||||
|
||||
|
||||
public static boolean getInGround(EntityArrow arrow) {
|
||||
try {
|
||||
return inGroundField.getBoolean(arrow);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return inGroundField.getBoolean(arrow);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static int getTicksInGround(EntityArrow arrow) {
|
||||
try {
|
||||
return ticksInGroundField.getInt(arrow);
|
||||
} catch (Exception e) {
|
||||
return 0;
|
||||
}
|
||||
try {
|
||||
return ticksInGroundField.getInt(arrow);
|
||||
} catch (Exception e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void barrage() {
|
||||
for (int i=0; i<35; i++) {
|
||||
double angle = randy.nextDouble() * 2 * Math.PI;
|
||||
double dist = randy.nextGaussian()*0.75;
|
||||
|
||||
double x = Math.sin(angle) * dist + this.posX;
|
||||
double z = Math.cos(angle) * dist + this.posZ;
|
||||
double y = this.posY + 25.0;
|
||||
|
||||
double dangle = randy.nextDouble() * 2 * Math.PI;
|
||||
double ddist = randy.nextDouble()*0.35;
|
||||
double dx = Math.sin(dangle) * ddist;
|
||||
double dz = Math.cos(dangle) * ddist;
|
||||
|
||||
EntityArrow arrow = new EntityHeavenSubArrow(this.worldObj, x,y,z);
|
||||
arrow.shootingEntity = this.shootingEntity;
|
||||
arrow.addVelocity(dx, -(randy.nextDouble()*1.85 + 0.15), dz);
|
||||
arrow.setDamage(this.getDamage());
|
||||
arrow.setIsCritical(true);
|
||||
|
||||
this.worldObj.spawnEntityInWorld(arrow);
|
||||
}
|
||||
for (int i = 0; i < 35; i++) {
|
||||
double angle = randy.nextDouble() * 2 * Math.PI;
|
||||
double dist = randy.nextGaussian() * 0.75;
|
||||
|
||||
double x = Math.sin(angle) * dist + this.posX;
|
||||
double z = Math.cos(angle) * dist + this.posZ;
|
||||
double y = this.posY + 25.0;
|
||||
|
||||
double dangle = randy.nextDouble() * 2 * Math.PI;
|
||||
double ddist = randy.nextDouble() * 0.35;
|
||||
double dx = Math.sin(dangle) * ddist;
|
||||
double dz = Math.cos(dangle) * ddist;
|
||||
|
||||
EntityArrow arrow = new EntityHeavenSubArrow(this.worldObj, x, y, z);
|
||||
arrow.shootingEntity = this.shootingEntity;
|
||||
arrow.addVelocity(dx, -(randy.nextDouble() * 1.85 + 0.15), dz);
|
||||
arrow.setDamage(this.getDamage());
|
||||
arrow.setIsCritical(true);
|
||||
|
||||
this.worldObj.spawnEntityInWorld(arrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,31 +5,33 @@ import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityHeavenSubArrow extends EntityArrow {
|
||||
public EntityHeavenSubArrow(World world, double x, double y, double z) {
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
public EntityHeavenSubArrow(World world, EntityLivingBase entity, EntityLivingBase entity2, float something, float otherthing) {
|
||||
super(world, entity, entity2, something, otherthing);
|
||||
}
|
||||
public EntityHeavenSubArrow(World world, double x, double y, double z) {
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
public EntityHeavenSubArrow(World world, EntityLivingBase entity, float something) {
|
||||
super(world, entity, something);
|
||||
|
||||
}
|
||||
public EntityHeavenSubArrow(World world, EntityLivingBase entity, EntityLivingBase entity2, float something,
|
||||
float otherthing) {
|
||||
super(world, entity, entity2, something, otherthing);
|
||||
}
|
||||
|
||||
public EntityHeavenSubArrow(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
this.rotationPitch = 0;
|
||||
this.rotationYaw = 0;
|
||||
super.onUpdate();
|
||||
|
||||
if (EntityHeavenArrow.getInGround(this) && EntityHeavenArrow.getTicksInGround(this) >= 20) {
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
public EntityHeavenSubArrow(World world, EntityLivingBase entity, float something) {
|
||||
super(world, entity, something);
|
||||
|
||||
}
|
||||
|
||||
public EntityHeavenSubArrow(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
this.rotationPitch = 0;
|
||||
this.rotationYaw = 0;
|
||||
super.onUpdate();
|
||||
|
||||
if (EntityHeavenArrow.getInGround(this) && EntityHeavenArrow.getTicksInGround(this) >= 20) {
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,64 +12,56 @@ import net.minecraft.world.World;
|
||||
|
||||
public class EntityImmortalItem extends EntityItem {
|
||||
|
||||
public EntityImmortalItem(World world, Entity original, ItemStack stack) {
|
||||
this(world, original.posX, original.posY, original.posZ, stack);
|
||||
this.delayBeforeCanPickup = 20;
|
||||
public EntityImmortalItem(World world, Entity original, ItemStack stack) {
|
||||
this(world, original.posX, original.posY, original.posZ, stack);
|
||||
this.delayBeforeCanPickup = 20;
|
||||
this.motionX = original.motionX;
|
||||
this.motionY = original.motionY;
|
||||
this.motionZ = original.motionZ;
|
||||
this.setEntityItemStack(stack);
|
||||
}
|
||||
|
||||
public EntityImmortalItem(World world, double x, double y, double z, ItemStack stack) {
|
||||
super(world, x, y, z);
|
||||
this.setEntityItemStack(stack);
|
||||
}
|
||||
}
|
||||
|
||||
public EntityImmortalItem(World world, double x, double y, double z) {
|
||||
super(world, x, y, z);
|
||||
this.isImmuneToFire = true;
|
||||
}
|
||||
public EntityImmortalItem(World world, double x, double y, double z, ItemStack stack) {
|
||||
super(world, x, y, z);
|
||||
this.setEntityItemStack(stack);
|
||||
}
|
||||
|
||||
public EntityImmortalItem(World world) {
|
||||
super(world);
|
||||
this.isImmuneToFire = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dealFireDamage(int damage) {}
|
||||
public EntityImmortalItem(World world, double x, double y, double z) {
|
||||
super(world, x, y, z);
|
||||
this.isImmuneToFire = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float damage)
|
||||
{
|
||||
if (source.getDamageType().equals("outOfWorld")) {
|
||||
return true;
|
||||
}
|
||||
public EntityImmortalItem(World world) {
|
||||
super(world);
|
||||
this.isImmuneToFire = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dealFireDamage(int damage) {}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float damage) {
|
||||
if (source.getDamageType().equals("outOfWorld")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
ItemStack stack = this.getDataWatcher().getWatchableObjectItemStack(10);
|
||||
if (stack != null && stack.getItem() != null)
|
||||
{
|
||||
if (stack.getItem().onEntityItemUpdate(this))
|
||||
{
|
||||
if (stack != null && stack.getItem() != null) {
|
||||
if (stack.getItem().onEntityItemUpdate(this)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getEntityItem() == null)
|
||||
{
|
||||
if (this.getEntityItem() == null) {
|
||||
this.setDead();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
super.onUpdate();
|
||||
|
||||
if (this.delayBeforeCanPickup > 0)
|
||||
{
|
||||
if (this.delayBeforeCanPickup > 0) {
|
||||
--this.delayBeforeCanPickup;
|
||||
}
|
||||
|
||||
@@ -77,82 +69,75 @@ public class EntityImmortalItem extends EntityItem {
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
this.motionY -= 0.03999999910593033D;
|
||||
this.noClip = this.func_145771_j(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, this.posZ);
|
||||
this.noClip = this
|
||||
.func_145771_j(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, this.posZ);
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
boolean flag = (int)this.prevPosX != (int)this.posX || (int)this.prevPosY != (int)this.posY || (int)this.prevPosZ != (int)this.posZ;
|
||||
boolean flag = (int) this.prevPosX != (int) this.posX || (int) this.prevPosY != (int) this.posY
|
||||
|| (int) this.prevPosZ != (int) this.posZ;
|
||||
|
||||
if (flag || this.ticksExisted % 25 == 0)
|
||||
{
|
||||
if (this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)).getMaterial() == Material.lava)
|
||||
{
|
||||
if (flag || this.ticksExisted % 25 == 0) {
|
||||
if (this.worldObj.getBlock(
|
||||
MathHelper.floor_double(this.posX),
|
||||
MathHelper.floor_double(this.posY),
|
||||
MathHelper.floor_double(this.posZ)).getMaterial() == Material.lava) {
|
||||
this.motionY = 0.20000000298023224D;
|
||||
this.motionX = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
|
||||
this.motionZ = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
|
||||
this.motionX = (double) ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
|
||||
this.motionZ = (double) ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
|
||||
this.playSound("random.fizz", 0.4F, 2.0F + this.rand.nextFloat() * 0.4F);
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (!this.worldObj.isRemote) {
|
||||
this.searchForOtherItemsNearby2();
|
||||
}
|
||||
}
|
||||
|
||||
float f = 0.98F;
|
||||
|
||||
if (this.onGround)
|
||||
{
|
||||
f = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.98F;
|
||||
if (this.onGround) {
|
||||
f = this.worldObj.getBlock(
|
||||
MathHelper.floor_double(this.posX),
|
||||
MathHelper.floor_double(this.boundingBox.minY) - 1,
|
||||
MathHelper.floor_double(this.posZ)).slipperiness * 0.98F;
|
||||
}
|
||||
|
||||
this.motionX *= (double)f;
|
||||
this.motionX *= (double) f;
|
||||
this.motionY *= 0.9800000190734863D;
|
||||
this.motionZ *= (double)f;
|
||||
this.motionZ *= (double) f;
|
||||
|
||||
if (this.onGround)
|
||||
{
|
||||
if (this.onGround) {
|
||||
this.motionY *= -0.5D;
|
||||
}
|
||||
|
||||
++this.age;
|
||||
|
||||
ItemStack item = getDataWatcher().getWatchableObjectItemStack(10);
|
||||
|
||||
if (!this.worldObj.isRemote && this.age >= lifespan)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
/*ItemExpireEvent event = new ItemExpireEvent(this, (item.getItem() == null ? 6000 : item.getItem().getEntityLifespan(item, worldObj)));
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
lifespan += event.extraLife;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setDead();
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (!this.worldObj.isRemote && this.age >= lifespan) {
|
||||
if (item != null) {
|
||||
/*
|
||||
* ItemExpireEvent event = new ItemExpireEvent(this, (item.getItem() == null ? 6000 :
|
||||
* item.getItem().getEntityLifespan(item, worldObj))); if (MinecraftForge.EVENT_BUS.post(event)) {
|
||||
* lifespan += event.extraLife; } else { this.setDead(); }
|
||||
*/
|
||||
} else {
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
if (item != null && item.stackSize <= 0)
|
||||
{
|
||||
|
||||
if (item != null && item.stackSize <= 0) {
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// GODDAMNIT MOJANG
|
||||
@SuppressWarnings("rawtypes")
|
||||
private void searchForOtherItemsNearby2()
|
||||
{
|
||||
Iterator iterator = this.worldObj.getEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(0.5D, 0.0D, 0.5D)).iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
EntityItem entityitem = (EntityItem)iterator.next();
|
||||
// GODDAMNIT MOJANG
|
||||
@SuppressWarnings("rawtypes")
|
||||
private void searchForOtherItemsNearby2() {
|
||||
Iterator iterator = this.worldObj
|
||||
.getEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(0.5D, 0.0D, 0.5D)).iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityItem entityitem = (EntityItem) iterator.next();
|
||||
this.combineItems(entityitem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,11 @@ import fox.spiteful.avaritia.Avaritia;
|
||||
|
||||
public class LudicrousEntities {
|
||||
|
||||
public static void letLooseTheDogsOfWar() {
|
||||
EntityRegistry.registerModEntity(EntityEndestPearl.class, "EndestPearl", 1, Avaritia.instance, 64, 10, true);
|
||||
EntityRegistry.registerModEntity(EntityGapingVoid.class, "GapingVoid", 2, Avaritia.instance, 256, 10, false);
|
||||
EntityRegistry.registerModEntity(EntityHeavenArrow.class, "HeavenArrow", 3, Avaritia.instance, 32, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityHeavenSubArrow.class, "HeavenSubArrow", 4, Avaritia.instance, 32, 2, true);
|
||||
}
|
||||
public static void letLooseTheDogsOfWar() {
|
||||
EntityRegistry.registerModEntity(EntityEndestPearl.class, "EndestPearl", 1, Avaritia.instance, 64, 10, true);
|
||||
EntityRegistry.registerModEntity(EntityGapingVoid.class, "GapingVoid", 2, Avaritia.instance, 256, 10, false);
|
||||
EntityRegistry.registerModEntity(EntityHeavenArrow.class, "HeavenArrow", 3, Avaritia.instance, 32, 1, true);
|
||||
EntityRegistry
|
||||
.registerModEntity(EntityHeavenSubArrow.class, "HeavenSubArrow", 4, Avaritia.instance, 32, 2, true);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package fox.spiteful.avaritia.gui;
|
||||
|
||||
import fox.spiteful.avaritia.crafting.CompressorManager;
|
||||
import fox.spiteful.avaritia.tile.TileEntityCompressor;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@@ -9,94 +7,74 @@ import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.inventory.SlotFurnace;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import fox.spiteful.avaritia.crafting.CompressorManager;
|
||||
import fox.spiteful.avaritia.tile.TileEntityCompressor;
|
||||
|
||||
public class ContainerCompressor extends Container {
|
||||
|
||||
private TileEntityCompressor compressor;
|
||||
|
||||
public ContainerCompressor(InventoryPlayer player, TileEntityCompressor machine)
|
||||
{
|
||||
public ContainerCompressor(InventoryPlayer player, TileEntityCompressor machine) {
|
||||
this.compressor = machine;
|
||||
this.addSlotToContainer(new Slot(compressor, 0, 56, 27));
|
||||
this.addSlotToContainer(new SlotFurnace(player.player, machine, 1, 116, 27));
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i)
|
||||
{
|
||||
for (i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return this.compressor.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
|
||||
*/
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotNumber)
|
||||
{
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotNumber) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot)this.inventorySlots.get(slotNumber);
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotNumber);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (slotNumber == 1)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 2, 38, true))
|
||||
{
|
||||
if (slotNumber == 1) {
|
||||
if (!this.mergeItemStack(itemstack1, 2, 38, true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else if (slotNumber != 0)
|
||||
{
|
||||
if (CompressorManager.getOutput(itemstack1) != null)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 0, 1, false))
|
||||
{
|
||||
} else if (slotNumber != 0) {
|
||||
if (CompressorManager.getOutput(itemstack1) != null) {
|
||||
if (!this.mergeItemStack(itemstack1, 0, 1, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (slotNumber >= 2 && slotNumber < 29)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 29, 38, false))
|
||||
{
|
||||
} else if (slotNumber >= 2 && slotNumber < 29) {
|
||||
if (!this.mergeItemStack(itemstack1, 29, 38, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (slotNumber >= 29 && slotNumber < 38 && !this.mergeItemStack(itemstack1, 2, 29, false))
|
||||
{
|
||||
} else if (slotNumber >= 29 && slotNumber < 38 && !this.mergeItemStack(itemstack1, 2, 29, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(itemstack1, 2, 38, false))
|
||||
{
|
||||
} else if (!this.mergeItemStack(itemstack1, 2, 38, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (itemstack1.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == itemstack.stackSize)
|
||||
{
|
||||
if (itemstack1.stackSize == itemstack.stackSize) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public class ContainerCustomWorkbench extends ContainerWorkbench {
|
||||
int posZ;
|
||||
World worldObj;
|
||||
|
||||
public ContainerCustomWorkbench(InventoryPlayer inv, World world, int x, int y, int z){
|
||||
public ContainerCustomWorkbench(InventoryPlayer inv, World world, int x, int y, int z) {
|
||||
super(inv, world, x, y, z);
|
||||
posX = x;
|
||||
posY = y;
|
||||
@@ -20,8 +20,9 @@ public class ContainerCustomWorkbench extends ContainerWorkbench {
|
||||
worldObj = world;
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return this.worldObj.isAirBlock(this.posX, this.posY, this.posZ) ? false : player.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D;
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return this.worldObj.isAirBlock(this.posX, this.posY, this.posZ) ? false
|
||||
: player.getDistanceSq((double) this.posX + 0.5D, (double) this.posY + 0.5D, (double) this.posZ + 0.5D)
|
||||
<= 64.0D;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
package fox.spiteful.avaritia.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import fox.spiteful.avaritia.blocks.LudicrousBlocks;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
|
||||
import fox.spiteful.avaritia.tile.TileEntityDireCrafting;
|
||||
import fox.spiteful.avaritia.tile.inventory.InventoryDireCraftResult;
|
||||
import fox.spiteful.avaritia.tile.inventory.InventoryDireCrafting;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ContainerExtremeCrafting extends Container {
|
||||
|
||||
@@ -23,8 +22,8 @@ public class ContainerExtremeCrafting extends Container {
|
||||
private int posY;
|
||||
private int posZ;
|
||||
|
||||
public ContainerExtremeCrafting(InventoryPlayer player, World world, int x, int y, int z, TileEntityDireCrafting table)
|
||||
{
|
||||
public ContainerExtremeCrafting(InventoryPlayer player, World world, int x, int y, int z,
|
||||
TileEntityDireCrafting table) {
|
||||
this.worldObj = world;
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
@@ -35,24 +34,19 @@ public class ContainerExtremeCrafting extends Container {
|
||||
int wy;
|
||||
int ex;
|
||||
|
||||
for (wy = 0; wy < 9; ++wy)
|
||||
{
|
||||
for (ex = 0; ex < 9; ++ex)
|
||||
{
|
||||
for (wy = 0; wy < 9; ++wy) {
|
||||
for (ex = 0; ex < 9; ++ex) {
|
||||
this.addSlotToContainer(new Slot(this.craftMatrix, ex + wy * 9, 12 + ex * 18, 8 + wy * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (wy = 0; wy < 3; ++wy)
|
||||
{
|
||||
for (ex = 0; ex < 9; ++ex)
|
||||
{
|
||||
for (wy = 0; wy < 3; ++wy) {
|
||||
for (ex = 0; ex < 9; ++ex) {
|
||||
this.addSlotToContainer(new Slot(player, ex + wy * 9 + 9, 39 + ex * 18, 174 + wy * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (ex = 0; ex < 9; ++ex)
|
||||
{
|
||||
for (ex = 0; ex < 9; ++ex) {
|
||||
this.addSlotToContainer(new Slot(player, ex, 39 + ex * 18, 232));
|
||||
}
|
||||
|
||||
@@ -62,77 +56,62 @@ public class ContainerExtremeCrafting extends Container {
|
||||
/**
|
||||
* Callback for when the crafting matrix is changed.
|
||||
*/
|
||||
public void onCraftMatrixChanged(IInventory matrix)
|
||||
{
|
||||
this.craftResult.setInventorySlotContents(0, ExtremeCraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
|
||||
public void onCraftMatrixChanged(IInventory matrix) {
|
||||
this.craftResult.setInventorySlotContents(
|
||||
0,
|
||||
ExtremeCraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the container is closed.
|
||||
*/
|
||||
public void onContainerClosed(EntityPlayer player)
|
||||
{
|
||||
public void onContainerClosed(EntityPlayer player) {
|
||||
super.onContainerClosed(player);
|
||||
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return this.worldObj.getBlock(this.posX, this.posY, this.posZ) == LudicrousBlocks.dire_crafting && player.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D;
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return this.worldObj.getBlock(this.posX, this.posY, this.posZ) == LudicrousBlocks.dire_crafting
|
||||
&& player.getDistanceSq((double) this.posX + 0.5D, (double) this.posY + 0.5D, (double) this.posZ + 0.5D)
|
||||
<= 64.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
|
||||
*/
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotNumber)
|
||||
{
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotNumber) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot)this.inventorySlots.get(slotNumber);
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotNumber);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (slotNumber == 0)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 82, 118, true))
|
||||
{
|
||||
if (slotNumber == 0) {
|
||||
if (!this.mergeItemStack(itemstack1, 82, 118, true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else if (slotNumber >= 82 && slotNumber < 109)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 109, 118, false))
|
||||
{
|
||||
} else if (slotNumber >= 82 && slotNumber < 109) {
|
||||
if (!this.mergeItemStack(itemstack1, 109, 118, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (slotNumber >= 109 && slotNumber < 118)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 82, 109, false))
|
||||
{
|
||||
} else if (slotNumber >= 109 && slotNumber < 118) {
|
||||
if (!this.mergeItemStack(itemstack1, 82, 109, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(itemstack1, 82, 118, false))
|
||||
{
|
||||
} else if (!this.mergeItemStack(itemstack1, 82, 118, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (itemstack1.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == itemstack.stackSize)
|
||||
{
|
||||
if (itemstack1.stackSize == itemstack.stackSize) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,91 +1,72 @@
|
||||
package fox.spiteful.avaritia.gui;
|
||||
|
||||
import fox.spiteful.avaritia.tile.TileEntityNeutron;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.inventory.SlotFurnace;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
|
||||
import fox.spiteful.avaritia.tile.TileEntityNeutron;
|
||||
|
||||
public class ContainerNeutron extends Container {
|
||||
|
||||
private TileEntityNeutron tileNeutron;
|
||||
|
||||
public ContainerNeutron(InventoryPlayer player, TileEntityNeutron machine)
|
||||
{
|
||||
public ContainerNeutron(InventoryPlayer player, TileEntityNeutron machine) {
|
||||
this.tileNeutron = machine;
|
||||
this.addSlotToContainer(new SlotFurnace(player.player, machine, 2, 80, 35));
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i)
|
||||
{
|
||||
for (i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return this.tileNeutron.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
|
||||
*/
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotNumber)
|
||||
{
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotNumber) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot)this.inventorySlots.get(slotNumber);
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotNumber);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (slotNumber == 0)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 1, 37, true))
|
||||
{
|
||||
if (slotNumber == 0) {
|
||||
if (!this.mergeItemStack(itemstack1, 1, 37, true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (slotNumber >= 1 && slotNumber < 28)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 28, 37, false))
|
||||
{
|
||||
} else {
|
||||
if (slotNumber >= 1 && slotNumber < 28) {
|
||||
if (!this.mergeItemStack(itemstack1, 28, 37, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (slotNumber >= 28 && slotNumber < 37 && !this.mergeItemStack(itemstack1, 1, 28, false))
|
||||
{
|
||||
} else if (slotNumber >= 28 && slotNumber < 37 && !this.mergeItemStack(itemstack1, 1, 28, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (itemstack1.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == itemstack.stackSize)
|
||||
{
|
||||
if (itemstack1.stackSize == itemstack.stackSize) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -94,4 +75,4 @@ public class ContainerNeutron extends Container {
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,22 @@
|
||||
package fox.spiteful.avaritia.gui;
|
||||
|
||||
import fox.spiteful.avaritia.tile.TileEntityCompressor;
|
||||
import fox.spiteful.avaritia.tile.TileEntityNeutron;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GUICompressor extends GuiContainer
|
||||
{
|
||||
private static final ResourceLocation furnaceGuiTextures = new ResourceLocation("avaritia", "textures/gui/compressor.png");
|
||||
import fox.spiteful.avaritia.tile.TileEntityCompressor;
|
||||
|
||||
public class GUICompressor extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation furnaceGuiTextures = new ResourceLocation(
|
||||
"avaritia",
|
||||
"textures/gui/compressor.png");
|
||||
private TileEntityCompressor compressor;
|
||||
|
||||
public GUICompressor(InventoryPlayer player, TileEntityCompressor machine)
|
||||
{
|
||||
public GUICompressor(InventoryPlayer player, TileEntityCompressor machine) {
|
||||
super(new ContainerCompressor(player, machine));
|
||||
compressor = machine;
|
||||
}
|
||||
@@ -22,30 +24,29 @@ public class GUICompressor extends GuiContainer
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items)
|
||||
*/
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
|
||||
{
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
String s = StatCollector.translateToLocal("container.neutronium_compressor");
|
||||
this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
|
||||
if(compressor.getProgress() > 0) {
|
||||
if (compressor.getProgress() > 0) {
|
||||
s = compressor.getProgress() + " / " + compressor.getTarget();
|
||||
this.fontRendererObj.drawString(s, 41, 49, 4210752);
|
||||
this.fontRendererObj.drawString(compressor.getIngredient(), 41, 60, 4210752);
|
||||
}
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj
|
||||
.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
|
||||
{
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(furnaceGuiTextures);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
if(compressor.getProgress() > 0){
|
||||
if (compressor.getProgress() > 0) {
|
||||
int i1 = compressor.getProgress() * 24 / compressor.getTarget();
|
||||
this.drawTexturedModalRect(k + 79, l + 26, 176, 14, i1 + 1, 16);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +1,35 @@
|
||||
package fox.spiteful.avaritia.gui;
|
||||
|
||||
import fox.spiteful.avaritia.tile.TileEntityDireCrafting;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import fox.spiteful.avaritia.tile.TileEntityDireCrafting;
|
||||
|
||||
public class GUIExtremeCrafting extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation tex = new ResourceLocation("avaritia:textures/gui/dire_crafting_gui.png");
|
||||
|
||||
public GUIExtremeCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int x, int y, int z, TileEntityDireCrafting table)
|
||||
{
|
||||
public GUIExtremeCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int x, int y, int z,
|
||||
TileEntityDireCrafting table) {
|
||||
super(new ContainerExtremeCrafting(par1InventoryPlayer, par2World, x, y, z, table));
|
||||
this.ySize = 256;
|
||||
this.xSize = 238;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j)
|
||||
{
|
||||
//this.fontRendererObj.drawString(StatCollector.translateToLocal("container.extreme_crafting"), 28, 6, 4210752);
|
||||
//this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
// this.fontRendererObj.drawString(StatCollector.translateToLocal("container.extreme_crafting"), 28, 6,
|
||||
// 4210752);
|
||||
// this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 +
|
||||
// 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
|
||||
{
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(tex);
|
||||
int foo = (this.width - this.xSize) / 2;
|
||||
|
||||
@@ -1,36 +1,38 @@
|
||||
package fox.spiteful.avaritia.gui;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.tile.TileEntityNeutron;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GUINeutron extends GuiContainer
|
||||
{
|
||||
private static final ResourceLocation furnaceGuiTextures = new ResourceLocation("avaritia", "textures/gui/neutron_collector_gui.png");
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.tile.TileEntityNeutron;
|
||||
|
||||
public GUINeutron(InventoryPlayer player, TileEntityNeutron machine)
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GUINeutron extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation furnaceGuiTextures = new ResourceLocation(
|
||||
"avaritia",
|
||||
"textures/gui/neutron_collector_gui.png");
|
||||
|
||||
public GUINeutron(InventoryPlayer player, TileEntityNeutron machine) {
|
||||
super(new ContainerNeutron(player, machine));
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items)
|
||||
*/
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
|
||||
{
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
String s = StatCollector.translateToLocal("container.neutron_collector");
|
||||
this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj
|
||||
.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
|
||||
{
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(furnaceGuiTextures);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
@@ -38,4 +40,4 @@ public class GUINeutron extends GuiContainer
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,38 +1,46 @@
|
||||
package fox.spiteful.avaritia.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiCrafting;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import fox.spiteful.avaritia.tile.TileEntityCompressor;
|
||||
import fox.spiteful.avaritia.tile.TileEntityDireCrafting;
|
||||
import fox.spiteful.avaritia.tile.TileEntityNeutron;
|
||||
import net.minecraft.client.gui.inventory.GuiCrafting;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class GooeyHandler implements IGuiHandler {
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z){
|
||||
if(ID == 0)
|
||||
return new GuiCrafting(player.inventory, world, x, y, z);
|
||||
else if(ID == 1)
|
||||
return new GUIExtremeCrafting(player.inventory, world, x, y, z, (TileEntityDireCrafting)world.getTileEntity(x, y, z));
|
||||
else if(ID == 2)
|
||||
return new GUINeutron(player.inventory, (TileEntityNeutron)world.getTileEntity(x, y, z));
|
||||
else if(ID == 3)
|
||||
return new GUICompressor(player.inventory, (TileEntityCompressor)world.getTileEntity(x, y, z));
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
if (ID == 0) return new GuiCrafting(player.inventory, world, x, y, z);
|
||||
else if (ID == 1) return new GUIExtremeCrafting(
|
||||
player.inventory,
|
||||
world,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
(TileEntityDireCrafting) world.getTileEntity(x, y, z));
|
||||
else if (ID == 2) return new GUINeutron(player.inventory, (TileEntityNeutron) world.getTileEntity(x, y, z));
|
||||
else if (ID == 3)
|
||||
return new GUICompressor(player.inventory, (TileEntityCompressor) world.getTileEntity(x, y, z));
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z){
|
||||
if(ID == 0)
|
||||
return new ContainerCustomWorkbench(player.inventory, world, x, y, z);
|
||||
else if(ID == 1)
|
||||
return new ContainerExtremeCrafting(player.inventory, world, x, y, z, (TileEntityDireCrafting)world.getTileEntity(x, y, z));
|
||||
else if(ID == 2)
|
||||
return new ContainerNeutron(player.inventory, (TileEntityNeutron)world.getTileEntity(x, y, z));
|
||||
else if(ID == 3)
|
||||
return new ContainerCompressor(player.inventory, (TileEntityCompressor)world.getTileEntity(x, y, z));
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
if (ID == 0) return new ContainerCustomWorkbench(player.inventory, world, x, y, z);
|
||||
else if (ID == 1) return new ContainerExtremeCrafting(
|
||||
player.inventory,
|
||||
world,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
(TileEntityDireCrafting) world.getTileEntity(x, y, z));
|
||||
else if (ID == 2)
|
||||
return new ContainerNeutron(player.inventory, (TileEntityNeutron) world.getTileEntity(x, y, z));
|
||||
else if (ID == 3)
|
||||
return new ContainerCompressor(player.inventory, (TileEntityCompressor) world.getTileEntity(x, y, z));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,12 @@
|
||||
package fox.spiteful.avaritia.items;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.Config;
|
||||
import fox.spiteful.avaritia.LudicrousText;
|
||||
import fox.spiteful.avaritia.compat.Belmont;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
import fox.spiteful.avaritia.entity.EntityImmortalItem;
|
||||
import fox.spiteful.avaritia.render.ICosmicRenderItem;
|
||||
import fox.spiteful.avaritia.render.ModelArmorInfinity;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import fox.spiteful.avaritia.PotionHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -30,10 +24,6 @@ import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import thaumcraft.api.IGoggles;
|
||||
import thaumcraft.api.IVisDiscountGear;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
@@ -42,26 +32,36 @@ import vazkii.botania.api.item.IManaProficiencyArmor;
|
||||
import vazkii.botania.api.item.IPhantomInkable;
|
||||
import vazkii.botania.api.mana.IManaDiscountArmor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "thaumcraft.api.IGoggles", modid = "Thaumcraft"),
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.Config;
|
||||
import fox.spiteful.avaritia.LudicrousText;
|
||||
import fox.spiteful.avaritia.PotionHelper;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
import fox.spiteful.avaritia.entity.EntityImmortalItem;
|
||||
import fox.spiteful.avaritia.render.ICosmicRenderItem;
|
||||
import fox.spiteful.avaritia.render.ModelArmorInfinity;
|
||||
|
||||
@Optional.InterfaceList({ @Optional.Interface(iface = "thaumcraft.api.IGoggles", modid = "Thaumcraft"),
|
||||
@Optional.Interface(iface = "thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft"),
|
||||
@Optional.Interface(iface = "thaumcraft.api.IVisDiscountGear", modid = "Thaumcraft"),
|
||||
@Optional.Interface(iface = "vazkii.botania.api.item.IPhantomInkable", modid = "Botania"),
|
||||
@Optional.Interface(iface = "vazkii.botania.api.mana.IManaDiscountArmor", modid = "Botania"),
|
||||
@Optional.Interface(iface = "vazkii.botania.api.item.IManaProficiencyArmor", modid = "Botania")
|
||||
})
|
||||
public class ItemArmorInfinity extends ItemArmor implements ICosmicRenderItem, IGoggles, IRevealer, IVisDiscountGear, IPhantomInkable,
|
||||
IManaDiscountArmor, IManaProficiencyArmor {
|
||||
@Optional.Interface(iface = "vazkii.botania.api.item.IManaProficiencyArmor", modid = "Botania") })
|
||||
public class ItemArmorInfinity extends ItemArmor implements ICosmicRenderItem, IGoggles, IRevealer, IVisDiscountGear,
|
||||
IPhantomInkable, IManaDiscountArmor, IManaProficiencyArmor {
|
||||
|
||||
public static final ArmorMaterial infinite_armor = EnumHelper.addArmorMaterial("infinity", 9999, new int[]{6, 16, 12, 6}, 1000);
|
||||
public static final ArmorMaterial infinite_armor = EnumHelper
|
||||
.addArmorMaterial("infinity", 9999, new int[] { 6, 16, 12, 6 }, 1000);
|
||||
public IIcon cosmicMask;
|
||||
public final int slot;
|
||||
|
||||
public ItemArmorInfinity(int slot){
|
||||
public ItemArmorInfinity(int slot) {
|
||||
super(infinite_armor, 0, slot);
|
||||
this.slot = slot;
|
||||
setCreativeTab(Avaritia.tab);
|
||||
@@ -70,58 +70,52 @@ public class ItemArmorInfinity extends ItemArmor implements ICosmicRenderItem, I
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
|
||||
{
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
|
||||
return "avaritia:textures/models/infinity_armor.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDamage(ItemStack stack, int damage){
|
||||
public void setDamage(ItemStack stack, int damage) {
|
||||
super.setDamage(stack, 0);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
if(armorType == 0){
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
if (armorType == 0) {
|
||||
player.setAir(300);
|
||||
player.getFoodStats().addStats(20, 20F);
|
||||
}
|
||||
else if(armorType == 1){
|
||||
//player.capabilities.allowFlying = true;
|
||||
} else if (armorType == 1) {
|
||||
// player.capabilities.allowFlying = true;
|
||||
Collection effects = player.getActivePotionEffects();
|
||||
if(effects.size() > 0){
|
||||
if (effects.size() > 0) {
|
||||
ArrayList<Potion> bad = new ArrayList<Potion>();
|
||||
for(Object effect : effects){
|
||||
if(effect instanceof PotionEffect){
|
||||
PotionEffect potion = (PotionEffect)effect;
|
||||
if(PotionHelper.badPotion(Potion.potionTypes[potion.getPotionID()]))
|
||||
for (Object effect : effects) {
|
||||
if (effect instanceof PotionEffect) {
|
||||
PotionEffect potion = (PotionEffect) effect;
|
||||
if (PotionHelper.badPotion(Potion.potionTypes[potion.getPotionID()]))
|
||||
bad.add(Potion.potionTypes[potion.getPotionID()]);
|
||||
}
|
||||
}
|
||||
if(bad.size() > 0){
|
||||
for(Potion potion : bad){
|
||||
if (bad.size() > 0) {
|
||||
for (Potion potion : bad) {
|
||||
player.removePotionEffect(potion.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(armorType == 2){
|
||||
if(player.isBurning())
|
||||
player.extinguish();
|
||||
} else if (armorType == 2) {
|
||||
if (player.isBurning()) player.extinguish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack)
|
||||
{
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return LudicrousItems.cosmic;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemstack, int armorSlot){
|
||||
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemstack, int armorSlot) {
|
||||
ModelArmorInfinity model = armorSlot == 2 ? ModelArmorInfinity.legModel : ModelArmorInfinity.armorModel;
|
||||
|
||||
model.update(entityLiving, itemstack, armorSlot);
|
||||
@@ -130,62 +124,69 @@ public class ItemArmorInfinity extends ItemArmor implements ICosmicRenderItem, I
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public Multimap getAttributeModifiers(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public Multimap getAttributeModifiers(ItemStack stack) {
|
||||
Multimap multimap = super.getAttributeModifiers(stack);
|
||||
//if(armorType == 3)
|
||||
// multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Armor modifier", 0.7, 1));
|
||||
// if(armorType == 3)
|
||||
// multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new
|
||||
// AttributeModifier(field_111210_e, "Armor modifier", 0.7, 1));
|
||||
return multimap;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Thaumcraft")
|
||||
@Override
|
||||
public boolean showIngamePopups(ItemStack itemStack, EntityLivingBase entityLivingBase){
|
||||
if(armorType == 0)
|
||||
return true;
|
||||
public boolean showIngamePopups(ItemStack itemStack, EntityLivingBase entityLivingBase) {
|
||||
if (armorType == 0) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Thaumcraft")
|
||||
@Override
|
||||
public boolean showNodes(ItemStack itemStack, EntityLivingBase entityLivingBase){
|
||||
if(armorType == 0)
|
||||
return true;
|
||||
public boolean showNodes(ItemStack itemStack, EntityLivingBase entityLivingBase) {
|
||||
if (armorType == 0) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Thaumcraft")
|
||||
@Override
|
||||
public int getVisDiscount(ItemStack itemStack, EntityPlayer entityPlayer, Aspect aspect){
|
||||
public int getVisDiscount(ItemStack itemStack, EntityPlayer entityPlayer, Aspect aspect) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if(Compat.thaumic)
|
||||
list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("tc.visdiscount") + ": " + this.getVisDiscount(stack, player, (Aspect)null) + "%");
|
||||
if(Compat.botan) {
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if (Compat.thaumic) list.add(
|
||||
EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("tc.visdiscount")
|
||||
+ ": "
|
||||
+ this.getVisDiscount(stack, player, (Aspect) null)
|
||||
+ "%");
|
||||
if (Compat.botan) {
|
||||
if (hasPhantomInk(stack))
|
||||
list.add(StatCollector.translateToLocal("botaniamisc.hasPhantomInk").replaceAll("&", "\u00a7"));
|
||||
}
|
||||
if (this.slot == 3 && Config.fast) {
|
||||
list.add("");
|
||||
list.add(EnumChatFormatting.BLUE+"+"+EnumChatFormatting.ITALIC+LudicrousText.makeSANIC("SANIC")+EnumChatFormatting.RESET+""+EnumChatFormatting.BLUE+"% Speed");
|
||||
list.add("");
|
||||
list.add(
|
||||
EnumChatFormatting.BLUE + "+"
|
||||
+ EnumChatFormatting.ITALIC
|
||||
+ LudicrousText.makeSANIC("SANIC")
|
||||
+ EnumChatFormatting.RESET
|
||||
+ ""
|
||||
+ EnumChatFormatting.BLUE
|
||||
+ "% Speed");
|
||||
}
|
||||
super.addInformation(stack, player, list, par4);
|
||||
}
|
||||
|
||||
public boolean hasPhantomInk(ItemStack stack) {
|
||||
if(stack.getTagCompound() == null)
|
||||
return false;
|
||||
if (stack.getTagCompound() == null) return false;
|
||||
return stack.getTagCompound().getBoolean("phantomInk");
|
||||
}
|
||||
|
||||
public void setPhantomInk(ItemStack stack, boolean ink) {
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if(tag == null){
|
||||
if (tag == null) {
|
||||
tag = new NBTTagCompound();
|
||||
stack.setTagCompound(tag);
|
||||
}
|
||||
@@ -194,13 +195,13 @@ public class ItemArmorInfinity extends ItemArmor implements ICosmicRenderItem, I
|
||||
|
||||
@Optional.Method(modid = "Botania")
|
||||
@Override
|
||||
public float getDiscount(ItemStack stack, int slot, EntityPlayer player){
|
||||
public float getDiscount(ItemStack stack, int slot, EntityPlayer player) {
|
||||
return 0.25F;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Botania")
|
||||
@Override
|
||||
public boolean shouldGiveProficiency(ItemStack itemStack, int i, EntityPlayer player){
|
||||
public boolean shouldGiveProficiency(ItemStack itemStack, int i, EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -211,157 +212,154 @@ public class ItemArmorInfinity extends ItemArmor implements ICosmicRenderItem, I
|
||||
|
||||
this.cosmicMask = ir.registerIcon("avaritia:infinity_armor_" + slot + "_mask");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getMaskTexture(ItemStack stack, EntityPlayer player) {
|
||||
return this.cosmicMask;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMaskMultiplier(ItemStack stack, EntityPlayer player) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomEntity (ItemStack stack)
|
||||
{
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getMaskTexture(ItemStack stack, EntityPlayer player) {
|
||||
return this.cosmicMask;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMaskMultiplier(ItemStack stack, EntityPlayer player) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomEntity(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity createEntity (World world, Entity location, ItemStack itemstack)
|
||||
{
|
||||
@Override
|
||||
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
|
||||
return new EntityImmortalItem(world, location, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasEffect(ItemStack par1ItemStack, int pass)
|
||||
{
|
||||
public boolean hasEffect(ItemStack par1ItemStack, int pass) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class abilityHandler {
|
||||
public static List<String> playersWithHat = new ArrayList<String>();
|
||||
public static List<String> playersWithChest = new ArrayList<String>();
|
||||
public static List<String> playersWithLeg = new ArrayList<String>();
|
||||
public static List<String> playersWithFoot = new ArrayList<String>();
|
||||
|
||||
public static boolean playerHasHat(EntityPlayer player) {
|
||||
ItemStack armour = player.getCurrentArmor(3);
|
||||
return armour != null && armour.getItem() == LudicrousItems.infinity_helm;
|
||||
}
|
||||
|
||||
public static boolean playerHasChest(EntityPlayer player) {
|
||||
ItemStack armour = player.getCurrentArmor(2);
|
||||
return armour != null && armour.getItem() == LudicrousItems.infinity_armor;
|
||||
}
|
||||
|
||||
public static boolean playerHasLeg(EntityPlayer player) {
|
||||
ItemStack armour = player.getCurrentArmor(1);
|
||||
return armour != null && armour.getItem() == LudicrousItems.infinity_pants;
|
||||
}
|
||||
|
||||
public static boolean playerHasFoot(EntityPlayer player) {
|
||||
ItemStack armour = player.getCurrentArmor(0);
|
||||
return armour != null && armour.getItem() == LudicrousItems.infinity_shoes;
|
||||
}
|
||||
|
||||
public static String playerKey(EntityPlayer player) {
|
||||
return player.getGameProfile().getName() +":"+ player.worldObj.isRemote;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void updatePlayerAbilityStatus(LivingUpdateEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer)event.entityLiving;
|
||||
String key = playerKey(player);
|
||||
|
||||
// hat
|
||||
Boolean hasHat = playerHasHat(player);
|
||||
if (playersWithHat.contains(key)) {
|
||||
if (hasHat) {
|
||||
|
||||
} else {
|
||||
playersWithHat.remove(key);
|
||||
}
|
||||
} else if (hasHat) {
|
||||
playersWithHat.add(key);
|
||||
}
|
||||
|
||||
// chest
|
||||
Boolean hasChest = playerHasChest(player);
|
||||
if (playersWithChest.contains(key)) {
|
||||
if (hasChest) {
|
||||
player.capabilities.allowFlying = true;
|
||||
} else {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.capabilities.allowFlying = false;
|
||||
player.capabilities.isFlying = false;
|
||||
}
|
||||
playersWithChest.remove(key);
|
||||
}
|
||||
} else if (hasChest) {
|
||||
playersWithChest.add(key);
|
||||
}
|
||||
|
||||
// legs
|
||||
Boolean hasLeg = playerHasLeg(player);
|
||||
if (playersWithLeg.contains(key)) {
|
||||
if (hasLeg) {
|
||||
|
||||
} else {
|
||||
playersWithLeg.remove(key);
|
||||
}
|
||||
} else if (hasLeg) {
|
||||
playersWithLeg.add(key);
|
||||
}
|
||||
|
||||
// shoes
|
||||
Boolean hasFoot = playerHasFoot(player) && Config.fast;
|
||||
if (playersWithFoot.contains(key)) {
|
||||
if (hasFoot) {
|
||||
boolean flying = player.capabilities.isFlying;
|
||||
boolean swimming = player.isInsideOfMaterial(Material.water) || player.isInWater();
|
||||
if (player.onGround || flying || swimming) {
|
||||
boolean sneaking = player.isSneaking();
|
||||
|
||||
float speed = 0.15f
|
||||
* (flying ? 1.1f : 1.0f)
|
||||
//* (swimming ? 1.2f : 1.0f)
|
||||
* (sneaking ? 0.1f : 1.0f);
|
||||
|
||||
if (player.moveForward > 0f) {
|
||||
player.moveFlying(0f, 1f, speed);
|
||||
} else if (player.moveForward < 0f) {
|
||||
player.moveFlying(0f, 1f, -speed * 0.3f);
|
||||
}
|
||||
|
||||
if (player.moveStrafing != 0f) {
|
||||
player.moveFlying(1f, 0f, speed * 0.5f * Math.signum(player.moveStrafing));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
playersWithFoot.remove(key);
|
||||
}
|
||||
} else if (hasFoot) {
|
||||
playersWithFoot.add(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void jumpBoost(LivingJumpEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer)event.entityLiving;
|
||||
String key = playerKey(player);
|
||||
|
||||
if (playersWithFoot.contains(key)) {
|
||||
player.motionY += 0.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static class abilityHandler {
|
||||
|
||||
public static List<String> playersWithHat = new ArrayList<String>();
|
||||
public static List<String> playersWithChest = new ArrayList<String>();
|
||||
public static List<String> playersWithLeg = new ArrayList<String>();
|
||||
public static List<String> playersWithFoot = new ArrayList<String>();
|
||||
|
||||
public static boolean playerHasHat(EntityPlayer player) {
|
||||
ItemStack armour = player.getCurrentArmor(3);
|
||||
return armour != null && armour.getItem() == LudicrousItems.infinity_helm;
|
||||
}
|
||||
|
||||
public static boolean playerHasChest(EntityPlayer player) {
|
||||
ItemStack armour = player.getCurrentArmor(2);
|
||||
return armour != null && armour.getItem() == LudicrousItems.infinity_armor;
|
||||
}
|
||||
|
||||
public static boolean playerHasLeg(EntityPlayer player) {
|
||||
ItemStack armour = player.getCurrentArmor(1);
|
||||
return armour != null && armour.getItem() == LudicrousItems.infinity_pants;
|
||||
}
|
||||
|
||||
public static boolean playerHasFoot(EntityPlayer player) {
|
||||
ItemStack armour = player.getCurrentArmor(0);
|
||||
return armour != null && armour.getItem() == LudicrousItems.infinity_shoes;
|
||||
}
|
||||
|
||||
public static String playerKey(EntityPlayer player) {
|
||||
return player.getGameProfile().getName() + ":" + player.worldObj.isRemote;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void updatePlayerAbilityStatus(LivingUpdateEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
String key = playerKey(player);
|
||||
|
||||
// hat
|
||||
Boolean hasHat = playerHasHat(player);
|
||||
if (playersWithHat.contains(key)) {
|
||||
if (hasHat) {
|
||||
|
||||
} else {
|
||||
playersWithHat.remove(key);
|
||||
}
|
||||
} else if (hasHat) {
|
||||
playersWithHat.add(key);
|
||||
}
|
||||
|
||||
// chest
|
||||
Boolean hasChest = playerHasChest(player);
|
||||
if (playersWithChest.contains(key)) {
|
||||
if (hasChest) {
|
||||
player.capabilities.allowFlying = true;
|
||||
} else {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.capabilities.allowFlying = false;
|
||||
player.capabilities.isFlying = false;
|
||||
}
|
||||
playersWithChest.remove(key);
|
||||
}
|
||||
} else if (hasChest) {
|
||||
playersWithChest.add(key);
|
||||
}
|
||||
|
||||
// legs
|
||||
Boolean hasLeg = playerHasLeg(player);
|
||||
if (playersWithLeg.contains(key)) {
|
||||
if (hasLeg) {
|
||||
|
||||
} else {
|
||||
playersWithLeg.remove(key);
|
||||
}
|
||||
} else if (hasLeg) {
|
||||
playersWithLeg.add(key);
|
||||
}
|
||||
|
||||
// shoes
|
||||
Boolean hasFoot = playerHasFoot(player) && Config.fast;
|
||||
if (playersWithFoot.contains(key)) {
|
||||
if (hasFoot) {
|
||||
boolean flying = player.capabilities.isFlying;
|
||||
boolean swimming = player.isInsideOfMaterial(Material.water) || player.isInWater();
|
||||
if (player.onGround || flying || swimming) {
|
||||
boolean sneaking = player.isSneaking();
|
||||
|
||||
float speed = 0.15f * (flying ? 1.1f : 1.0f)
|
||||
// * (swimming ? 1.2f : 1.0f)
|
||||
* (sneaking ? 0.1f : 1.0f);
|
||||
|
||||
if (player.moveForward > 0f) {
|
||||
player.moveFlying(0f, 1f, speed);
|
||||
} else if (player.moveForward < 0f) {
|
||||
player.moveFlying(0f, 1f, -speed * 0.3f);
|
||||
}
|
||||
|
||||
if (player.moveStrafing != 0f) {
|
||||
player.moveFlying(1f, 0f, speed * 0.5f * Math.signum(player.moveStrafing));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
playersWithFoot.remove(key);
|
||||
}
|
||||
} else if (hasFoot) {
|
||||
playersWithFoot.add(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void jumpBoost(LivingJumpEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
String key = playerKey(player);
|
||||
|
||||
if (playersWithFoot.contains(key)) {
|
||||
player.motionY += 0.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,5 @@
|
||||
package fox.spiteful.avaritia.items;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.entity.EntityEndestPearl;
|
||||
import fox.spiteful.avaritia.render.IHaloRenderItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemEnderPearl;
|
||||
@@ -12,66 +7,68 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.entity.EntityEndestPearl;
|
||||
import fox.spiteful.avaritia.render.IHaloRenderItem;
|
||||
|
||||
public class ItemEndestPearl extends ItemEnderPearl implements IHaloRenderItem {
|
||||
|
||||
public ItemEndestPearl() {
|
||||
this.setUnlocalizedName("avaritia_endest_pearl");
|
||||
this.setTextureName("avaritia:endestpearl");
|
||||
this.maxStackSize = 16;
|
||||
this.setCreativeTab(Avaritia.tab);
|
||||
}
|
||||
public ItemEndestPearl() {
|
||||
this.setUnlocalizedName("avaritia_endest_pearl");
|
||||
this.setTextureName("avaritia:endestpearl");
|
||||
this.maxStackSize = 16;
|
||||
this.setCreativeTab(Avaritia.tab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
--stack.stackSize;
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
--stack.stackSize;
|
||||
}
|
||||
|
||||
world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
world.spawnEntityInWorld(new EntityEndestPearl(world, player));
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack)
|
||||
{
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean drawHalo(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getHaloTexture(ItemStack stack) {
|
||||
return ((ItemResource)LudicrousItems.resource).halo[0];
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean drawHalo(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getHaloSize(ItemStack stack) {
|
||||
return 4;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getHaloTexture(ItemStack stack) {
|
||||
return ((ItemResource) LudicrousItems.resource).halo[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean drawPulseEffect(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getHaloSize(ItemStack stack) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getHaloColour(ItemStack stack) {
|
||||
return 0xFF000000;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean drawPulseEffect(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getHaloColour(ItemStack stack) {
|
||||
return 0xFF000000;
|
||||
}
|
||||
}
|
||||
@@ -8,15 +8,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -27,186 +18,196 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
|
||||
public class ItemFracturedOre extends Item {
|
||||
|
||||
public static final String OREKEY = "ore";
|
||||
protected static List<ItemStack> emulatedOres = new ArrayList<ItemStack>();
|
||||
protected static Map<String, ItemStack> nameMapping = new HashMap<String, ItemStack>();
|
||||
public static IIcon unknownIcon;
|
||||
|
||||
public ItemFracturedOre() {
|
||||
this.setCreativeTab(Avaritia.tab);
|
||||
this.setUnlocalizedName("avaritia_fracturedore");
|
||||
this.setTextureName("avaritia:fracturedore");
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
public static final String OREKEY = "ore";
|
||||
protected static List<ItemStack> emulatedOres = new ArrayList<ItemStack>();
|
||||
protected static Map<String, ItemStack> nameMapping = new HashMap<String, ItemStack>();
|
||||
public static IIcon unknownIcon;
|
||||
|
||||
@SuppressWarnings({ "rawtypes"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list)
|
||||
{
|
||||
// for debug purposes only - don't want these cluttering up the tab.
|
||||
/*for (ItemStack stack : emulatedOres) {
|
||||
list.add(getStackForOre(stack, 1));
|
||||
}*/
|
||||
public ItemFracturedOre() {
|
||||
this.setCreativeTab(Avaritia.tab);
|
||||
this.setUnlocalizedName("avaritia_fracturedore");
|
||||
this.setTextureName("avaritia:fracturedore");
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public ItemStack getStackForOre(ItemStack orestack, int stacksize) {
|
||||
NBTTagCompound oretag = NameStack.saveStackToNBT(orestack);
|
||||
|
||||
ItemStack outstack = new ItemStack(this, stacksize, 0);
|
||||
NBTTagCompound stacktag = new NBTTagCompound();
|
||||
stacktag.setTag(OREKEY, oretag);
|
||||
outstack.setTagCompound(stacktag);
|
||||
outstack.setItemDamage(this.getDamage(outstack));
|
||||
|
||||
return outstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack)
|
||||
{
|
||||
if (stack.hasTagCompound() && stack.getTagCompound().hasKey(OREKEY)) {
|
||||
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(OREKEY);
|
||||
NameStack namestack = NameStack.loadFromNBT(tag);
|
||||
|
||||
if (namestack != null) {
|
||||
ItemStack orestack = namestack.getStack();
|
||||
Item oreitem = orestack.getItem();
|
||||
return StatCollector.translateToLocal("item.avaritia_fracturedore.prefix") +" "+ oreitem.getItemStackDisplayName(orestack);
|
||||
}
|
||||
}
|
||||
return super.getItemStackDisplayName(stack);
|
||||
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
// for debug purposes only - don't want these cluttering up the tab.
|
||||
/*
|
||||
* for (ItemStack stack : emulatedOres) { list.add(getStackForOre(stack, 1)); }
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamage(ItemStack stack) {
|
||||
if (stack.hasTagCompound() && stack.getTagCompound().hasKey(OREKEY)) {
|
||||
NameStack nstack = NameStack.loadFromNBT(stack.getTagCompound().getCompoundTag(OREKEY));
|
||||
int id = Item.getIdFromItem(nstack.getItem());
|
||||
int meta = nstack.damage;
|
||||
int out = meta + (id << 4);
|
||||
stack.setItemDamage(out);
|
||||
return out;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
public ItemStack getStackForOre(ItemStack orestack, int stacksize) {
|
||||
NBTTagCompound oretag = NameStack.saveStackToNBT(orestack);
|
||||
|
||||
ItemStack outstack = new ItemStack(this, stacksize, 0);
|
||||
NBTTagCompound stacktag = new NBTTagCompound();
|
||||
stacktag.setTag(OREKEY, oretag);
|
||||
outstack.setTagCompound(stacktag);
|
||||
outstack.setItemDamage(this.getDamage(outstack));
|
||||
|
||||
return outstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
if (stack.hasTagCompound() && stack.getTagCompound().hasKey(OREKEY)) {
|
||||
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(OREKEY);
|
||||
NameStack namestack = NameStack.loadFromNBT(tag);
|
||||
|
||||
if (namestack != null) {
|
||||
ItemStack orestack = namestack.getStack();
|
||||
Item oreitem = orestack.getItem();
|
||||
return StatCollector.translateToLocal("item.avaritia_fracturedore.prefix") + " "
|
||||
+ oreitem.getItemStackDisplayName(orestack);
|
||||
}
|
||||
}
|
||||
return super.getItemStackDisplayName(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamage(ItemStack stack) {
|
||||
if (stack.hasTagCompound() && stack.getTagCompound().hasKey(OREKEY)) {
|
||||
NameStack nstack = NameStack.loadFromNBT(stack.getTagCompound().getCompoundTag(OREKEY));
|
||||
int id = Item.getIdFromItem(nstack.getItem());
|
||||
int meta = nstack.damage;
|
||||
int out = meta + (id << 4);
|
||||
stack.setItemDamage(out);
|
||||
return out;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister ir) {
|
||||
super.registerIcons(ir);
|
||||
|
||||
unknownIcon = ir.registerIcon("avaritia:unknown");
|
||||
}
|
||||
|
||||
// ########################################
|
||||
|
||||
public static void brushUpUncomfortablyAgainstTheOreDictionary() {
|
||||
String[] names = OreDictionary.getOreNames();
|
||||
|
||||
ItemFracturedOre fracore = (ItemFracturedOre)LudicrousItems.fractured_ore;
|
||||
|
||||
Multimap<String, ItemStack> toRegister = HashMultimap.create();
|
||||
Set<ItemStackWrapper> antiDupePool = new HashSet<ItemStackWrapper>();
|
||||
|
||||
for (String name : names) {
|
||||
if (name.startsWith("ore") && !name.startsWith("oreberry")) {
|
||||
//Lumberjack.info("ORE: "+name);
|
||||
|
||||
List<ItemStack> ores = OreDictionary.getOres(name);
|
||||
|
||||
for(ItemStack ore : ores) {
|
||||
ItemStackWrapper compare = new ItemStackWrapper(ore);
|
||||
if (!antiDupePool.contains(compare)) {
|
||||
//Lumberjack.info(ore);
|
||||
antiDupePool.add(compare);
|
||||
emulatedOres.add(ore.copy());
|
||||
|
||||
ItemStack frac = fracore.getStackForOre(ore, 1);
|
||||
toRegister.put(name, frac);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (String name : toRegister.keySet()) {
|
||||
Collection<ItemStack> stacks = toRegister.get(name);
|
||||
for (ItemStack stack : stacks) {
|
||||
ItemStack orestack = NameStack.loadFromNBT(stack.getTagCompound().getCompoundTag(OREKEY)).getStack();
|
||||
int[] oreids = OreDictionary.getOreIDs(orestack);
|
||||
for (int i=0; i<oreids.length; i++) {
|
||||
String oreidname = OreDictionary.getOreName(oreids[i]);
|
||||
//Lumberjack.info("Registering "+orestack.getItem().getItemStackDisplayName(orestack)+" ("+orestack+") ---> "+stack.getItem().getItemStackDisplayName(stack)+"#"+stack.getItemDamage()+" as "+oreidname);
|
||||
OreDictionary.registerOre(oreidname, stack);
|
||||
}
|
||||
|
||||
ItemStack smeltingResult = FurnaceRecipes.smelting().getSmeltingResult(orestack);
|
||||
if (smeltingResult != null) {
|
||||
float exp = FurnaceRecipes.smelting().func_151398_b(orestack);
|
||||
//Lumberjack.info("Registering "+stack+" to smelt to "+smeltingResult+" for "+exp+" experience");
|
||||
GameRegistry.addSmelting(stack, smeltingResult, exp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class NameStack {
|
||||
String name;
|
||||
int damage;
|
||||
NBTTagCompound tag;
|
||||
int size;
|
||||
|
||||
public NameStack(ItemStack source) {
|
||||
this(source.getItem().delegate.name(), source.getItemDamage(), source.stackSize, source.getTagCompound());
|
||||
}
|
||||
|
||||
public NameStack(String name, int damage, int size, NBTTagCompound nbt) {
|
||||
this.name = name;
|
||||
this.damage = damage;
|
||||
this.tag = nbt;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public NBTTagCompound saveToNBT() {
|
||||
NBTTagCompound savetag = new NBTTagCompound();
|
||||
savetag.setInteger("meta", this.damage);
|
||||
if (this.tag != null) {
|
||||
savetag.setTag("nbt", this.tag);
|
||||
}
|
||||
savetag.setString("name", this.name);
|
||||
savetag.setInteger("size", this.size);
|
||||
return savetag;
|
||||
}
|
||||
|
||||
public static NameStack loadFromNBT(NBTTagCompound tag) {
|
||||
NBTTagCompound stacktag = null;
|
||||
if (tag.hasKey("nbt")) {
|
||||
stacktag = tag.getCompoundTag("nbt");
|
||||
}
|
||||
return new NameStack(tag.getString("name"), tag.getInteger("meta"), tag.getInteger("size"), stacktag);
|
||||
}
|
||||
|
||||
public Item getItem() {
|
||||
return (Item) Item.itemRegistry.getObject(this.name);
|
||||
}
|
||||
|
||||
public static NBTTagCompound saveStackToNBT(ItemStack stack) {
|
||||
return new NameStack(stack).saveToNBT();
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
ItemStack stack = new ItemStack(this.getItem(), this.size, this.damage);
|
||||
if(this.tag != null) {
|
||||
stack.setTagCompound((NBTTagCompound) this.tag.copy());
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NameStack: "+this.size+"x "+this.name+"@"+this.damage+", "+this.tag;
|
||||
}
|
||||
}
|
||||
super.registerIcons(ir);
|
||||
|
||||
unknownIcon = ir.registerIcon("avaritia:unknown");
|
||||
}
|
||||
|
||||
// ########################################
|
||||
|
||||
public static void brushUpUncomfortablyAgainstTheOreDictionary() {
|
||||
String[] names = OreDictionary.getOreNames();
|
||||
|
||||
ItemFracturedOre fracore = (ItemFracturedOre) LudicrousItems.fractured_ore;
|
||||
|
||||
Multimap<String, ItemStack> toRegister = HashMultimap.create();
|
||||
Set<ItemStackWrapper> antiDupePool = new HashSet<ItemStackWrapper>();
|
||||
|
||||
for (String name : names) {
|
||||
if (name.startsWith("ore") && !name.startsWith("oreberry")) {
|
||||
// Lumberjack.info("ORE: "+name);
|
||||
|
||||
List<ItemStack> ores = OreDictionary.getOres(name);
|
||||
|
||||
for (ItemStack ore : ores) {
|
||||
ItemStackWrapper compare = new ItemStackWrapper(ore);
|
||||
if (!antiDupePool.contains(compare)) {
|
||||
// Lumberjack.info(ore);
|
||||
antiDupePool.add(compare);
|
||||
emulatedOres.add(ore.copy());
|
||||
|
||||
ItemStack frac = fracore.getStackForOre(ore, 1);
|
||||
toRegister.put(name, frac);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (String name : toRegister.keySet()) {
|
||||
Collection<ItemStack> stacks = toRegister.get(name);
|
||||
for (ItemStack stack : stacks) {
|
||||
ItemStack orestack = NameStack.loadFromNBT(stack.getTagCompound().getCompoundTag(OREKEY)).getStack();
|
||||
int[] oreids = OreDictionary.getOreIDs(orestack);
|
||||
for (int i = 0; i < oreids.length; i++) {
|
||||
String oreidname = OreDictionary.getOreName(oreids[i]);
|
||||
// Lumberjack.info("Registering "+orestack.getItem().getItemStackDisplayName(orestack)+"
|
||||
// ("+orestack+") ---> "+stack.getItem().getItemStackDisplayName(stack)+"#"+stack.getItemDamage()+"
|
||||
// as "+oreidname);
|
||||
OreDictionary.registerOre(oreidname, stack);
|
||||
}
|
||||
|
||||
ItemStack smeltingResult = FurnaceRecipes.smelting().getSmeltingResult(orestack);
|
||||
if (smeltingResult != null) {
|
||||
float exp = FurnaceRecipes.smelting().func_151398_b(orestack);
|
||||
// Lumberjack.info("Registering "+stack+" to smelt to "+smeltingResult+" for "+exp+" experience");
|
||||
GameRegistry.addSmelting(stack, smeltingResult, exp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class NameStack {
|
||||
|
||||
String name;
|
||||
int damage;
|
||||
NBTTagCompound tag;
|
||||
int size;
|
||||
|
||||
public NameStack(ItemStack source) {
|
||||
this(source.getItem().delegate.name(), source.getItemDamage(), source.stackSize, source.getTagCompound());
|
||||
}
|
||||
|
||||
public NameStack(String name, int damage, int size, NBTTagCompound nbt) {
|
||||
this.name = name;
|
||||
this.damage = damage;
|
||||
this.tag = nbt;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public NBTTagCompound saveToNBT() {
|
||||
NBTTagCompound savetag = new NBTTagCompound();
|
||||
savetag.setInteger("meta", this.damage);
|
||||
if (this.tag != null) {
|
||||
savetag.setTag("nbt", this.tag);
|
||||
}
|
||||
savetag.setString("name", this.name);
|
||||
savetag.setInteger("size", this.size);
|
||||
return savetag;
|
||||
}
|
||||
|
||||
public static NameStack loadFromNBT(NBTTagCompound tag) {
|
||||
NBTTagCompound stacktag = null;
|
||||
if (tag.hasKey("nbt")) {
|
||||
stacktag = tag.getCompoundTag("nbt");
|
||||
}
|
||||
return new NameStack(tag.getString("name"), tag.getInteger("meta"), tag.getInteger("size"), stacktag);
|
||||
}
|
||||
|
||||
public Item getItem() {
|
||||
return (Item) Item.itemRegistry.getObject(this.name);
|
||||
}
|
||||
|
||||
public static NBTTagCompound saveStackToNBT(ItemStack stack) {
|
||||
return new NameStack(stack).saveToNBT();
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
ItemStack stack = new ItemStack(this.getItem(), this.size, this.damage);
|
||||
if (this.tag != null) {
|
||||
stack.setTagCompound((NBTTagCompound) this.tag.copy());
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NameStack: " + this.size + "x " + this.name + "@" + this.damage + ", " + this.tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,6 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
|
||||
import codechicken.lib.math.MathHelper;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import fox.spiteful.avaritia.items.tools.ToolHelper;
|
||||
import fox.spiteful.avaritia.render.ICosmicRenderItem;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -27,273 +20,290 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import codechicken.lib.math.MathHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import fox.spiteful.avaritia.items.tools.ToolHelper;
|
||||
import fox.spiteful.avaritia.render.ICosmicRenderItem;
|
||||
|
||||
public class ItemMatterCluster extends Item implements ICosmicRenderItem {
|
||||
|
||||
protected static Random randy = new Random();
|
||||
|
||||
public static final String MAINTAG = "clusteritems";
|
||||
public static final String LISTTAG = "items";
|
||||
public static final String ITEMTAG = "item";
|
||||
public static final String COUNTTAG = "count";
|
||||
public static final String MAINCOUNTTAG = "total";
|
||||
|
||||
public static int capacity = 64*256;
|
||||
|
||||
public IIcon iconFull;
|
||||
public IIcon cosmicIcon;
|
||||
public IIcon cosmicIconFull;
|
||||
|
||||
public ItemMatterCluster() {
|
||||
this.setMaxStackSize(1);
|
||||
this.setUnlocalizedName("avaritia_mattercluster");
|
||||
this.setTextureName("avaritia:mattercluster");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister ir) {
|
||||
super.registerIcons(ir);
|
||||
|
||||
this.cosmicIcon = ir.registerIcon("avaritia:mattercluster_mask");
|
||||
|
||||
this.iconFull = ir.registerIcon("avaritia:mattercluster_full");
|
||||
this.cosmicIconFull = ir.registerIcon("avaritia:mattercluster_full_mask");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack)
|
||||
{
|
||||
return LudicrousItems.cosmic;
|
||||
protected static Random randy = new Random();
|
||||
|
||||
public static final String MAINTAG = "clusteritems";
|
||||
public static final String LISTTAG = "items";
|
||||
public static final String ITEMTAG = "item";
|
||||
public static final String COUNTTAG = "count";
|
||||
public static final String MAINCOUNTTAG = "total";
|
||||
|
||||
public static int capacity = 64 * 256;
|
||||
|
||||
public IIcon iconFull;
|
||||
public IIcon cosmicIcon;
|
||||
public IIcon cosmicIconFull;
|
||||
|
||||
public ItemMatterCluster() {
|
||||
this.setMaxStackSize(1);
|
||||
this.setUnlocalizedName("avaritia_mattercluster");
|
||||
this.setTextureName("avaritia:mattercluster");
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister ir) {
|
||||
super.registerIcons(ir);
|
||||
|
||||
this.cosmicIcon = ir.registerIcon("avaritia:mattercluster_mask");
|
||||
|
||||
this.iconFull = ir.registerIcon("avaritia:mattercluster_full");
|
||||
this.cosmicIconFull = ir.registerIcon("avaritia:mattercluster_full_mask");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return LudicrousItems.cosmic;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean debug) {
|
||||
if (!stack.hasTagCompound() || !stack.getTagCompound().hasKey(MAINTAG)) {
|
||||
return;
|
||||
}
|
||||
NBTTagCompound clustertag = stack.getTagCompound().getCompoundTag(MAINTAG);
|
||||
|
||||
tooltip.add(clustertag.getInteger(MAINCOUNTTAG) + "/" + capacity + " " + StatCollector.translateToLocal("tooltip.matter_cluster.counter"));
|
||||
tooltip.add("");
|
||||
|
||||
|
||||
if (GuiScreen.isShiftKeyDown()) {
|
||||
NBTTagList list = clustertag.getTagList(LISTTAG, 10);
|
||||
for (int i=0; i<list.tagCount(); i++) {
|
||||
NBTTagCompound tag = list.getCompoundTagAt(i);
|
||||
ItemStack countstack = ItemStack.loadItemStackFromNBT(tag.getCompoundTag(ITEMTAG));
|
||||
int count = tag.getInteger(COUNTTAG);
|
||||
|
||||
tooltip.add(countstack.getItem().getRarity(countstack).rarityColor + countstack.getDisplayName() +EnumChatFormatting.GRAY+" x " + count);
|
||||
}
|
||||
} else {
|
||||
tooltip.add(EnumChatFormatting.DARK_GRAY + StatCollector.translateToLocal("tooltip.matter_cluster.desc"));
|
||||
tooltip.add(EnumChatFormatting.DARK_GRAY.toString() + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("tooltip.matter_cluster.desc2"));
|
||||
}
|
||||
}
|
||||
|
||||
public static List<ItemStack> makeClusters(List<ItemStack> input) {
|
||||
Map<ItemStackWrapper, Integer> items = ToolHelper.collateMatterCluster(input);
|
||||
List<ItemStack> clusters = new ArrayList<ItemStack>();
|
||||
List<Entry<ItemStackWrapper, Integer>> itemlist = new ArrayList<Entry<ItemStackWrapper, Integer>>();
|
||||
itemlist.addAll(items.entrySet());
|
||||
|
||||
int currentTotal = 0;
|
||||
Map<ItemStackWrapper, Integer> currentItems = new HashMap<ItemStackWrapper, Integer>();
|
||||
|
||||
while(!itemlist.isEmpty()) {
|
||||
Entry<ItemStackWrapper, Integer> e = itemlist.get(0);
|
||||
ItemStackWrapper wrap = e.getKey();
|
||||
int wrapcount = e.getValue();
|
||||
|
||||
int count = Math.min(capacity - currentTotal, wrapcount);
|
||||
|
||||
if (!currentItems.containsKey(e.getKey())) {
|
||||
currentItems.put(wrap, count);
|
||||
} else {
|
||||
currentItems.put(wrap, currentItems.get(wrap) + count);
|
||||
}
|
||||
currentTotal += count;
|
||||
|
||||
e.setValue(wrapcount - count);
|
||||
if (e.getValue() == 0) {
|
||||
itemlist.remove(0);
|
||||
}
|
||||
|
||||
if (currentTotal == capacity) {
|
||||
ItemStack cluster = makeCluster(currentItems);
|
||||
|
||||
clusters.add(cluster);
|
||||
|
||||
currentTotal = 0;
|
||||
currentItems = new HashMap<ItemStackWrapper, Integer>();
|
||||
}
|
||||
}
|
||||
|
||||
if (currentTotal > 0) {
|
||||
ItemStack cluster = makeCluster(currentItems);
|
||||
|
||||
clusters.add(cluster);
|
||||
}
|
||||
|
||||
return clusters;
|
||||
}
|
||||
|
||||
public static ItemStack makeCluster(Map<ItemStackWrapper, Integer> input) {
|
||||
ItemStack cluster = new ItemStack(LudicrousItems.matter_cluster);
|
||||
int total = 0;
|
||||
for (int num : input.values()) {
|
||||
total += num;
|
||||
}
|
||||
setClusterData(cluster, input, total);
|
||||
return cluster;
|
||||
}
|
||||
|
||||
public static Map<ItemStackWrapper, Integer> getClusterData(ItemStack cluster) {
|
||||
if (!cluster.hasTagCompound() || !cluster.getTagCompound().hasKey(MAINTAG)) {
|
||||
return null;
|
||||
}
|
||||
NBTTagCompound tag = cluster.getTagCompound().getCompoundTag(MAINTAG);
|
||||
NBTTagList list = tag.getTagList(LISTTAG, 10);
|
||||
Map<ItemStackWrapper, Integer> data = new HashMap<ItemStackWrapper, Integer>();
|
||||
|
||||
for (int i=0; i<list.tagCount(); i++) {
|
||||
NBTTagCompound entry = list.getCompoundTagAt(i);
|
||||
ItemStackWrapper wrap = new ItemStackWrapper(ItemStack.loadItemStackFromNBT(entry.getCompoundTag(ITEMTAG)));
|
||||
int count = entry.getInteger(COUNTTAG);
|
||||
data.put(wrap, count);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public static int getClusterSize(ItemStack cluster) {
|
||||
if (!cluster.hasTagCompound() || !cluster.getTagCompound().hasKey(MAINTAG)) {
|
||||
return 0;
|
||||
}
|
||||
return cluster.getTagCompound().getCompoundTag(MAINTAG).getInteger(MAINCOUNTTAG);
|
||||
}
|
||||
|
||||
public static void setClusterData(ItemStack stack, Map<ItemStackWrapper, Integer> data, int count) {
|
||||
if (!stack.hasTagCompound()) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound clustertag = new NBTTagCompound();
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
for (Entry<ItemStackWrapper, Integer> entry : data.entrySet()) {
|
||||
NBTTagCompound itemtag = new NBTTagCompound();
|
||||
itemtag.setTag(ITEMTAG, entry.getKey().stack.writeToNBT(new NBTTagCompound()));
|
||||
itemtag.setInteger(COUNTTAG, entry.getValue());
|
||||
list.appendTag(itemtag);
|
||||
}
|
||||
clustertag.setTag(LISTTAG, list);
|
||||
clustertag.setInteger(MAINCOUNTTAG, count);
|
||||
stack.getTagCompound().setTag(MAINTAG, clustertag);
|
||||
}
|
||||
|
||||
public static void mergeClusters(ItemStack donor, ItemStack recipient) {
|
||||
int donorcount = getClusterSize(donor);
|
||||
int recipientcount = getClusterSize(recipient);
|
||||
|
||||
Lumberjack.info(donorcount +", "+ recipientcount);
|
||||
if (donorcount == 0 || donorcount == capacity || recipientcount == capacity) {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<ItemStackWrapper, Integer> donordata = getClusterData(donor);
|
||||
Map<ItemStackWrapper, Integer> recipientdata = getClusterData(recipient);
|
||||
List<Entry<ItemStackWrapper, Integer>> datalist = new ArrayList<Entry<ItemStackWrapper, Integer>>();
|
||||
datalist.addAll(donordata.entrySet());
|
||||
|
||||
while (recipientcount < capacity && donorcount > 0) {
|
||||
Entry<ItemStackWrapper, Integer> e = datalist.get(0);
|
||||
ItemStackWrapper wrap = e.getKey();
|
||||
int wrapcount = e.getValue();
|
||||
|
||||
int count = Math.min(capacity - recipientcount, wrapcount);
|
||||
|
||||
if (!recipientdata.containsKey(wrap)) {
|
||||
recipientdata.put(wrap, count);
|
||||
} else {
|
||||
recipientdata.put(wrap, recipientdata.get(wrap) + count);
|
||||
}
|
||||
|
||||
donorcount -= count;
|
||||
recipientcount += count;
|
||||
|
||||
if (wrapcount - count > 0) {
|
||||
e.setValue(wrapcount - count);
|
||||
} else {
|
||||
donordata.remove(wrap);
|
||||
datalist.remove(0);
|
||||
}
|
||||
}
|
||||
setClusterData(recipient, recipientdata, recipientcount);
|
||||
|
||||
if (donorcount > 0) {
|
||||
setClusterData(donor, donordata, donorcount);
|
||||
} else {
|
||||
donor.setTagCompound(null);
|
||||
donor.stackSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if(!world.isRemote) {
|
||||
List<ItemStack> drops = ToolHelper.collateMatterClusterContents(ItemMatterCluster.getClusterData(stack));
|
||||
|
||||
for (ItemStack drop : drops) {
|
||||
ToolHelper.dropItem(drop, world, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ));
|
||||
}
|
||||
}
|
||||
|
||||
if (!stack.hasTagCompound() || !stack.getTagCompound().hasKey(MAINTAG)) {
|
||||
return;
|
||||
}
|
||||
NBTTagCompound clustertag = stack.getTagCompound().getCompoundTag(MAINTAG);
|
||||
|
||||
tooltip.add(
|
||||
clustertag.getInteger(MAINCOUNTTAG) + "/"
|
||||
+ capacity
|
||||
+ " "
|
||||
+ StatCollector.translateToLocal("tooltip.matter_cluster.counter"));
|
||||
tooltip.add("");
|
||||
|
||||
if (GuiScreen.isShiftKeyDown()) {
|
||||
NBTTagList list = clustertag.getTagList(LISTTAG, 10);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound tag = list.getCompoundTagAt(i);
|
||||
ItemStack countstack = ItemStack.loadItemStackFromNBT(tag.getCompoundTag(ITEMTAG));
|
||||
int count = tag.getInteger(COUNTTAG);
|
||||
|
||||
tooltip.add(
|
||||
countstack.getItem().getRarity(countstack).rarityColor + countstack.getDisplayName()
|
||||
+ EnumChatFormatting.GRAY
|
||||
+ " x "
|
||||
+ count);
|
||||
}
|
||||
} else {
|
||||
tooltip.add(EnumChatFormatting.DARK_GRAY + StatCollector.translateToLocal("tooltip.matter_cluster.desc"));
|
||||
tooltip.add(
|
||||
EnumChatFormatting.DARK_GRAY.toString() + EnumChatFormatting.ITALIC
|
||||
+ StatCollector.translateToLocal("tooltip.matter_cluster.desc2"));
|
||||
}
|
||||
}
|
||||
|
||||
public static List<ItemStack> makeClusters(List<ItemStack> input) {
|
||||
Map<ItemStackWrapper, Integer> items = ToolHelper.collateMatterCluster(input);
|
||||
List<ItemStack> clusters = new ArrayList<ItemStack>();
|
||||
List<Entry<ItemStackWrapper, Integer>> itemlist = new ArrayList<Entry<ItemStackWrapper, Integer>>();
|
||||
itemlist.addAll(items.entrySet());
|
||||
|
||||
int currentTotal = 0;
|
||||
Map<ItemStackWrapper, Integer> currentItems = new HashMap<ItemStackWrapper, Integer>();
|
||||
|
||||
while (!itemlist.isEmpty()) {
|
||||
Entry<ItemStackWrapper, Integer> e = itemlist.get(0);
|
||||
ItemStackWrapper wrap = e.getKey();
|
||||
int wrapcount = e.getValue();
|
||||
|
||||
int count = Math.min(capacity - currentTotal, wrapcount);
|
||||
|
||||
if (!currentItems.containsKey(e.getKey())) {
|
||||
currentItems.put(wrap, count);
|
||||
} else {
|
||||
currentItems.put(wrap, currentItems.get(wrap) + count);
|
||||
}
|
||||
currentTotal += count;
|
||||
|
||||
e.setValue(wrapcount - count);
|
||||
if (e.getValue() == 0) {
|
||||
itemlist.remove(0);
|
||||
}
|
||||
|
||||
if (currentTotal == capacity) {
|
||||
ItemStack cluster = makeCluster(currentItems);
|
||||
|
||||
clusters.add(cluster);
|
||||
|
||||
currentTotal = 0;
|
||||
currentItems = new HashMap<ItemStackWrapper, Integer>();
|
||||
}
|
||||
}
|
||||
|
||||
if (currentTotal > 0) {
|
||||
ItemStack cluster = makeCluster(currentItems);
|
||||
|
||||
clusters.add(cluster);
|
||||
}
|
||||
|
||||
return clusters;
|
||||
}
|
||||
|
||||
public static ItemStack makeCluster(Map<ItemStackWrapper, Integer> input) {
|
||||
ItemStack cluster = new ItemStack(LudicrousItems.matter_cluster);
|
||||
int total = 0;
|
||||
for (int num : input.values()) {
|
||||
total += num;
|
||||
}
|
||||
setClusterData(cluster, input, total);
|
||||
return cluster;
|
||||
}
|
||||
|
||||
public static Map<ItemStackWrapper, Integer> getClusterData(ItemStack cluster) {
|
||||
if (!cluster.hasTagCompound() || !cluster.getTagCompound().hasKey(MAINTAG)) {
|
||||
return null;
|
||||
}
|
||||
NBTTagCompound tag = cluster.getTagCompound().getCompoundTag(MAINTAG);
|
||||
NBTTagList list = tag.getTagList(LISTTAG, 10);
|
||||
Map<ItemStackWrapper, Integer> data = new HashMap<ItemStackWrapper, Integer>();
|
||||
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound entry = list.getCompoundTagAt(i);
|
||||
ItemStackWrapper wrap = new ItemStackWrapper(ItemStack.loadItemStackFromNBT(entry.getCompoundTag(ITEMTAG)));
|
||||
int count = entry.getInteger(COUNTTAG);
|
||||
data.put(wrap, count);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public static int getClusterSize(ItemStack cluster) {
|
||||
if (!cluster.hasTagCompound() || !cluster.getTagCompound().hasKey(MAINTAG)) {
|
||||
return 0;
|
||||
}
|
||||
return cluster.getTagCompound().getCompoundTag(MAINTAG).getInteger(MAINCOUNTTAG);
|
||||
}
|
||||
|
||||
public static void setClusterData(ItemStack stack, Map<ItemStackWrapper, Integer> data, int count) {
|
||||
if (!stack.hasTagCompound()) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound clustertag = new NBTTagCompound();
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
for (Entry<ItemStackWrapper, Integer> entry : data.entrySet()) {
|
||||
NBTTagCompound itemtag = new NBTTagCompound();
|
||||
itemtag.setTag(ITEMTAG, entry.getKey().stack.writeToNBT(new NBTTagCompound()));
|
||||
itemtag.setInteger(COUNTTAG, entry.getValue());
|
||||
list.appendTag(itemtag);
|
||||
}
|
||||
clustertag.setTag(LISTTAG, list);
|
||||
clustertag.setInteger(MAINCOUNTTAG, count);
|
||||
stack.getTagCompound().setTag(MAINTAG, clustertag);
|
||||
}
|
||||
|
||||
public static void mergeClusters(ItemStack donor, ItemStack recipient) {
|
||||
int donorcount = getClusterSize(donor);
|
||||
int recipientcount = getClusterSize(recipient);
|
||||
|
||||
Lumberjack.info(donorcount + ", " + recipientcount);
|
||||
if (donorcount == 0 || donorcount == capacity || recipientcount == capacity) {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<ItemStackWrapper, Integer> donordata = getClusterData(donor);
|
||||
Map<ItemStackWrapper, Integer> recipientdata = getClusterData(recipient);
|
||||
List<Entry<ItemStackWrapper, Integer>> datalist = new ArrayList<Entry<ItemStackWrapper, Integer>>();
|
||||
datalist.addAll(donordata.entrySet());
|
||||
|
||||
while (recipientcount < capacity && donorcount > 0) {
|
||||
Entry<ItemStackWrapper, Integer> e = datalist.get(0);
|
||||
ItemStackWrapper wrap = e.getKey();
|
||||
int wrapcount = e.getValue();
|
||||
|
||||
int count = Math.min(capacity - recipientcount, wrapcount);
|
||||
|
||||
if (!recipientdata.containsKey(wrap)) {
|
||||
recipientdata.put(wrap, count);
|
||||
} else {
|
||||
recipientdata.put(wrap, recipientdata.get(wrap) + count);
|
||||
}
|
||||
|
||||
donorcount -= count;
|
||||
recipientcount += count;
|
||||
|
||||
if (wrapcount - count > 0) {
|
||||
e.setValue(wrapcount - count);
|
||||
} else {
|
||||
donordata.remove(wrap);
|
||||
datalist.remove(0);
|
||||
}
|
||||
}
|
||||
setClusterData(recipient, recipientdata, recipientcount);
|
||||
|
||||
if (donorcount > 0) {
|
||||
setClusterData(donor, donordata, donorcount);
|
||||
} else {
|
||||
donor.setTagCompound(null);
|
||||
donor.stackSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (!world.isRemote) {
|
||||
List<ItemStack> drops = ToolHelper.collateMatterClusterContents(ItemMatterCluster.getClusterData(stack));
|
||||
|
||||
for (ItemStack drop : drops) {
|
||||
ToolHelper.dropItem(
|
||||
drop,
|
||||
world,
|
||||
MathHelper.floor_double(player.posX),
|
||||
MathHelper.floor_double(player.posY),
|
||||
MathHelper.floor_double(player.posZ));
|
||||
}
|
||||
}
|
||||
|
||||
stack.stackSize = 0;
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getMaskTexture(ItemStack stack, EntityPlayer player) {
|
||||
int count = getClusterSize(stack);
|
||||
if (count == capacity) {
|
||||
return cosmicIconFull;
|
||||
}
|
||||
return cosmicIcon;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getMaskTexture(ItemStack stack, EntityPlayer player) {
|
||||
int count = getClusterSize(stack);
|
||||
if (count == capacity) {
|
||||
return cosmicIconFull;
|
||||
}
|
||||
return cosmicIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMaskMultiplier(ItemStack stack, EntityPlayer player) {
|
||||
int count = getClusterSize(stack);
|
||||
return count / (float)capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass) {
|
||||
int count = getClusterSize(stack);
|
||||
if (count == capacity) {
|
||||
return iconFull;
|
||||
}
|
||||
return super.getIcon(stack, pass);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconIndex(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMaskMultiplier(ItemStack stack, EntityPlayer player) {
|
||||
int count = getClusterSize(stack);
|
||||
return count / (float) capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass) {
|
||||
int count = getClusterSize(stack);
|
||||
if (count == capacity) {
|
||||
return iconFull;
|
||||
}
|
||||
return super.getIcon(stack, pass);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconIndex(ItemStack stack) {
|
||||
return this.getIcon(stack, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack)
|
||||
{
|
||||
int count = getClusterSize(stack);
|
||||
if (count == capacity) {
|
||||
return super.getUnlocalizedName(stack) + ".full";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
int count = getClusterSize(stack);
|
||||
if (count == capacity) {
|
||||
return super.getUnlocalizedName(stack) + ".full";
|
||||
}
|
||||
return super.getUnlocalizedName(stack);
|
||||
}
|
||||
}
|
||||
@@ -1,37 +1,38 @@
|
||||
package fox.spiteful.avaritia.items;
|
||||
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.entity.EntityImmortalItem;
|
||||
import fox.spiteful.avaritia.render.IHaloRenderItem;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.entity.EntityImmortalItem;
|
||||
import fox.spiteful.avaritia.render.IHaloRenderItem;
|
||||
|
||||
public class ItemResource extends Item implements IHaloRenderItem {
|
||||
|
||||
private static final String[] types = new String[]{"diamond_lattice", "crystal_matrix_ingot", "neutron_pile",
|
||||
private static final String[] types = new String[] { "diamond_lattice", "crystal_matrix_ingot", "neutron_pile",
|
||||
"neutron_nugget", "neutronium_ingot", "infinity_catalyst", "infinity_ingot", "record_fragment", "starfuel",
|
||||
"neutronium_gear"};
|
||||
"neutronium_gear" };
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon[] icons;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon[] halo;
|
||||
|
||||
public ItemResource(){
|
||||
public ItemResource() {
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
this.setUnlocalizedName("avaritia_resource");
|
||||
@@ -52,13 +53,16 @@ public class ItemResource extends Item implements IHaloRenderItem {
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
@Override
|
||||
public void addInformation(ItemStack item, EntityPlayer player, List tooltip, boolean wut) {
|
||||
|
||||
int meta = item.getItemDamage();
|
||||
if (meta != 0 && meta < 8) {
|
||||
tooltip.add(EnumChatFormatting.DARK_GRAY +""+ EnumChatFormatting.ITALIC + StatCollector.translateToLocal("tooltip."+types[meta]+".desc"));
|
||||
}
|
||||
int meta = item.getItemDamage();
|
||||
if (meta != 0 && meta < 8) {
|
||||
tooltip.add(
|
||||
EnumChatFormatting.DARK_GRAY + ""
|
||||
+ EnumChatFormatting.ITALIC
|
||||
+ StatCollector.translateToLocal("tooltip." + types[meta] + ".desc"));
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -73,7 +77,7 @@ public class ItemResource extends Item implements IHaloRenderItem {
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (int j = 0; j < types.length; ++j) {
|
||||
@@ -82,9 +86,8 @@ public class ItemResource extends Item implements IHaloRenderItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack)
|
||||
{
|
||||
switch(stack.getItemDamage()){
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
switch (stack.getItemDamage()) {
|
||||
case 0:
|
||||
case 2:
|
||||
case 3:
|
||||
@@ -103,69 +106,67 @@ public class ItemResource extends Item implements IHaloRenderItem {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean drawHalo(ItemStack stack) {
|
||||
int meta = stack.getItemDamage();
|
||||
return (meta >= 2 && meta <= 6) || meta >= 8;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean drawHalo(ItemStack stack) {
|
||||
int meta = stack.getItemDamage();
|
||||
return (meta >= 2 && meta <= 6) || meta >= 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getHaloTexture(ItemStack stack) {
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta == 2 || meta == 3 || meta == 4 || meta == 9) {
|
||||
return halo[1];
|
||||
}
|
||||
return halo[0];
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getHaloTexture(ItemStack stack) {
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta == 2 || meta == 3 || meta == 4 || meta == 9) {
|
||||
return halo[1];
|
||||
}
|
||||
return halo[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getHaloSize(ItemStack stack) {
|
||||
int meta = stack.getItemDamage();
|
||||
switch(meta) {
|
||||
case 5:
|
||||
case 6:
|
||||
return 10;
|
||||
}
|
||||
return 8;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getHaloSize(ItemStack stack) {
|
||||
int meta = stack.getItemDamage();
|
||||
switch (meta) {
|
||||
case 5:
|
||||
case 6:
|
||||
return 10;
|
||||
}
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean drawPulseEffect(ItemStack stack) {
|
||||
int meta = stack.getItemDamage();
|
||||
return meta == 5 || meta == 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getHaloColour(ItemStack stack) {
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta == 2) {
|
||||
return 0x33FFFFFF;
|
||||
}
|
||||
if (meta == 3) {
|
||||
return 0x4DFFFFFF;
|
||||
}
|
||||
if (meta == 4 || meta == 9) {
|
||||
return 0x99FFFFFF;
|
||||
}
|
||||
return 0xFF000000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomEntity (ItemStack stack)
|
||||
{
|
||||
int meta = stack.getItemDamage();
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean drawPulseEffect(ItemStack stack) {
|
||||
int meta = stack.getItemDamage();
|
||||
return meta == 5 || meta == 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity createEntity (World world, Entity location, ItemStack itemstack)
|
||||
{
|
||||
int meta = itemstack.getItemDamage();
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getHaloColour(ItemStack stack) {
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta == 2) {
|
||||
return 0x33FFFFFF;
|
||||
}
|
||||
if (meta == 3) {
|
||||
return 0x4DFFFFFF;
|
||||
}
|
||||
if (meta == 4 || meta == 9) {
|
||||
return 0x99FFFFFF;
|
||||
}
|
||||
return 0xFF000000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomEntity(ItemStack stack) {
|
||||
int meta = stack.getItemDamage();
|
||||
return meta == 5 || meta == 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
|
||||
int meta = itemstack.getItemDamage();
|
||||
return (meta == 5 || meta == 6) ? new EntityImmortalItem(world, location, itemstack) : null;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
package fox.spiteful.avaritia.items;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.LudicrousText;
|
||||
import fox.spiteful.avaritia.render.IHaloRenderItem;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -15,20 +12,24 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.LudicrousText;
|
||||
import fox.spiteful.avaritia.render.IHaloRenderItem;
|
||||
|
||||
public class ItemSingularity extends Item implements IHaloRenderItem {
|
||||
|
||||
public static final String[] types = new String[]{"iron", "gold", "lapis", "redstone", "quartz", "copper",
|
||||
"tin", "lead", "silver", "nickel", "enderium", "clay"};
|
||||
public static final int[] colors = new int[]{0xBFBFBF, 0xE8EF23, 0x5a82e2, 0xDF0000, 0xeeebe6, 0xE47200,
|
||||
0xA5C7DE, 0x444072, 0xF9F9F9, 0xDEE187, 0x47736d, 0x8890AD};
|
||||
public static final int[] colors2 = new int[]{0x7F7F7F, 0xdba213, 0x224baf, 0x900000, 0x94867d, 0x89511A,
|
||||
0x9BA9B2, 0x3E3D4E, 0xD5D5D5, 0xC4C698, 0x1a3732, 0x666B7F};
|
||||
public static final String[] types = new String[] { "iron", "gold", "lapis", "redstone", "quartz", "copper", "tin",
|
||||
"lead", "silver", "nickel", "enderium", "clay" };
|
||||
public static final int[] colors = new int[] { 0xBFBFBF, 0xE8EF23, 0x5a82e2, 0xDF0000, 0xeeebe6, 0xE47200, 0xA5C7DE,
|
||||
0x444072, 0xF9F9F9, 0xDEE187, 0x47736d, 0x8890AD };
|
||||
public static final int[] colors2 = new int[] { 0x7F7F7F, 0xdba213, 0x224baf, 0x900000, 0x94867d, 0x89511A,
|
||||
0x9BA9B2, 0x3E3D4E, 0xD5D5D5, 0xC4C698, 0x1a3732, 0x666B7F };
|
||||
public static IIcon background;
|
||||
public static IIcon foreground;
|
||||
|
||||
public ItemSingularity(){
|
||||
public ItemSingularity() {
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
this.setUnlocalizedName("avaritia_singularity");
|
||||
@@ -39,9 +40,10 @@ public class ItemSingularity extends Item implements IHaloRenderItem {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack itemstack, int renderpass) {
|
||||
//System.out.println(foreground);
|
||||
return renderpass == 0 ? colors2[itemstack.getItemDamage() % colors.length] : colors[itemstack.getItemDamage() % colors2.length];
|
||||
//return 0xFFFFFF;
|
||||
// System.out.println(foreground);
|
||||
return renderpass == 0 ? colors2[itemstack.getItemDamage() % colors.length]
|
||||
: colors[itemstack.getItemDamage() % colors2.length];
|
||||
// return 0xFFFFFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,40 +53,38 @@ public class ItemSingularity extends Item implements IHaloRenderItem {
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (int j = 0; j < types.length; ++j) {
|
||||
list.add(new ItemStack(item, 1, j));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister ir) {
|
||||
foreground = ir.registerIcon("avaritia:singularity");
|
||||
background = ir.registerIcon("avaritia:singularity2");
|
||||
foreground = ir.registerIcon("avaritia:singularity");
|
||||
background = ir.registerIcon("avaritia:singularity2");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass)
|
||||
{
|
||||
if (pass == 0) { return background; }
|
||||
return foreground;
|
||||
public IIcon getIcon(ItemStack stack, int pass) {
|
||||
if (pass == 0) {
|
||||
return background;
|
||||
}
|
||||
return foreground;
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean requiresMultipleRenderPasses()
|
||||
{
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack)
|
||||
{
|
||||
if(stack.getItemDamage() == 11)
|
||||
return LudicrousItems.cosmic;
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
if (stack.getItemDamage() == 11) return LudicrousItems.cosmic;
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@@ -94,41 +94,40 @@ public class ItemSingularity extends Item implements IHaloRenderItem {
|
||||
|
||||
int meta = item.getItemDamage();
|
||||
if (meta == 11) {
|
||||
//tooltip.add(EnumChatFormatting.DARK_GRAY +""+ EnumChatFormatting.ITALIC + StatCollector.translateToLocal("tooltip.claybalance.desc"));
|
||||
// tooltip.add(EnumChatFormatting.DARK_GRAY +""+ EnumChatFormatting.ITALIC +
|
||||
// StatCollector.translateToLocal("tooltip.claybalance.desc"));
|
||||
tooltip.add(LudicrousText.makeFabulous(StatCollector.translateToLocal("tooltip.claybalance.desc")));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean drawHalo(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean drawHalo(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getHaloTexture(ItemStack stack) {
|
||||
return ((ItemResource) LudicrousItems.resource).halo[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getHaloTexture(ItemStack stack) {
|
||||
return ((ItemResource)LudicrousItems.resource).halo[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getHaloSize(ItemStack stack) {
|
||||
if(stack.getItemDamage() == 10)
|
||||
return 8;
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getHaloSize(ItemStack stack) {
|
||||
if (stack.getItemDamage() == 10) return 8;
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean drawPulseEffect(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean drawPulseEffect(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getHaloColour(ItemStack stack) {
|
||||
return 0xFF000000;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getHaloColour(ItemStack stack) {
|
||||
return 0xFF000000;
|
||||
}
|
||||
}
|
||||
Loaded 100 of 132 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user