- AuraEffects: init

- Washrecipe's init
This commit is contained in:
HellFirePvP committed 2015-12-07 18:56:24 +01:00
1 parent 7ba6b7c130
commit ef5c32aa4c
13 files changed
+131 -34

No files matched your search

@@ -1,6 +1,7 @@
package makeo.gadomancy.api;
import net.minecraft.entity.Entity;
import thaumcraft.api.aspects.Aspect;
/**
* This class is part of the Gadomancy Mod
@@ -20,4 +21,9 @@ public abstract class AuraEffect {
return 8;
}
public AuraEffect register(Aspect a) {
GadomancyApi.registerAdditionalAuraEffect(a, this);
return this;
}
}
@@ -44,6 +44,7 @@ public abstract class ClickBehavior {
*/
public abstract boolean isValidForBlock();
//TODO not handled as expected.
public boolean hasVisCost() {
return hasVisCost;
}
@@ -5,6 +5,7 @@ import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import makeo.gadomancy.client.ClientProxy;
import makeo.gadomancy.common.aura.AuraEffects;
import makeo.gadomancy.common.containers.ContainerArcanePackager;
import makeo.gadomancy.common.containers.ContainerInfusionClaw;
import makeo.gadomancy.common.data.ModConfig;
@@ -77,6 +78,8 @@ public class CommonProxy implements IGuiHandler {
FMLCommonHandler.instance().bus().register(worldEventHandler);
MinecraftForge.EVENT_BUS.register(new EventHandlerEntity());
AuraEffects.AER.getTickInterval(); //initalize AuraEffects
RegisteredRecipes.init();
ModSubstitutions.init();
@@ -27,7 +27,7 @@ public class AuraEffectHandler {
public static void distributeEffects(Aspect aspect, World worldObj, double x, double y, double z, double range, int tick) {
if(!registeredEffects.containsKey(aspect) || worldObj.isRemote) return;
AuraEffect effect = registeredEffects.get(aspect);
if(tick % effect.getTickInterval() != 0) return;
if((tick % effect.getTickInterval()) != 0) return;
List entitiesInRange = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(x - 0.5, y - 0.5, z - 0.5, x + 0.5, y + 0.5, z + 0.5).expand(range, range, range));
Iterator it = entitiesInRange.iterator();
@@ -47,10 +47,4 @@ public class AuraEffectHandler {
}
}
static {
registeredEffects.put(Aspect.HEAL, AuraEffects.DUMMY_SANO);
}
}
@@ -3,6 +3,11 @@ package makeo.gadomancy.common.aura;
import makeo.gadomancy.api.AuraEffect;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import thaumcraft.api.aspects.Aspect;
import static makeo.gadomancy.common.utils.MiscUtils.*;
/**
* This class is part of the Gadomancy Mod
@@ -14,9 +19,38 @@ import net.minecraft.entity.EntityLivingBase;
*/
public class AuraEffects {
//TODO create and register in AuraEffectHandler
//Potion amplifiers start with 0 == lvl 1!
public static final AuraEffect AER = new PotionDistributionEffect(Potion.moveSpeed, 4, 6, ticksForMinutes(6), 1).register(Aspect.AIR);
public static final AuraEffect AQUA = new PotionDistributionEffect(Potion.waterBreathing, 4, 10, ticksForMinutes(10), 0).register(Aspect.WATER);
public static final AuraEffect TERRA = new PotionDistributionEffect(Potion.resistance, 4, 8, ticksForMinutes(5), 0).register(Aspect.EARTH);
public static final AuraEffect ORDO = new PotionDistributionEffect(Potion.regeneration, 4, 6, ticksForMinutes(3), 0).register(Aspect.ORDER);
public static final AuraEffect PERDITIO = new PotionDistributionEffect(Potion.weakness, 4, 8, ticksForMinutes(3), 0).register(Aspect.ENTROPY);
public static final AuraEffect TELUM = new PotionDistributionEffect(Potion.damageBoost, 4, 6, ticksForMinutes(6), 2).register(Aspect.WEAPON);
public static final AuraEffect TUTAMEN = new PotionDistributionEffect(Potion.resistance, 4, 6, ticksForMinutes(6), 1).register(Aspect.ARMOR);
public static final AuraEffect MOTUS = new PotionDistributionEffect(Potion.moveSpeed, 4, 6, ticksForMinutes(2), 2).register(Aspect.MOTION); //Fast speed for short duration, long charge time
public static final AuraEffect ITER = new PotionDistributionEffect(Potion.moveSpeed, 2, 10, ticksForMinutes(15), 0).register(Aspect.TRAVEL); //Slower speed for long duration, fast charge time
public static final AuraEffect FAMES = new PotionDistributionEffect(Potion.hunger, 4, 6, ticksForMinutes(2), 0).register(Aspect.HUNGER);
public static final AuraEffect LUX = new PotionDistributionEffect(Potion.nightVision, 2, 8, ticksForMinutes(8), 0).register(Aspect.LIGHT);
public static final AuraEffect VOLATUS = new PotionDistributionEffect(Potion.jump, 2, 5, ticksForMinutes(4), 0).register(Aspect.FLIGHT);
public static final AuraEffect POTENTIA = new PotionDistributionEffect(Potion.damageBoost, 4, 6, ticksForMinutes(4), 0).register(Aspect.ENERGY);
public static final AuraEffect SANO = new PotionDistributionEffect(Potion.regeneration, 8, 10, ticksForMinutes(5), 1).register(Aspect.HEAL);
public static class PotionDistributionEffect extends AuraEffect {
private Potion potion;
private int tickInterval, addedDuration, durationCap, amplifier;
public PotionDistributionEffect(Potion potion, int tickInterval, int addedDuration, int durationCap, int amplifier) {
this.potion = potion;
this.tickInterval = tickInterval;
this.addedDuration = addedDuration;
this.durationCap = durationCap;
this.amplifier = amplifier;
}
public static final AuraEffect DUMMY_SANO = new AuraEffect() {
@Override
public boolean isEntityApplicable(Entity e) {
return e instanceof EntityLivingBase;
@@ -24,13 +58,25 @@ public class AuraEffects {
@Override
public void applyEffect(Entity e) {
e.motionY = 0.6;
if(e == null || !(e instanceof EntityLivingBase)) return;
EntityLivingBase living = (EntityLivingBase) e;
int activeDuration = 0;
if(living.isPotionActive(potion)) {
PotionEffect effect = living.getActivePotionEffect(potion);
activeDuration = effect.getDuration();
}
boolean canAdd = (durationCap - activeDuration) >= addedDuration;
if(canAdd) {
living.addPotionEffect(new PotionEffect(potion.getId(), activeDuration + addedDuration, amplifier, true));
}
}
@Override
public int getTickInterval() {
return 2;
return tickInterval;
}
};
}
}
@@ -53,7 +53,7 @@ public class ResearchPageAuraAspects extends ResearchPage {
Collections.sort(knowledge);
int startIndex = pageIndex << 2;
if(knowledge.size() <= startIndex) return new ArrayList<String>(); //Should not happen, because getAdditionalPages should only return indexes within range
return knowledge.subList(startIndex, (startIndex + 3 > knowledge.size()) ? knowledge.size() : startIndex + 3);
return knowledge.subList(startIndex, (startIndex + 4 > knowledge.size()) ? knowledge.size() : startIndex + 4);
}
public static AspectList createPageAspectList(List<String> tagList) {
@@ -57,7 +57,7 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
private int ticksExisted = 0;
private Aspect holdingAspect;
private int amount = 0;
private int maxAmount = 16;
private int maxAmount = 5;
private boolean isMasterTile;
private boolean isInputTile;
@@ -64,6 +64,6 @@ public class ModConfig {
ancientStoneRecipes = config.getBoolean("ancientStoneRecipes", "skyblock", false, "TRUE = Adds recipes for Ancient Stone and Ancient Stone Pedestal (This may be usefull for severs and skyblock packs to craft the Node Manipulator and get more primodial pearls). You have to change this client- and server-side!");
renderParticleDistance = config.getInt("particleRenderDistance", "general", 100, 5, 1000, "Defines, how close a player has to be towards the particle origin to see the particles created by it.");
enableAdditionalNodeTypes = config.getBoolean("disableAdditionalNodeTypes", "general", true, "Enables our custom node types. This might solve some compatibility issues (e.g. WitchingGadgets). You have to change this client- and server-side!");
enableAdditionalNodeTypes = config.getBoolean("disableAdditionalNodeTypes", "general", true, "Enables our custom node types. This might solve some compatibility issues (e.g. WitchingGadgets). You have to change this client- and server-side! Only change when you experience issues with special mods' features ONLY not working when using the mod together with Gadomancy.");
}
}
@@ -182,6 +182,18 @@ public class RegisteredBlocks {
return matrix.crafting ? 15 : 0;
}
});
registerClawClickBehavior(new ClickBehavior(true) {
@Override
public boolean isValidForBlock() {
return block.equals(ConfigBlocks.blockCrystal) && metadata <= 6;
}
/*@Override
public AspectList getVisCost() {
return RegisteredRecipes.costsAuraCoreStart;
}*/
});
}
private static List<ClickBehavior> clawBehaviors = new ArrayList<ClickBehavior>();
@@ -44,7 +44,7 @@ public class RegisteredRecipes {
public static AspectList costsNodeManipulatorMultiblock = new AspectList().add(Aspect.FIRE, 100).add(Aspect.WATER, 100).add(Aspect.EARTH, 100).add(Aspect.AIR, 100).add(Aspect.ORDER, 100).add(Aspect.ENTROPY, 100);
public static AspectList costsEldritchPortalCreatorMultiblock = new AspectList().add(Aspect.FIRE, 150).add(Aspect.WATER, 150).add(Aspect.EARTH, 150).add(Aspect.AIR, 150).add(Aspect.ORDER, 150).add(Aspect.ENTROPY, 150);
public static AspectList costsAuraPylonMultiblock = new AspectList().add(Aspect.FIRE, 150).add(Aspect.WATER, 150).add(Aspect.EARTH, 150).add(Aspect.AIR, 150).add(Aspect.ORDER, 150).add(Aspect.ENTROPY, 150);
public static AspectList costsAuraCoreStart = new AspectList().add(Aspect.FIRE, 100).add(Aspect.WATER, 100).add(Aspect.EARTH, 100).add(Aspect.AIR, 100).add(Aspect.ORDER, 100).add(Aspect.ENTROPY, 100);
public static AspectList costsAuraCoreStart = new AspectList().add(Aspect.FIRE, 70).add(Aspect.WATER, 70).add(Aspect.EARTH, 70).add(Aspect.AIR, 70).add(Aspect.ORDER, 70).add(Aspect.ENTROPY, 70);
public static List multiblockNodeManipulator;
public static List multiblockEldritchPortalCreator;
@@ -171,7 +171,7 @@ public class RegisteredRecipes {
List<IRecipe> recipesUndoAuraCore = new ArrayList<IRecipe>();
for(int i = 1; i < auraCoreTypes.length; i++) {
recipesWashAuraCore[i-1] = ThaumcraftApi.addCrucibleRecipe(SimpleResearchItem.getFullName("GOLEMCOREBREAK"), new ItemStack(RegisteredItems.itemAuraCore), new ItemStack(RegisteredItems.itemAuraCore, 1, i), new AspectList().add(Aspect.MAGIC, 3).add(Aspect.WATER, 2).add(Aspect.HEAL, 4));
recipesWashAuraCore[i-1] = ThaumcraftApi.addCrucibleRecipe(Gadomancy.MODID.toUpperCase() + ".CLEAN_AURA_CORE", new ItemStack(RegisteredItems.itemAuraCore), new ItemStack(RegisteredItems.itemAuraCore, 1, i), new AspectList().add(Aspect.MAGIC, 12).add(Aspect.WATER, 18).add(Aspect.HEAL, 24)); //damn those heal potions
if(auraCoreTypes[i].isUnused()) {
GameRegistry.addShapelessRecipe(new ItemStack(RegisteredItems.itemAuraCore), new ItemStack(RegisteredItems.itemAuraCore, 1, i));
@@ -45,7 +45,9 @@ public class RegisteredResearches {
public static ResearchItem researchEldritchPortalCreator;
public static ResearchItem researchBlockProtector;
//Aura core stuff
public static ResearchItem researchAuraCore;
public static ResearchItem researchCleanAuraCore;
public static ResearchItem researchArcanePackager;
public static ResearchItem researchAuraPylon;
public static ResearchItem researchAuraEffects;
@@ -240,35 +242,51 @@ public class RegisteredResearches {
.setParents(researchOculus.key)
.setPages(new ResearchPage("gadomancy.research_page.ANCIENT_STONES.1"), new ResearchPage(RegisteredRecipes.recipeAncientStone), new ResearchPage(RegisteredRecipes.recipeAncientStonePedestal)).registerResearchItem();
researchAuraCore = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".AURA_CORE", Gadomancy.MODID,
new AspectList(),
0, 6, 2, new ItemStack(RegisteredItems.itemAuraCore))
ItemAuraCore.AuraCoreType[] coreTypes = ItemAuraCore.AuraCoreType.values();
ItemStack[] cores = new ItemStack[coreTypes.length];
for (int i = 0; i < coreTypes.length; i++) {
ItemStack stack = new ItemStack(RegisteredItems.itemAuraCore, 1, 0);
RegisteredItems.itemAuraCore.setCoreType(stack, coreTypes[i]);
cores[i] = stack;
}
//Cores and stuff related to it.
researchAuraCore = new AlternatingResearchItem("AURA_CORE",
-1, 6, 2,
new AspectList().add(Aspect.AURA, 22).add(Aspect.MAGIC, 10).add(Aspect.AIR, 8).add(Aspect.WATER, 8)
.add(Aspect.EARTH, 8).add(Aspect.FIRE, 8).add(Aspect.ORDER, 8).add(Aspect.ENTROPY, 8),
cores)
.setConcealed().setAutoUnlock()
.setPages(new ResearchPage("gadomancy.research_page.AURA_CORE.1")).registerResearchItem();
researchAuraPylon = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".AURA_PYLON", Gadomancy.MODID,
new AspectList(),
1, 9, 2, new ItemStack(RegisteredBlocks.blockAuraPylon, 1, 1))
.setSpecial()
researchCleanAuraCore = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".CLEAN_AURA_CORE", Gadomancy.MODID,
new AspectList().add(Aspect.HEAL, 12).add(Aspect.AURA, 10).add(Aspect.MAGIC, 8),
1, 5, 2, new ItemStack(RegisteredItems.itemAuraCore))
.setConcealed()
.setParents(researchAuraCore.key)
.setPages(new ResearchPage("gadomancy.research_page.CLEAN_AURA_CORE.1"), new ResearchPage(RegisteredRecipes.recipesWashAuraCore), new ResearchPage("gadomancy.research_page.CLEAN_AURA_CORE.3"), new ResearchPage(RegisteredRecipes.recipesUndoAuraCore)).registerResearchItem();
researchAuraPylon = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".AURA_PYLON", Gadomancy.MODID,
new AspectList().add(Aspect.ORDER, 12).add(Aspect.AURA, 20).add(Aspect.MAGIC, 12).add(Aspect.MECHANISM, 8),
0, 9, 2, new ItemStack(RegisteredBlocks.blockAuraPylon, 1, 1))
.setHidden()
.setParents(researchAuraCore.key)
//TODO item Trigger doesn't work?
.setItemTriggers(new ItemStack(RegisteredItems.itemAuraCore, 1, ItemAuraCore.AuraCoreType.ORDER.ordinal()))
.setPages(new ResearchPage("gadomancy.research_page.AURA_PYLON.1"), new ResearchPage(RegisteredRecipes.multiblockAuraPylon)).registerResearchItem();
researchAuraEffects = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS", Gadomancy.MODID,
new AspectList(),
2, 10, 0,
new AspectList().add(Aspect.AURA, 10).add(Aspect.MIND, 8).add(Aspect.MAGIC, 4).add(Aspect.MECHANISM, 8),
1, 10, 2,
new ResourceLocation("thaumcraft", "textures/misc/r_aspects.png"))
.setConcealed()
.setParents(researchAuraPylon.key)
.setPages(new ResearchPage("gadomancy.research_page.AURA_EFFECTS.1")).registerResearchItem();
researchArcanePackager = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".ARCANE_PACKAGER", Gadomancy.MODID,
new AspectList(),
3, 7, 2, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 4))
.setSpecial()
new AspectList().add(Aspect.AIR, 12).add(Aspect.MECHANISM, 16).add(Aspect.VOID, 10).add(Aspect.MAGIC, 10),
2, 7, 2, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 4))
.setHidden()
.setParents(researchAuraCore.key)
//TODO item Trigger doesn't work?
.setItemTriggers(new ItemStack(RegisteredItems.itemAuraCore, 1, ItemAuraCore.AuraCoreType.AIR.ordinal()))
.setPages(new ResearchPage("gadomancy.research_page.ARCANE_PACKAGER.1")).registerResearchItem();
@@ -38,6 +38,14 @@ public final class MiscUtils {
return "th";
}
public static int ticksForMinutes(int minutes) {
return ticksForSeconds(minutes * 60);
}
public static int ticksForSeconds(int seconds) {
return seconds * 20;
}
public static List<ChunkCoordinates> getCoordinatesAround(ChunkCoordinates center) {
List<ChunkCoordinates> coords = new ArrayList<ChunkCoordinates>();
coords.add(new ChunkCoordinates(center.posX, center.posY, center.posZ));