Compare commits
12 commits
Author | SHA1 | Date | |
---|---|---|---|
0629748adf | |||
7e22d8beea | |||
98ac438a98 | |||
7b6099e8e2 | |||
dd679a3e79 | |||
b7b7d74702 | |||
10a7c3a52b | |||
76e740bc26 | |||
d862acc910 | |||
81fe7f456c | |||
0f586391e8 | |||
1d43d7a041 |
41 changed files with 824 additions and 268 deletions
47
build.gradle
47
build.gradle
|
@ -13,11 +13,8 @@ buildscript {
|
|||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.matthewprenger.cursegradle' version '1.2.0'
|
||||
}
|
||||
|
||||
apply plugin: "net.minecraftforge.gradle.forge"
|
||||
apply plugin: 'idea'
|
||||
|
||||
|
||||
def getVersionName = { ->
|
||||
|
@ -29,25 +26,9 @@ def getVersionName = { ->
|
|||
return stdout.toString().trim()
|
||||
}
|
||||
|
||||
def getAPIKey = { ->
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
try {
|
||||
exec {
|
||||
commandLine 'cat', '../apiKey'
|
||||
standardOutput = stdout
|
||||
}
|
||||
return stdout.toString().trim()
|
||||
} catch(Exception e) {
|
||||
return '0'
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
version = getVersionName()
|
||||
group = modGroup
|
||||
archivesBaseName = modBaseName
|
||||
String apiToken = getAPIKey()
|
||||
|
||||
minecraft {
|
||||
version = project.forgeVersion
|
||||
|
@ -92,10 +73,10 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
deobfCompile 'com.gitlab.lcoremodders:LucraftCore:85e6c788'
|
||||
deobfCompile 'com.gitlab.lcoremodders:HeroesExpansion:1.3.3'
|
||||
deobfCompile 'com.gitlab.lcoremodders:SpeedsterHeroes:1e4b1fb951'
|
||||
deobfCompile "star-tech-man-the-legendary-mod:star:tech:1.1.1"
|
||||
compile 'com.gitlab.lcoremodders:LucraftCore:22057ced'
|
||||
compile 'com.gitlab.lcoremodders:HeroesExpansion:860f629ed4'
|
||||
compile 'com.gitlab.lcoremodders:SpeedsterHeroes:1e4b1fb951'
|
||||
compile "star-tech-man-the-legendary-mod:star:tech:1.1.1"
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
}
|
||||
|
||||
|
@ -134,22 +115,4 @@ processResources {
|
|||
}
|
||||
}
|
||||
|
||||
curseforge {
|
||||
apiKey = apiToken
|
||||
project {
|
||||
id = projectID
|
||||
changelog = file('changelog.txt')
|
||||
releaseType = "beta"
|
||||
addGameVersion '1.12.2'
|
||||
|
||||
mainArtifact(jar) {
|
||||
displayName = "Infinity Craft $getVersionName"
|
||||
relations {
|
||||
requiredDependency 'lucraft-core'
|
||||
optionalDependency 'heroesexpansion'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
-Added Kill Evil Entities Snap ability
|
||||
-Stone Colors can be configured now
|
||||
-Improved data storage
|
||||
-Added own Space Stone
|
||||
-Changed stone detection systen (all stones will now be accepted for snap)
|
||||
-Added colors for ability bar
|
||||
-Added API to add stone abilities from other mods
|
|
@ -1,6 +1,6 @@
|
|||
modGroup=anvil
|
||||
modBaseName=infinity
|
||||
forgeVersion=1.12.2-14.23.5.2814
|
||||
forgeVersion=1.12.2-14.23.5.2847
|
||||
mcpVersion=stable_39
|
||||
core_version=d406868225
|
||||
projectID=285509
|
|
@ -3,12 +3,15 @@ package anvil.infinity;
|
|||
import anvil.infinity.capabilities.Factory;
|
||||
import anvil.infinity.capabilities.ICapabilityPlayerData;
|
||||
import anvil.infinity.capabilities.Storage;
|
||||
import anvil.infinity.command.GeneratedCommand;
|
||||
import anvil.infinity.compat.CompatHandler;
|
||||
import anvil.infinity.config.ConfigHandler;
|
||||
import anvil.infinity.config.ModConfig;
|
||||
import anvil.infinity.networking.LookAbilityPackageHandler;
|
||||
import anvil.infinity.networking.LookAbilityReturnPackageHandler;
|
||||
import anvil.infinity.networking.PackageKillAbility;
|
||||
import anvil.infinity.networking.PackageReq;
|
||||
import anvil.infinity.worldgen.InfinityWorldGenerator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
|
@ -16,6 +19,7 @@ import net.minecraftforge.event.RegistryEvent;
|
|||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
|
@ -36,19 +40,12 @@ public class Infinity {
|
|||
public static final String MOD_ID = "infinity";
|
||||
public static final String MOD_NAME = "Infinityraft";
|
||||
public static final String VERSION = "${version}";
|
||||
public static final String DEPENDENCIES = "required-after:lucraftcore@[1.12.2-2.4.0,)";
|
||||
public static final String DEPENDENCIES = "required-after:lucraftcore@[1.12.2-2.4.4,)";
|
||||
public static final SimpleNetworkWrapper NETWORK_WRAPPER = NetworkRegistry.INSTANCE.newSimpleChannel(MOD_ID);
|
||||
|
||||
/**
|
||||
* This is the instance of your mod as created by Forge. It will never be null.
|
||||
*/
|
||||
@Mod.Instance(MOD_ID)
|
||||
public static Infinity INSTANCE;
|
||||
|
||||
/**
|
||||
* This is the first initialization event. Register tile entities here.
|
||||
* The registry events below will have fired prior to entry to this method.
|
||||
*/
|
||||
@Mod.EventHandler
|
||||
public void preinit(FMLPreInitializationEvent event) {
|
||||
ConfigHandler.refreshConfig(event.getSuggestedConfigurationFile());
|
||||
|
@ -58,72 +55,27 @@ public class Infinity {
|
|||
NETWORK_WRAPPER.registerMessage(LookAbilityPackageHandler.class, PackageReq.class, netID++, Side.CLIENT);
|
||||
CapabilityManager.INSTANCE.register(ICapabilityPlayerData.class, new Storage(), new Factory());
|
||||
|
||||
if (ModConfig.Worldgen.enable) {
|
||||
GameRegistry.registerWorldGenerator(new InfinityWorldGenerator(), 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the second initialization event. Register custom recipes
|
||||
*/
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the final initialization event. Register actions from other mods here
|
||||
*/
|
||||
@Mod.EventHandler
|
||||
public void postinit(FMLPostInitializationEvent event) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Forge will automatically look up and bind blocks to the fields in this class
|
||||
* based on their registry name.
|
||||
*/
|
||||
@GameRegistry.ObjectHolder(MOD_ID)
|
||||
public static class Blocks {
|
||||
/*
|
||||
public static final MySpecialBlock mySpecialBlock = null; // placeholder for special block below
|
||||
*/
|
||||
@Mod.EventHandler
|
||||
public static void init(FMLServerStartingEvent event)
|
||||
{
|
||||
event.registerServerCommand(new GeneratedCommand());
|
||||
}
|
||||
|
||||
/**
|
||||
* Forge will automatically look up and bind items to the fields in this class
|
||||
* based on their registry name.
|
||||
*/
|
||||
@GameRegistry.ObjectHolder(MOD_ID)
|
||||
public static class Items {
|
||||
/*
|
||||
public static final ItemBlock mySpecialBlock = null; // itemblock for the block above
|
||||
public static final MySpecialItem mySpecialItem = null; // placeholder for special item below
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a special class that listens to registry events, to allow creation of mod blocks and items at the proper time.
|
||||
*/
|
||||
@Mod.EventBusSubscriber
|
||||
public static class ObjectRegistryHandler {
|
||||
/**
|
||||
* Listen for the register event for creating custom items
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public static void addItems(RegistryEvent.Register<Item> event) {
|
||||
/*
|
||||
event.getRegistry().register(new ItemBlock(Blocks.myBlock).setRegistryName(MOD_ID, "myBlock"));
|
||||
event.getRegistry().register(new MySpecialItem().setRegistryName(MOD_ID, "mySpecialItem"));
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen for the register event for creating custom blocks
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public static void addBlocks(RegistryEvent.Register<Block> event) {
|
||||
/*
|
||||
event.getRegistry().register(new MySpecialBlock().setRegistryName(MOD_ID, "mySpecialBlock"));
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
package anvil.infinity.abilities;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
public class AbilityHasMindStone extends AbilityHasStone {
|
||||
|
||||
public AbilityHasMindStone(EntityLivingBase entity) {
|
||||
super(entity);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package anvil.infinity.abilities;
|
||||
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
public class AbilityHasPowerStone extends AbilityHasStone {
|
||||
|
||||
public AbilityHasPowerStone(EntityLivingBase entity) {
|
||||
super(entity);
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package anvil.infinity.abilities;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
public class AbilityHasRealityStone extends AbilityHasStone {
|
||||
|
||||
public AbilityHasRealityStone(EntityLivingBase entity) {
|
||||
super(entity);
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package anvil.infinity.abilities;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
public class AbilityHasSoulStone extends AbilityHasStone {
|
||||
|
||||
public AbilityHasSoulStone(EntityLivingBase entity) {
|
||||
super(entity);
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package anvil.infinity.abilities;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
public class AbilityHasTimeStone extends AbilityHasStone {
|
||||
|
||||
public AbilityHasTimeStone(EntityLivingBase entity) {
|
||||
super(entity);
|
||||
}
|
||||
}
|
|
@ -3,9 +3,9 @@ package anvil.infinity.abilities;
|
|||
import lucraft.mods.lucraftcore.superpowers.abilities.AbilityConstant;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
public class AbilityHasStone extends AbilityConstant {
|
||||
public class AbilityLocate extends AbilityConstant {
|
||||
|
||||
public AbilityHasStone(EntityLivingBase entity) {
|
||||
public AbilityLocate(EntityLivingBase entity) {
|
||||
super(entity);
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
package anvil.infinity.abilities;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
public class AbilityhasSpaceStone extends AbilityHasStone {
|
||||
|
||||
public AbilityhasSpaceStone(EntityLivingBase entity) {
|
||||
super(entity);
|
||||
}
|
||||
}
|
41
src/main/java/anvil/infinity/api/AbilityAdderHandler.java
Normal file
41
src/main/java/anvil/infinity/api/AbilityAdderHandler.java
Normal file
|
@ -0,0 +1,41 @@
|
|||
package anvil.infinity.api;
|
||||
|
||||
import lucraft.mods.lucraftcore.infinity.EnumInfinityStone;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
|
||||
import lucraft.mods.lucraftcore.util.abilitybar.EnumAbilityBarColor;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AbilityAdderHandler {
|
||||
|
||||
static List<IAbilityAdder> abilityAdders = new ArrayList<>();
|
||||
|
||||
public static void register(IAbilityAdder abilityAdder) {
|
||||
abilityAdders.add(abilityAdder);
|
||||
}
|
||||
|
||||
public static void addAbilities(EnumInfinityStone stone, EntityLivingBase entity, Ability.AbilityMap abilities) {
|
||||
|
||||
for (IAbilityAdder abilityAdder : abilityAdders) {
|
||||
for (StoneAbility ability : abilityAdder.addStoneAbilities(entity, stone)) {
|
||||
abilities.put(ability.abilityName, ability.ability.setDataValue(Ability.BAR_COLOR, getStoneColor(stone)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static EnumAbilityBarColor getStoneColor(EnumInfinityStone stone) {
|
||||
switch (stone) {
|
||||
case MIND: return EnumAbilityBarColor.YELLOW;
|
||||
case SOUL: return EnumAbilityBarColor.ORANGE;
|
||||
case TIME: return EnumAbilityBarColor.GREEN;
|
||||
case POWER: return EnumAbilityBarColor.PURPLE;
|
||||
case SPACE: return EnumAbilityBarColor.LIGHT_BLUE;
|
||||
case REALITY: return EnumAbilityBarColor.RED;
|
||||
default: return EnumAbilityBarColor.WHITE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
12
src/main/java/anvil/infinity/api/IAbilityAdder.java
Normal file
12
src/main/java/anvil/infinity/api/IAbilityAdder.java
Normal file
|
@ -0,0 +1,12 @@
|
|||
package anvil.infinity.api;
|
||||
|
||||
import lucraft.mods.lucraftcore.infinity.EnumInfinityStone;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IAbilityAdder {
|
||||
|
||||
List<StoneAbility> addStoneAbilities(EntityLivingBase entity, EnumInfinityStone stone);
|
||||
|
||||
}
|
15
src/main/java/anvil/infinity/api/StoneAbility.java
Normal file
15
src/main/java/anvil/infinity/api/StoneAbility.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
package anvil.infinity.api;
|
||||
|
||||
import lucraft.mods.lucraftcore.infinity.EnumInfinityStone;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
|
||||
|
||||
public class StoneAbility {
|
||||
|
||||
public String abilityName;
|
||||
public Ability ability;
|
||||
|
||||
public StoneAbility(String abilityName, Ability ability) {
|
||||
this.abilityName = abilityName;
|
||||
this.ability = ability;
|
||||
}
|
||||
}
|
60
src/main/java/anvil/infinity/command/GeneratedCommand.java
Normal file
60
src/main/java/anvil/infinity/command/GeneratedCommand.java
Normal file
|
@ -0,0 +1,60 @@
|
|||
package anvil.infinity.command;
|
||||
|
||||
import anvil.infinity.abilities.AbilityLocate;
|
||||
import anvil.infinity.compat.CompatHandler;
|
||||
import anvil.infinity.config.ModConfig;
|
||||
import anvil.infinity.worldgen.WorldData;
|
||||
import lucraft.mods.heroesexpansion.superpowers.HESuperpowers;
|
||||
import lucraft.mods.lucraftcore.superpowers.SuperpowerHandler;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
|
||||
public class GeneratedCommand extends CommandBase {
|
||||
@Override
|
||||
public String getName() {
|
||||
return "generatedStones";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage(ICommandSender sender) {
|
||||
return "Shows, which stones are generated";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
|
||||
boolean locate = false;
|
||||
if (sender instanceof EntityLivingBase) {
|
||||
locate = Ability.hasAbility((EntityLivingBase) sender, AbilityLocate.class);
|
||||
if (CompatHandler.isHeroesExpansion) {
|
||||
locate = locate || CompatHandler.HeroesExpension.canLocate((EntityLivingBase) sender);
|
||||
}
|
||||
}
|
||||
WorldData data = WorldData.get(server.getWorld(0));
|
||||
ITextComponent msg = new TextComponentString("Generated: ");
|
||||
msg.appendText("\n Space Stone: " + data.space);
|
||||
if (locate)
|
||||
msg.appendText("\n X: " + data.spacex + "\n Z: " + data.spacez + "\n Dim: " + ModConfig.Worldgen.spaceDim);
|
||||
msg.appendText("\n Power Stone: " + data.power);
|
||||
if (locate)
|
||||
msg.appendText("\n X: " + data.powerx + "\n Z: " + data.powerz + "\n Dim: " + ModConfig.Worldgen.powerDim);
|
||||
msg.appendText("\n Mind Stone: " + data.mind);
|
||||
if (locate)
|
||||
msg.appendText("\n X: " + data.mindx + "\n Z: " + data.mindz + "\n Dim: " + ModConfig.Worldgen.mindDim);
|
||||
msg.appendText("\n Soul Stone: " + data.soul);
|
||||
if (locate)
|
||||
msg.appendText("\n X: " + data.soulx + "\n Z: " + data.soulz + "\n Dim: " + ModConfig.Worldgen.soulDim);
|
||||
msg.appendText("\n Time Stone: " + data.time);
|
||||
if (locate)
|
||||
msg.appendText("\n X: " + data.timex + "\n Z: " + data.timez + "\n Dim: " + ModConfig.Worldgen.timeDim);
|
||||
msg.appendText("\n Reality Stone: " + data.reality);
|
||||
if (locate)
|
||||
msg.appendText("\n X: " + data.realityx + "\n Z: " + data.realityz + "\n Dim: " + ModConfig.Worldgen.realityDim);
|
||||
sender.sendMessage(msg);
|
||||
}
|
||||
}
|
|
@ -1,8 +1,11 @@
|
|||
package anvil.infinity.compat;
|
||||
|
||||
import anvil.infinity.abilities.*;
|
||||
import lucraft.mods.heroesexpansion.abilities.AbilityBlackHole;
|
||||
import lucraft.mods.heroesexpansion.abilities.AbilityForceField;
|
||||
import lucraft.mods.heroesexpansion.abilities.AbilityGrabEntity;
|
||||
import lucraft.mods.heroesexpansion.abilities.AbilityPortal;
|
||||
import lucraft.mods.heroesexpansion.superpowers.HESuperpowers;
|
||||
import lucraft.mods.lucraftcore.superpowers.SuperpowerHandler;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
|
@ -14,7 +17,22 @@ public class HELoadedProxy implements HEProxy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSpaceStone(EntityLivingBase entity) {
|
||||
return Ability.hasAbility(entity, AbilityPortal.class);
|
||||
public Ability getAbilityPortal(EntityLivingBase entity) {
|
||||
return new AbilityPortal(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ability getAbilityForcefield(EntityLivingBase entity) {
|
||||
return new AbilityForceField(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ability getAbilityBlackhole(EntityLivingBase entity) {
|
||||
return new AbilityBlackHole(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canLocate(EntityLivingBase entity) {
|
||||
return SuperpowerHandler.hasSuperpower(entity, HESuperpowers.GOD_OF_THUNDER);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,22 @@ public class HENotLoadedProxy implements HEProxy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSpaceStone(EntityLivingBase entity) {
|
||||
return true;
|
||||
public Ability getAbilityForcefield(EntityLivingBase entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ability getAbilityPortal(EntityLivingBase entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ability getAbilityBlackhole(EntityLivingBase entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canLocate(EntityLivingBase entity) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,12 @@ public interface HEProxy {
|
|||
|
||||
Ability getAbilityGrabEntity(EntityLivingBase entity);
|
||||
|
||||
boolean hasSpaceStone(EntityLivingBase entity);
|
||||
Ability getAbilityPortal(EntityLivingBase entity);
|
||||
|
||||
Ability getAbilityForcefield(EntityLivingBase entity);
|
||||
|
||||
Ability getAbilityBlackhole(EntityLivingBase entity);
|
||||
|
||||
boolean canLocate(EntityLivingBase entity);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package anvil.infinity.compat;
|
||||
|
||||
import anvil.infinity.abilities.AbilityHasRealityStone;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
|
||||
import lucraft.mods.speedsterheroes.abilities.AbilityChangeBlocks;
|
||||
import lucraft.mods.speedsterheroes.abilities.AbilitySaveBlock;
|
||||
|
@ -24,9 +23,4 @@ public class SHLoadedProxy implements SHProxy {
|
|||
return new AbilityTurnIntoBubbles(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRealityStone(EntityLivingBase entity) {
|
||||
return Ability.hasAbility(entity, AbilityHasRealityStone.class) || Ability.hasAbility(entity, AbilitySaveBlock.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package anvil.infinity.compat;
|
||||
|
||||
import anvil.infinity.abilities.AbilityHasRealityStone;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
|
@ -21,9 +20,4 @@ public class SHNotLoadedProxy implements SHProxy {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasRealityStone(EntityLivingBase entity) {
|
||||
return Ability.hasAbility(entity, AbilityHasRealityStone.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,4 @@ public interface SHProxy {
|
|||
|
||||
Ability getAbilityTurnIntoBubbles(EntityLivingBase entity);
|
||||
|
||||
boolean hasRealityStone(EntityLivingBase entity);
|
||||
|
||||
}
|
||||
|
|
|
@ -7,15 +7,6 @@ import java.io.File;
|
|||
public class ConfigHandler {
|
||||
|
||||
public static Configuration config;
|
||||
public static boolean soulHealthBoost;
|
||||
public static boolean useSHRealityAbilities;
|
||||
public static boolean sizeChanging;
|
||||
public static float size;
|
||||
public static int soulWorldID;
|
||||
public static boolean snapCreative;
|
||||
public static boolean heAbilities;
|
||||
public static int powerCooldown;
|
||||
public static boolean stAbilities;
|
||||
|
||||
public static int powerStoneColor;
|
||||
public static int powerStoneShine;
|
||||
|
@ -40,18 +31,7 @@ public class ConfigHandler {
|
|||
}
|
||||
|
||||
private static void syncConfig() {
|
||||
String category = Configuration.CATEGORY_GENERAL;
|
||||
String colorcat = Configuration.CATEGORY_CLIENT;
|
||||
soulHealthBoost = config.getBoolean("Soul Stone health boost", category, true, "Should the Soul Stone have a health boost");
|
||||
useSHRealityAbilities = config.getBoolean("SH Reality Stone abilities", category, false, "Should the Reality Stone have the abilities of the Speedster Heroes Reality Stone if it is installed");
|
||||
sizeChanging = config.getBoolean("Size changing", category, true, "Should the Reality Stone be able to change the size");
|
||||
size = config.getFloat("Size", category, 0.1f, 0.1f,10, "Which size should the Reality Stone change it's user to");
|
||||
soulWorldID = config.getInt("Soul World ID", category, 10, -255, 255, "The ID of the Soul World Dimension");
|
||||
snapCreative = config.getBoolean("Can Snap change Gamemode", category, false, "Can the Snap change the Gamemode to Creative");
|
||||
heAbilities = config.getBoolean("HeroesExpansion Abilities", category, true, "Should some stones use abilities from HeroesExpansion");
|
||||
stAbilities = config.getBoolean("StarTech Abilities", category, true, "Should the Power Stone use the abilities from the StarTech Power Stone if installed");
|
||||
powerCooldown = config.getInt("Power Burst Cooldown", category, 100, 0, 1000, "How big long should the StarTech Power Stone burst cooldown be");
|
||||
|
||||
powerStoneColor = config.getInt("Power Stone color", colorcat, 0xC32AD1, 0x000000, 0xFFFFFF, "Color of the Power Stone");
|
||||
powerStoneShine = config.getInt("Power Stone shine", colorcat, 0xF12AFF, 0x000000, 0xFFFFFF, "Shine color of the Power Stone");
|
||||
realityStoneColor = config.getInt("Reality Stone color", colorcat, 0xFF0130, 0x000000, 0xFFFFFF, "Color of the Reality Stone");
|
||||
|
@ -62,6 +42,8 @@ public class ConfigHandler {
|
|||
mindStoneShine = config.getInt("Mind Stone shine", colorcat, 0xDAFF0A, 0x000000, 0xFFFFFF, "Shine color of the Mind Stone");
|
||||
soulStoneColor = config.getInt("Soul Stone color", colorcat, 0xDE7300, 0x000000, 0xFFFFFF, "Color of the Soul Stone");
|
||||
soulStoneShine = config.getInt("Soul Stone shine", colorcat, 0xFF8B00, 0x000000, 0xFFFFFF, "Shine color of the Soul Stone");
|
||||
spaceStoneColor = config.getInt("Space Stone color", colorcat, 0x0255ff, 0x000000, 0xFFFFFF, "Color of the Space Stone");
|
||||
spaceStoneShine = config.getInt("Space Stone shine", colorcat, 0x6ac5ff, 0x000000, 0xFFFFFF, "Shine color of the Space Stone");
|
||||
|
||||
}
|
||||
|
||||
|
|
81
src/main/java/anvil/infinity/config/ModConfig.java
Normal file
81
src/main/java/anvil/infinity/config/ModConfig.java
Normal file
|
@ -0,0 +1,81 @@
|
|||
package anvil.infinity.config;
|
||||
|
||||
import anvil.infinity.Infinity;
|
||||
import net.minecraftforge.common.config.Config;
|
||||
|
||||
@Config(modid = Infinity.MOD_ID)
|
||||
public class ModConfig {
|
||||
|
||||
@Config(modid = Infinity.MOD_ID, category = "general")
|
||||
public static class General {
|
||||
|
||||
@Config.Name("Soul Stone health boost")
|
||||
@Config.Comment("Should the Soul Stone have a health boost")
|
||||
public static boolean soulHealthBoost = true;
|
||||
|
||||
@Config.Name("SH Reality Stone abilities")
|
||||
@Config.Comment("Should the Reality Stone have the abilities of the Speedster Heroes Reality Stone if it is installed")
|
||||
public static boolean useSHRealityAbilities = false;
|
||||
|
||||
@Config.Name("Size changing")
|
||||
@Config.Comment("Should the Reality Stone be able to change the size")
|
||||
public static boolean sizeChanging = false;
|
||||
|
||||
@Config.Name("Size")
|
||||
@Config.Comment("Which size should the Reality Stone change it's user to")
|
||||
@Config.RangeDouble(min = 0.1f, max = 10)
|
||||
public static float size = 0.1f;
|
||||
|
||||
|
||||
public static int soulWorldID;
|
||||
|
||||
@Config.Name("Can Snap change Gamemode")
|
||||
@Config.Comment("Can the Snap change the Gamemode to Creative")
|
||||
public static boolean snapCreative = false;
|
||||
|
||||
@Config.Name("HeroesExpansion Abilities")
|
||||
@Config.Comment("Should some stones use abilities from HeroesExpansion")
|
||||
public static boolean heAbilities = true;
|
||||
|
||||
@Config.Name("StarTech Abilities")
|
||||
@Config.Comment("Should the Power Stone use the abilities from the StarTech Power Stone if installed")
|
||||
public static boolean stAbilities = true;
|
||||
|
||||
|
||||
@Config.Name("Power Burst Cooldown")
|
||||
@Config.Comment("How big long should the StarTech Power Stone burst cooldown be")
|
||||
@Config.RangeInt(min = 0, max = 1000)
|
||||
public static int powerCooldown = 100;
|
||||
}
|
||||
|
||||
@Config(category = "worldgen", modid = Infinity.MOD_ID)
|
||||
public static class Worldgen {
|
||||
|
||||
@Config.Name("Enable Stone worldgen")
|
||||
public static boolean enable = true;
|
||||
|
||||
@Config.Name("Power Stone Dimension")
|
||||
public static int powerDim = 0;
|
||||
|
||||
@Config.Name("Space Stone Dimension")
|
||||
public static int spaceDim = 0;
|
||||
|
||||
@Config.Name("Reality Stone Dimension")
|
||||
public static int realityDim = 0;
|
||||
|
||||
@Config.Name("Soul Stone Dimension")
|
||||
public static int soulDim = 0;
|
||||
|
||||
@Config.Name("Time Stone Dimension")
|
||||
public static int timeDim = 0;
|
||||
|
||||
@Config.Name("Mind Stone Dimension")
|
||||
public static int mindDim = 0;
|
||||
|
||||
@Config.Name("Worldgen Debug")
|
||||
@Config.Comment("WARNING: Console Spam")
|
||||
public static boolean debug = false;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,37 +1,34 @@
|
|||
package anvil.infinity.helpers;
|
||||
|
||||
import anvil.infinity.abilities.*;
|
||||
import anvil.infinity.compat.CompatHandler;
|
||||
import lucraft.mods.lucraftcore.infinity.EnumInfinityStone;
|
||||
import lucraft.mods.lucraftcore.infinity.items.ItemInfinityStone;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
public class GauntelHelper {
|
||||
|
||||
public static boolean hasPowerStone(EntityLivingBase entity) {
|
||||
return Ability.hasAbility(entity, AbilityHasPowerStone.class);
|
||||
return ItemInfinityStone.hasStone(entity, Ability.EnumAbilityContext.MAIN_HAND, EnumInfinityStone.POWER) || ItemInfinityStone.hasStone(entity, Ability.EnumAbilityContext.OFF_HAND, EnumInfinityStone.POWER);
|
||||
}
|
||||
|
||||
public static boolean hasSpaceStone(EntityLivingBase entity) {
|
||||
return CompatHandler.HeroesExpension.hasSpaceStone(entity);
|
||||
return ItemInfinityStone.hasStone(entity, Ability.EnumAbilityContext.MAIN_HAND, EnumInfinityStone.SPACE) || ItemInfinityStone.hasStone(entity, Ability.EnumAbilityContext.OFF_HAND, EnumInfinityStone.SPACE);
|
||||
}
|
||||
|
||||
public static boolean hasRealityStone(EntityLivingBase entity) {
|
||||
if (CompatHandler.isSpeedsterHeroes) {
|
||||
return CompatHandler.SpeedsterHeroes.hasRealityStone(entity);
|
||||
}
|
||||
return Ability.hasAbility(entity, AbilityHasRealityStone.class);
|
||||
return ItemInfinityStone.hasStone(entity, Ability.EnumAbilityContext.MAIN_HAND, EnumInfinityStone.REALITY) || ItemInfinityStone.hasStone(entity, Ability.EnumAbilityContext.OFF_HAND, EnumInfinityStone.REALITY);
|
||||
}
|
||||
|
||||
public static boolean hasSoulStone(EntityLivingBase entity) {
|
||||
return Ability.hasAbility(entity, AbilityHasSoulStone.class);
|
||||
return ItemInfinityStone.hasStone(entity, Ability.EnumAbilityContext.MAIN_HAND, EnumInfinityStone.SOUL) || ItemInfinityStone.hasStone(entity, Ability.EnumAbilityContext.OFF_HAND, EnumInfinityStone.SOUL);
|
||||
}
|
||||
|
||||
public static boolean hasTimeStone(EntityLivingBase entity) {
|
||||
return Ability.hasAbility(entity, AbilityHasTimeStone.class);
|
||||
return ItemInfinityStone.hasStone(entity, Ability.EnumAbilityContext.MAIN_HAND, EnumInfinityStone.TIME) || ItemInfinityStone.hasStone(entity, Ability.EnumAbilityContext.OFF_HAND, EnumInfinityStone.TIME);
|
||||
}
|
||||
|
||||
public static boolean hasMindStone(EntityLivingBase entity) {
|
||||
return Ability.hasAbility(entity, AbilityHasMindStone.class);
|
||||
return ItemInfinityStone.hasStone(entity, Ability.EnumAbilityContext.MAIN_HAND, EnumInfinityStone.MIND) || ItemInfinityStone.hasStone(entity, Ability.EnumAbilityContext.OFF_HAND, EnumInfinityStone.MIND);
|
||||
}
|
||||
|
||||
public static boolean hasFullGauntlet(EntityLivingBase entity) {
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package anvil.infinity.items;
|
||||
|
||||
import anvil.infinity.abilities.AbilityChangeSnap;
|
||||
import anvil.infinity.abilities.AbilityHasMindStone;
|
||||
import anvil.infinity.api.AbilityAdderHandler;
|
||||
import anvil.infinity.compat.CompatHandler;
|
||||
import anvil.infinity.config.ConfigHandler;
|
||||
import anvil.infinity.config.ModConfig;
|
||||
import lucraft.mods.lucraftcore.infinity.EnumInfinityStone;
|
||||
import lucraft.mods.lucraftcore.infinity.ModuleInfinity;
|
||||
import lucraft.mods.lucraftcore.infinity.items.ItemInfinityStone;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.AbilityFlight;
|
||||
import lucraft.mods.lucraftcore.util.abilitybar.EnumAbilityBarColor;
|
||||
import lucraft.mods.lucraftcore.util.helper.StringHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
|
@ -35,12 +37,14 @@ public class ItemMindStone extends ItemInfinityStone {
|
|||
|
||||
@Override
|
||||
public Ability.AbilityMap addStoneAbilities(EntityLivingBase entity, Ability.AbilityMap abilities, Ability.EnumAbilityContext context) {
|
||||
abilities.put("flight", new AbilityFlight(entity).setDataValue(AbilityFlight.SPEED, 1f));
|
||||
abilities.put("mind", new AbilityHasMindStone(entity));
|
||||
abilities.put("changesnap", new AbilityChangeSnap(entity));
|
||||
if (CompatHandler.isHeroesExpansion && ConfigHandler.heAbilities) {
|
||||
abilities.put("telekinesis", CompatHandler.HeroesExpension.getAbilityGrabEntity(entity));
|
||||
abilities.put("flight", new AbilityFlight(entity).setDataValue(AbilityFlight.SPEED, 1f).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.YELLOW));
|
||||
abilities.put("changesnap", new AbilityChangeSnap(entity).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.YELLOW));
|
||||
if (CompatHandler.isHeroesExpansion && ModConfig.General.heAbilities) {
|
||||
abilities.put("telekinesis", CompatHandler.HeroesExpension.getAbilityGrabEntity(entity).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.YELLOW));
|
||||
}
|
||||
|
||||
AbilityAdderHandler.addAbilities(EnumInfinityStone.MIND, entity, abilities);
|
||||
|
||||
return super.addStoneAbilities(entity, abilities, context);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package anvil.infinity.items;
|
||||
|
||||
import anvil.infinity.abilities.AbilityHasPowerStone;
|
||||
import anvil.infinity.abilities.AbilitySaturation;
|
||||
import anvil.infinity.api.AbilityAdderHandler;
|
||||
import anvil.infinity.compat.CompatHandler;
|
||||
import anvil.infinity.config.ConfigHandler;
|
||||
import anvil.infinity.config.ModConfig;
|
||||
import lucraft.mods.lucraftcore.infinity.EnumInfinityStone;
|
||||
import lucraft.mods.lucraftcore.infinity.ModuleInfinity;
|
||||
import lucraft.mods.lucraftcore.infinity.items.ItemInfinityStone;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.*;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.supplier.IAbilityProvider;
|
||||
import lucraft.mods.lucraftcore.util.abilitybar.EnumAbilityBarColor;
|
||||
import lucraft.mods.lucraftcore.util.helper.StringHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -37,18 +39,21 @@ public class ItemPowerStone extends ItemInfinityStone implements IAbilityProvide
|
|||
|
||||
@Override
|
||||
public Ability.AbilityMap addStoneAbilities(EntityLivingBase entity, Ability.AbilityMap abilities, Ability.EnumAbilityContext context) {
|
||||
abilities.put("power", new AbilityHasPowerStone(entity));
|
||||
abilities.put("blast", new AbilityEnergyBlast(entity).setDataValue(AbilityEnergyBlast.DAMAGE, Float.MAX_VALUE).setDataValue(AbilityEnergyBlast.COLOR, Color.MAGENTA));
|
||||
abilities.put("strength", new AbilityStrength(entity).setDataValue(AbilityAttributeModifier.AMOUNT, Float.MAX_VALUE));
|
||||
abilities.put("damage", new AbilityPunch(entity).setDataValue(AbilityPunch.AMOUNT, Float.MAX_VALUE));
|
||||
abilities.put("resistance", new AbilityDamageResistance(entity).setDataValue(AbilityAttributeModifier.AMOUNT, Float.MAX_VALUE));
|
||||
abilities.put("blast", new AbilityEnergyBlast(entity).setDataValue(AbilityEnergyBlast.DAMAGE, Float.MAX_VALUE).setDataValue(AbilityEnergyBlast.COLOR, Color.MAGENTA).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.PURPLE));
|
||||
abilities.put("strength", new AbilityStrength(entity).setDataValue(AbilityAttributeModifier.AMOUNT, Float.MAX_VALUE).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.PURPLE));
|
||||
abilities.put("damage", new AbilityPunch(entity).setDataValue(AbilityPunch.AMOUNT, Float.MAX_VALUE).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.PURPLE));
|
||||
abilities.put("resistance", new AbilityDamageResistance(entity).setDataValue(AbilityAttributeModifier.AMOUNT, Float.MAX_VALUE).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.PURPLE));
|
||||
abilities.put("saturation", new AbilitySaturation(entity));
|
||||
if (CompatHandler.isStarTech && ConfigHandler.stAbilities) {
|
||||
abilities.put("power_blat", CompatHandler.StarTech.getAbilityPowerBlast(entity).setMaxCooldown(ConfigHandler.powerCooldown));
|
||||
abilities.put("power_impower", CompatHandler.StarTech.getAbilityPowerImpower(entity));
|
||||
abilities.put("power_rocket_burst", CompatHandler.StarTech.getAbilityPowerRocketBurst(entity).setMaxCooldown(100));
|
||||
abilities.put("power_tendrils", CompatHandler.StarTech.getAbilityTendrils(entity));
|
||||
if (CompatHandler.isStarTech && ModConfig.General.stAbilities) {
|
||||
abilities.put("power_blat", CompatHandler.StarTech.getAbilityPowerBlast(entity).setMaxCooldown(ModConfig.General.powerCooldown).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.PURPLE));
|
||||
abilities.put("power_impower", CompatHandler.StarTech.getAbilityPowerImpower(entity).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.PURPLE));
|
||||
abilities.put("power_rocket_burst", CompatHandler.StarTech.getAbilityPowerRocketBurst(entity).setMaxCooldown(100).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.PURPLE));
|
||||
abilities.put("power_tendrils", CompatHandler.StarTech.getAbilityTendrils(entity).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.PURPLE));
|
||||
}
|
||||
|
||||
AbilityAdderHandler.addAbilities(EnumInfinityStone.POWER, entity, abilities);
|
||||
|
||||
|
||||
return super.addStoneAbilities(entity, abilities, context);
|
||||
}
|
||||
|
||||
|
@ -63,7 +68,7 @@ public class ItemPowerStone extends ItemInfinityStone implements IAbilityProvide
|
|||
abilities.put("strength", new AbilityStrength(entity).setDataValue(AbilityAttributeModifier.AMOUNT, Float.MAX_VALUE));
|
||||
abilities.put("damage", new AbilityPunch(entity).setDataValue(AbilityPunch.AMOUNT, Float.MAX_VALUE));
|
||||
abilities.put("resistance", new AbilityDamageResistance(entity).setDataValue(AbilityAttributeModifier.AMOUNT, Float.MAX_VALUE));
|
||||
if (CompatHandler.isStarTech && ConfigHandler.stAbilities) {
|
||||
if (CompatHandler.isStarTech && ModConfig.General.stAbilities) {
|
||||
abilities.put("power_tendrils", CompatHandler.StarTech.getAbilityTendrils(entity));
|
||||
abilities.put("power_cyclone", CompatHandler.StarTech.getAbilityCyclone(entity));
|
||||
abilities.put("power_burnout", CompatHandler.StarTech.getAbilityBurnout(entity));
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package anvil.infinity.items;
|
||||
|
||||
import anvil.infinity.abilities.AbilityHasRealityStone;
|
||||
import anvil.infinity.api.AbilityAdderHandler;
|
||||
import anvil.infinity.compat.CompatHandler;
|
||||
import anvil.infinity.config.ConfigHandler;
|
||||
import anvil.infinity.config.ModConfig;
|
||||
import lucraft.mods.lucraftcore.infinity.EnumInfinityStone;
|
||||
import lucraft.mods.lucraftcore.infinity.ModuleInfinity;
|
||||
import lucraft.mods.lucraftcore.infinity.items.ItemInfinityStone;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.AbilityInvisibility;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.AbilitySizeChange;
|
||||
import lucraft.mods.lucraftcore.util.abilitybar.EnumAbilityBarColor;
|
||||
import lucraft.mods.lucraftcore.util.helper.StringHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
|
@ -34,16 +36,18 @@ public class ItemRealityStone extends ItemInfinityStone {
|
|||
|
||||
@Override
|
||||
public Ability.AbilityMap addStoneAbilities(EntityLivingBase entity, Ability.AbilityMap abilities, Ability.EnumAbilityContext context) {
|
||||
if (ConfigHandler.sizeChanging) {
|
||||
abilities.put("size", new AbilitySizeChange(entity).setDataValue(AbilitySizeChange.SIZE, ConfigHandler.size));
|
||||
if (ModConfig.General.sizeChanging) {
|
||||
abilities.put("size", new AbilitySizeChange(entity).setDataValue(AbilitySizeChange.SIZE, ModConfig.General.size).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.RED));
|
||||
}
|
||||
abilities.put("invisibility", new AbilityInvisibility(entity));
|
||||
abilities.put("reality", new AbilityHasRealityStone(entity));
|
||||
if (CompatHandler.isSpeedsterHeroes && ConfigHandler.useSHRealityAbilities) {
|
||||
abilities.put("save_block", CompatHandler.SpeedsterHeroes.getAbilitySaveBlock(entity));
|
||||
abilities.put("change_block", CompatHandler.SpeedsterHeroes.getAbilityChangeBlock(entity));
|
||||
abilities.put("turn_into_bubbles", CompatHandler.SpeedsterHeroes.getAbilityTurnIntoBubbles(entity));
|
||||
abilities.put("invisibility", new AbilityInvisibility(entity).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.RED));
|
||||
if (CompatHandler.isSpeedsterHeroes && ModConfig.General.useSHRealityAbilities) {
|
||||
abilities.put("save_block", CompatHandler.SpeedsterHeroes.getAbilitySaveBlock(entity).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.RED));
|
||||
abilities.put("change_block", CompatHandler.SpeedsterHeroes.getAbilityChangeBlock(entity).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.RED));
|
||||
abilities.put("turn_into_bubbles", CompatHandler.SpeedsterHeroes.getAbilityTurnIntoBubbles(entity).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.RED));
|
||||
}
|
||||
|
||||
AbilityAdderHandler.addAbilities(EnumInfinityStone.REALITY, entity, abilities);
|
||||
|
||||
return super.addStoneAbilities(entity, abilities, context);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package anvil.infinity.items;
|
||||
|
||||
import anvil.infinity.abilities.AbilityHasSoulStone;
|
||||
import anvil.infinity.abilities.AbilityKill;
|
||||
import anvil.infinity.abilities.AbilitySnap;
|
||||
import anvil.infinity.api.AbilityAdderHandler;
|
||||
import anvil.infinity.conditions.ICondition;
|
||||
import anvil.infinity.config.ConfigHandler;
|
||||
import anvil.infinity.config.ModConfig;
|
||||
import anvil.infinity.helpers.GauntelHelper;
|
||||
import lucraft.mods.lucraftcore.infinity.EnumInfinityStone;
|
||||
import lucraft.mods.lucraftcore.infinity.ModuleInfinity;
|
||||
|
@ -13,6 +14,7 @@ import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
|
|||
import lucraft.mods.lucraftcore.superpowers.abilities.AbilityAttributeModifier;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.AbilityHealing;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.AbilityHealth;
|
||||
import lucraft.mods.lucraftcore.util.abilitybar.EnumAbilityBarColor;
|
||||
import lucraft.mods.lucraftcore.util.helper.StringHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
|
@ -45,13 +47,15 @@ public class ItemSoulStone extends ItemInfinityStone {
|
|||
|
||||
@Override
|
||||
public Ability.AbilityMap addStoneAbilities(EntityLivingBase entity, Ability.AbilityMap abilities, Ability.EnumAbilityContext context) {
|
||||
if (ConfigHandler.soulHealthBoost) {
|
||||
abilities.put("immortality", new AbilityHealth(entity).setDataValue(AbilityAttributeModifier.AMOUNT, Float.MAX_VALUE));
|
||||
if (ModConfig.General.soulHealthBoost) {
|
||||
abilities.put("immortality", new AbilityHealth(entity).setDataValue(AbilityAttributeModifier.AMOUNT, Float.MAX_VALUE).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.ORANGE));
|
||||
}
|
||||
abilities.put("healing", new AbilityHealing(entity).setDataValue(AbilityHealing.FREQUENCY, 1));
|
||||
abilities.put("soul", new AbilityHasSoulStone(entity));
|
||||
abilities.put("kill", new AbilityKill(entity, killCond));
|
||||
abilities.put("snap", new AbilitySnap(entity));
|
||||
abilities.put("healing", new AbilityHealing(entity).setDataValue(AbilityHealing.FREQUENCY, 1).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.ORANGE));
|
||||
abilities.put("kill", new AbilityKill(entity, killCond).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.ORANGE));
|
||||
abilities.put("snap", new AbilitySnap(entity).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.ORANGE));
|
||||
|
||||
AbilityAdderHandler.addAbilities(EnumInfinityStone.SOUL, entity, abilities);
|
||||
|
||||
return super.addStoneAbilities(entity, abilities, context);
|
||||
}
|
||||
|
||||
|
|
54
src/main/java/anvil/infinity/items/ItemSpaceStone.java
Normal file
54
src/main/java/anvil/infinity/items/ItemSpaceStone.java
Normal file
|
@ -0,0 +1,54 @@
|
|||
package anvil.infinity.items;
|
||||
|
||||
import anvil.infinity.abilities.AbilityLocate;
|
||||
import anvil.infinity.api.AbilityAdderHandler;
|
||||
import anvil.infinity.compat.CompatHandler;
|
||||
import anvil.infinity.helpers.GauntelHelper;
|
||||
import lucraft.mods.lucraftcore.infinity.EnumInfinityStone;
|
||||
import lucraft.mods.lucraftcore.infinity.ModuleInfinity;
|
||||
import lucraft.mods.lucraftcore.infinity.items.ItemInfinityStone;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
|
||||
import lucraft.mods.lucraftcore.util.abilitybar.EnumAbilityBarColor;
|
||||
import lucraft.mods.lucraftcore.util.helper.StringHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
public class ItemSpaceStone extends ItemInfinityStone {
|
||||
|
||||
public ItemSpaceStone(String name) {
|
||||
this.setTranslationKey(name);
|
||||
this.setRegistryName(StringHelper.unlocalizedToResourceName(name));
|
||||
this.setCreativeTab(ModuleInfinity.TAB);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInfinityStone getType() {
|
||||
return EnumInfinityStone.SPACE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isContainer() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ability.AbilityMap addStoneAbilities(EntityLivingBase entity, Ability.AbilityMap abilities, Ability.EnumAbilityContext context) {
|
||||
|
||||
if (CompatHandler.isHeroesExpansion) {
|
||||
abilities.put("portal", CompatHandler.HeroesExpension.getAbilityPortal(entity).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.LIGHT_BLUE));
|
||||
abilities.put("grab_entity", CompatHandler.HeroesExpension.getAbilityGrabEntity(entity).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.LIGHT_BLUE));
|
||||
abilities.put("forcefield", CompatHandler.HeroesExpension.getAbilityForcefield(entity).setMaxCooldown(60).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.LIGHT_BLUE));
|
||||
abilities.put("locate", new AbilityLocate(entity));
|
||||
|
||||
if (GauntelHelper.hasPowerStone(entity)) {
|
||||
abilities.put("blackhole", CompatHandler.HeroesExpension.getAbilityBlackhole(entity).setMaxCooldown(6000).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.LIGHT_BLUE));
|
||||
}
|
||||
}
|
||||
|
||||
AbilityAdderHandler.addAbilities(EnumInfinityStone.SPACE, entity, abilities);
|
||||
|
||||
|
||||
return super.addStoneAbilities(entity, abilities, context);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,12 +1,13 @@
|
|||
package anvil.infinity.items;
|
||||
|
||||
import anvil.infinity.abilities.AbilityFastForward;
|
||||
import anvil.infinity.abilities.AbilityHasTimeStone;
|
||||
import anvil.infinity.abilities.AbilityStopTime;
|
||||
import anvil.infinity.api.AbilityAdderHandler;
|
||||
import lucraft.mods.lucraftcore.infinity.EnumInfinityStone;
|
||||
import lucraft.mods.lucraftcore.infinity.ModuleInfinity;
|
||||
import lucraft.mods.lucraftcore.infinity.items.ItemInfinityStone;
|
||||
import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
|
||||
import lucraft.mods.lucraftcore.util.abilitybar.EnumAbilityBarColor;
|
||||
import lucraft.mods.lucraftcore.util.helper.StringHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
|
@ -32,9 +33,12 @@ public class ItemTimeStone extends ItemInfinityStone {
|
|||
|
||||
@Override
|
||||
public Ability.AbilityMap addStoneAbilities(EntityLivingBase entity, Ability.AbilityMap abilities, Ability.EnumAbilityContext context) {
|
||||
abilities.put("time", new AbilityHasTimeStone(entity));
|
||||
abilities.put("fast_forward", new AbilityFastForward(entity));
|
||||
abilities.put("stop_time", new AbilityStopTime(entity));
|
||||
abilities.put("fast_forward", new AbilityFastForward(entity).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.GREEN));
|
||||
abilities.put("stop_time", new AbilityStopTime(entity).setDataValue(Ability.BAR_COLOR, EnumAbilityBarColor.GREEN));
|
||||
|
||||
AbilityAdderHandler.addAbilities(EnumInfinityStone.TIME, entity, abilities);
|
||||
|
||||
|
||||
return super.addStoneAbilities(entity, abilities, context);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ public class Items {
|
|||
public static Item REALITY_STONE = new ItemRealityStone("reality_stone");
|
||||
public static Item SOUL_STONE = new ItemSoulStone("soul_stone");
|
||||
public static Item TIME_STONE = new ItemTimeStone("time_stone");
|
||||
public static Item SPACE_STONE = new ItemSpaceStone("space_stone");
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRegisterItems(RegistryEvent.Register<Item> e) {
|
||||
|
@ -32,6 +33,7 @@ public class Items {
|
|||
e.getRegistry().register(REALITY_STONE);
|
||||
e.getRegistry().register(SOUL_STONE);
|
||||
e.getRegistry().register(TIME_STONE);
|
||||
e.getRegistry().register(SPACE_STONE);
|
||||
|
||||
}
|
||||
|
||||
|
@ -45,6 +47,7 @@ public class Items {
|
|||
REALITY_STONE.setTileEntityItemStackRenderer(new ItemRendererInfinityStone(new Color(ConfigHandler.realityStoneColor), new Color(ConfigHandler.realityStoneShine)));
|
||||
SOUL_STONE.setTileEntityItemStackRenderer(new ItemRendererInfinityStone(new Color(ConfigHandler.soulStoneColor), new Color(ConfigHandler.soulStoneShine)));
|
||||
TIME_STONE.setTileEntityItemStackRenderer(new ItemRendererInfinityStone(new Color(ConfigHandler.timeStoneColor), new Color(ConfigHandler.timeStoneShine)));
|
||||
SPACE_STONE.setTileEntityItemStackRenderer(new ItemRendererInfinityStone(new Color(ConfigHandler.spaceStoneColor), new Color(ConfigHandler.spaceStoneShine)));
|
||||
|
||||
|
||||
ItemHelper.registerItemModel(POWER_STONE, Infinity.MOD_ID, "power_stone");
|
||||
|
@ -52,6 +55,7 @@ public class Items {
|
|||
ItemHelper.registerItemModel(REALITY_STONE, Infinity.MOD_ID, "reality_stone");
|
||||
ItemHelper.registerItemModel(SOUL_STONE, Infinity.MOD_ID, "soul_stone");
|
||||
ItemHelper.registerItemModel(TIME_STONE, Infinity.MOD_ID, "time_stone");
|
||||
ItemHelper.registerItemModel(SPACE_STONE, Infinity.MOD_ID, "space_stone");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -14,18 +14,12 @@ public class Abilities {
|
|||
@SubscribeEvent
|
||||
public static void onRegisterAbilities(RegistryEvent.Register<AbilityEntry> e) {
|
||||
e.getRegistry().register(new AbilityEntry(AbilitySnap.class, new ResourceLocation(Infinity.MOD_ID, "snap")));
|
||||
e.getRegistry().register(new AbilityEntry(AbilityHasStone.class, new ResourceLocation(Infinity.MOD_ID, "stone")));
|
||||
e.getRegistry().register(new AbilityEntry(AbilityHasPowerStone.class, new ResourceLocation(Infinity.MOD_ID, "power")));
|
||||
e.getRegistry().register(new AbilityEntry(AbilityhasSpaceStone.class, new ResourceLocation(Infinity.MOD_ID, "space")));
|
||||
e.getRegistry().register(new AbilityEntry(AbilityHasRealityStone.class, new ResourceLocation(Infinity.MOD_ID, "reality")));
|
||||
e.getRegistry().register(new AbilityEntry(AbilityHasSoulStone.class, new ResourceLocation(Infinity.MOD_ID, "soul")));
|
||||
e.getRegistry().register(new AbilityEntry(AbilityHasTimeStone.class, new ResourceLocation(Infinity.MOD_ID, "time")));
|
||||
e.getRegistry().register(new AbilityEntry(AbilityHasMindStone.class, new ResourceLocation(Infinity.MOD_ID, "mind")));
|
||||
e.getRegistry().register(new AbilityEntry(AbilityKill.class, new ResourceLocation(Infinity.MOD_ID, "kill")));
|
||||
e.getRegistry().register(new AbilityEntry(AbilityChangeSnap.class, new ResourceLocation(Infinity.MOD_ID, "changesnap")));
|
||||
e.getRegistry().register(new AbilityEntry(AbilitySaturation.class, new ResourceLocation(Infinity.MOD_ID, "saturation")));
|
||||
e.getRegistry().register(new AbilityEntry(AbilityFastForward.class, new ResourceLocation(Infinity.MOD_ID, "fast_forward")));
|
||||
e.getRegistry().register(new AbilityEntry(AbilityStopTime.class, new ResourceLocation(Infinity.MOD_ID, "stop_time")));
|
||||
e.getRegistry().register(new AbilityEntry(AbilityLocate.class, new ResourceLocation(Infinity.MOD_ID, "locate")));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package anvil.infinity.snap;
|
|||
import anvil.infinity.capabilities.ICapabilityPlayerData;
|
||||
import anvil.infinity.config.ConfigHandler;
|
||||
import anvil.infinity.capabilities.GauntletUserInformation;
|
||||
import anvil.infinity.config.ModConfig;
|
||||
import anvil.infinity.helpers.GauntelHelper;
|
||||
import anvil.infinity.registry.Effects;
|
||||
import lucraft.mods.lucraftcore.karma.capabilities.CapabilityKarma;
|
||||
|
@ -77,7 +78,7 @@ public class SnapHelper {
|
|||
|
||||
|
||||
} else if (data.getSnapResult() == SnapResult.CREATIVE) {
|
||||
if (ConfigHandler.snapCreative) {
|
||||
if (ModConfig.General.snapCreative) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
|
||||
if (((EntityPlayer) entity).capabilities.isCreativeMode) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package anvil.infinity.snap;
|
||||
|
||||
import anvil.infinity.config.ConfigHandler;
|
||||
import anvil.infinity.config.ModConfig;
|
||||
|
||||
public enum SnapResult {
|
||||
|
||||
|
@ -24,7 +25,7 @@ public enum SnapResult {
|
|||
case DESTROYSTONES: return BRINGBACK;
|
||||
case BRINGBACK: return RECREATE;
|
||||
case RECREATE: return KILLEVIL;
|
||||
case KILLEVIL: if (ConfigHandler.snapCreative) {return CREATIVE;} else {return KILLHALF;}
|
||||
case KILLEVIL: if (ModConfig.General.snapCreative) {return CREATIVE;} else {return KILLHALF;}
|
||||
case CREATIVE: return KILLHALF;
|
||||
}
|
||||
return KILLHALF;
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
package anvil.infinity.worldgen;
|
||||
|
||||
import anvil.infinity.config.ModConfig;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import net.minecraft.world.gen.structure.template.Template;
|
||||
import net.minecraftforge.fml.common.IWorldGenerator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class InfinityWorldGenerator extends WorldGenerator implements IWorldGenerator {
|
||||
|
||||
@Override
|
||||
public boolean generate(World worldIn, Random rand, BlockPos position) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
|
||||
int dim = world.provider.getDimension();
|
||||
if (ModConfig.Worldgen.debug)
|
||||
System.out.println("Chunk generation in Dim: " + dim);
|
||||
|
||||
if ( (chunkX > 1000 || chunkX < -1000) && (chunkZ > 1000 || chunkZ < -1000) && ModConfig.Worldgen.enable ) {
|
||||
int blockX = chunkX * 16 + 8;
|
||||
int blockZ = chunkZ * 16 + 8;
|
||||
if (canGenMind(world) || canGenPower(world) || canGenReality(world) || canGenSoul(world) || canGenSpace(world) || canGenTime(world)) {
|
||||
if (ModConfig.Worldgen.debug)
|
||||
System.out.println("A Stone can be generted here");
|
||||
|
||||
if ((int) (Math.random() * 1000) == 0) {
|
||||
int y = getGroundFromAbove(world, blockX, blockZ);
|
||||
BlockPos pos = new BlockPos(blockX, y, blockZ);
|
||||
WorldGenerator structure = new StoneTempleGen();
|
||||
structure.generate(world, random, pos);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static int getGroundFromAbove(World world, int x, int z)
|
||||
{
|
||||
int y = 255;
|
||||
boolean foundGround = false;
|
||||
while(!foundGround && y-- >= 31)
|
||||
{
|
||||
Block blockAt = world.getBlockState(new BlockPos(x,y,z)).getBlock();
|
||||
foundGround = blockAt == Blocks.WATER||blockAt == Blocks.FLOWING_WATER||blockAt == Blocks.GRASS || blockAt == Blocks.SAND || blockAt == Blocks.SNOW || blockAt == Blocks.SNOW_LAYER || blockAt == Blocks.GLASS||blockAt == Blocks.MYCELIUM;
|
||||
}
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
public static boolean canSpawnHere(Template template, World world, BlockPos posAboveGround)
|
||||
{
|
||||
int zwidth = template.getSize().getZ();
|
||||
int xwidth = template.getSize().getX();
|
||||
|
||||
boolean corner1 = isCornerValid(world, posAboveGround);
|
||||
boolean corner2 = isCornerValid(world, posAboveGround.add(xwidth, 0, zwidth));
|
||||
|
||||
return posAboveGround.getY() > 31 && corner1 && corner2;
|
||||
}
|
||||
|
||||
public static boolean isCornerValid(World world, BlockPos pos)
|
||||
{
|
||||
int variation = 3;
|
||||
int highestBlock = getGroundFromAbove(world, pos.getX(), pos.getZ());
|
||||
|
||||
if (highestBlock > pos.getY() - variation && highestBlock < pos.getY() + variation)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean canGenPower(World w) {
|
||||
WorldData data = WorldData.get(w);
|
||||
int dim = w.provider.getDimension();
|
||||
return !data.power && ModConfig.Worldgen.powerDim == dim;
|
||||
}
|
||||
|
||||
public static boolean canGenSoul(World w) {
|
||||
WorldData data = WorldData.get(w);
|
||||
int dim = w.provider.getDimension();
|
||||
return !data.soul && ModConfig.Worldgen.soulDim == dim;
|
||||
}
|
||||
|
||||
public static boolean canGenSpace(World w) {
|
||||
WorldData data = WorldData.get(w);
|
||||
int dim = w.provider.getDimension();
|
||||
return !data.space && ModConfig.Worldgen.spaceDim == dim;
|
||||
}
|
||||
|
||||
public static boolean canGenReality(World w) {
|
||||
WorldData data = WorldData.get(w);
|
||||
int dim = w.provider.getDimension();
|
||||
return !data.reality && ModConfig.Worldgen.realityDim == dim;
|
||||
}
|
||||
|
||||
public static boolean canGenTime(World w) {
|
||||
WorldData data = WorldData.get(w);
|
||||
int dim = w.provider.getDimension();
|
||||
return !data.time && ModConfig.Worldgen.timeDim == dim;
|
||||
}
|
||||
|
||||
public static boolean canGenMind(World w) {
|
||||
WorldData data = WorldData.get(w);
|
||||
int dim = w.provider.getDimension();
|
||||
return !data.mind && ModConfig.Worldgen.mindDim == dim;
|
||||
}
|
||||
|
||||
}
|
138
src/main/java/anvil/infinity/worldgen/StoneTempleGen.java
Normal file
138
src/main/java/anvil/infinity/worldgen/StoneTempleGen.java
Normal file
|
@ -0,0 +1,138 @@
|
|||
package anvil.infinity.worldgen;
|
||||
|
||||
import anvil.infinity.Infinity;
|
||||
import anvil.infinity.items.Items;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.management.PlayerList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import net.minecraft.world.gen.structure.template.PlacementSettings;
|
||||
import net.minecraft.world.gen.structure.template.Template;
|
||||
import net.minecraft.world.gen.structure.template.TemplateManager;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class StoneTempleGen extends WorldGenerator {
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random rand, BlockPos position) {
|
||||
|
||||
if (InfinityWorldGenerator.canGenMind(world)) {
|
||||
gen(world, position, Items.MIND_STONE);
|
||||
WorldData data = WorldData.get(world);
|
||||
data.mind = true;
|
||||
data.mindx = position.getX();
|
||||
data.mindz = position.getZ();
|
||||
data.markDirty();
|
||||
sendMessage("Mind", world);
|
||||
return true;
|
||||
} else if (InfinityWorldGenerator.canGenSpace(world)) {
|
||||
gen(world, position, Items.SPACE_STONE);
|
||||
WorldData data = WorldData.get(world);
|
||||
data.space = true;
|
||||
data.spacex = position.getX();
|
||||
data.spacez = position.getZ();
|
||||
data.markDirty();
|
||||
sendMessage("Space", world);
|
||||
return true;
|
||||
} else if (InfinityWorldGenerator.canGenReality(world)) {
|
||||
gen(world, position, Items.REALITY_STONE);
|
||||
WorldData data = WorldData.get(world);
|
||||
data.reality = true;
|
||||
data.realityx = position.getX();
|
||||
data.realityz = position.getZ();
|
||||
data.markDirty();
|
||||
sendMessage("Reality", world);
|
||||
return true;
|
||||
} else if (InfinityWorldGenerator.canGenTime(world)) {
|
||||
gen(world, position, Items.TIME_STONE);
|
||||
WorldData data = WorldData.get(world);
|
||||
data.time = true;
|
||||
data.timex = position.getX();
|
||||
data.timez = position.getZ();
|
||||
data.markDirty();
|
||||
sendMessage("Time", world);
|
||||
return true;
|
||||
} else if (InfinityWorldGenerator.canGenSoul(world)) {
|
||||
gen(world, position, Items.SOUL_STONE);
|
||||
WorldData data = WorldData.get(world);
|
||||
data.soul = true;
|
||||
data.soulx = position.getX();
|
||||
data.soulz = position.getZ();
|
||||
data.markDirty();
|
||||
sendMessage("Soul", world);
|
||||
return true;
|
||||
} else if (InfinityWorldGenerator.canGenPower(world)) {
|
||||
gen(world, position, Items.POWER_STONE);
|
||||
WorldData data = WorldData.get(world);
|
||||
data.power = true;
|
||||
data.powerx = position.getX();
|
||||
data.powerz = position.getZ();
|
||||
data.markDirty();
|
||||
sendMessage("Power", world);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
void gen(World world, BlockPos position, Item stone) {
|
||||
WorldServer worldserver = (WorldServer) world;
|
||||
MinecraftServer minecraftserver = world.getMinecraftServer();
|
||||
TemplateManager templatemanager = worldserver.getStructureTemplateManager();
|
||||
Template template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Infinity.MOD_ID+":stonetemple"));
|
||||
|
||||
|
||||
IBlockState iblockstate = world.getBlockState(position);
|
||||
world.notifyBlockUpdate(position, iblockstate, iblockstate, 3);
|
||||
|
||||
PlacementSettings placementsettings = (new PlacementSettings()).setMirror(Mirror.NONE)
|
||||
.setRotation(Rotation.NONE).setIgnoreEntities(false).setChunk((ChunkPos) null)
|
||||
.setReplacedBlock((Block) null).setIgnoreStructureBlock(false);
|
||||
|
||||
template.getDataBlocks(position, placementsettings);
|
||||
template.addBlocksToWorld(world, position.add(0, 1, 0), placementsettings);
|
||||
|
||||
|
||||
Map<BlockPos, String> map = template.getDataBlocks(position, placementsettings);
|
||||
|
||||
for (Map.Entry<BlockPos, String> entry : map.entrySet()) {
|
||||
if ("chest".equals(entry.getValue())) {
|
||||
BlockPos blockpos2 = entry.getKey();
|
||||
world.setBlockState(blockpos2.up(), Blocks.AIR.getDefaultState(), 3);
|
||||
TileEntity tileentity = world.getTileEntity(blockpos2);
|
||||
|
||||
if (tileentity instanceof TileEntityChest) {
|
||||
((TileEntityChest) tileentity).getSingleChestHandler().insertItem(13, new ItemStack(stone), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sendMessage(String stone, World world) {
|
||||
MinecraftServer server = world.getMinecraftServer();
|
||||
assert server != null;
|
||||
PlayerList players = server.getPlayerList();
|
||||
TextComponentString msg = new TextComponentString("The " + stone + " Stone has been generated");
|
||||
msg.getStyle().setColor(TextFormatting.GOLD);
|
||||
msg.getStyle().setBold(true);
|
||||
players.sendMessage(msg);
|
||||
}
|
||||
|
||||
}
|
102
src/main/java/anvil/infinity/worldgen/WorldData.java
Normal file
102
src/main/java/anvil/infinity/worldgen/WorldData.java
Normal file
|
@ -0,0 +1,102 @@
|
|||
package anvil.infinity.worldgen;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.storage.MapStorage;
|
||||
import net.minecraft.world.storage.WorldSavedData;
|
||||
|
||||
public class WorldData extends WorldSavedData {
|
||||
|
||||
static String NAME = "generated_stones";
|
||||
|
||||
public WorldData() {
|
||||
super(NAME);
|
||||
}
|
||||
|
||||
public WorldData(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public boolean power;
|
||||
public boolean space;
|
||||
public boolean reality;
|
||||
public boolean soul;
|
||||
public boolean time;
|
||||
public boolean mind;
|
||||
|
||||
public int powerx;
|
||||
public int spacex;
|
||||
public int realityx;
|
||||
public int soulx;
|
||||
public int timex;
|
||||
public int mindx;
|
||||
|
||||
public int powerz;
|
||||
public int spacez;
|
||||
public int realityz;
|
||||
public int soulz;
|
||||
public int timez;
|
||||
public int mindz;
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
power = nbt.getBoolean("power");
|
||||
space = nbt.getBoolean("space");
|
||||
reality = nbt.getBoolean("reality");
|
||||
soul = nbt.getBoolean("soul");
|
||||
time = nbt.getBoolean("time");
|
||||
mind = nbt.getBoolean("mind");
|
||||
|
||||
powerx = nbt.getInteger("powerX");
|
||||
spacex = nbt.getInteger("spaceX");
|
||||
realityx = nbt.getInteger("realityX");
|
||||
soulx = nbt.getInteger("soulX");
|
||||
timex = nbt.getInteger("timeX");
|
||||
mindx = nbt.getInteger("mindX");
|
||||
|
||||
powerz = nbt.getInteger("powerZ");
|
||||
spacez = nbt.getInteger("spaceZ");
|
||||
realityz = nbt.getInteger("realityZ");
|
||||
soulz = nbt.getInteger("soulZ");
|
||||
timez = nbt.getInteger("timeZ");
|
||||
mindz = nbt.getInteger("mindZ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
compound.setBoolean("power", power);
|
||||
compound.setBoolean("space", space);
|
||||
compound.setBoolean("reality", reality);
|
||||
compound.setBoolean("soul", soul);
|
||||
compound.setBoolean("time", time);
|
||||
compound.setBoolean("mind", mind);
|
||||
|
||||
compound.setInteger("powerX", powerx);
|
||||
compound.setInteger("spaceX", spacex);
|
||||
compound.setInteger("realityX", realityx);
|
||||
compound.setInteger("soulX", soulx);
|
||||
compound.setInteger("timeX", timex);
|
||||
compound.setInteger("mindX", mindx);
|
||||
|
||||
compound.setInteger("powerZ", powerz);
|
||||
compound.setInteger("spaceZ", spacez);
|
||||
compound.setInteger("realityZ", realityz);
|
||||
compound.setInteger("soulZ", soulz);
|
||||
compound.setInteger("timeZ", timez);
|
||||
compound.setInteger("mindZ", mindz);
|
||||
|
||||
return compound;
|
||||
}
|
||||
|
||||
public static WorldData get(World world) {
|
||||
MapStorage storage = world.getMapStorage();
|
||||
WorldData instance = (WorldData) storage.getOrLoadData(WorldData.class, NAME);
|
||||
|
||||
if (instance == null) {
|
||||
instance = new WorldData();
|
||||
storage.setData(NAME, instance);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ item.reality_stone.name=Realitätsstein
|
|||
item.soul_stone.name=Seelenstein
|
||||
item.time_stone.name=Zeitstein
|
||||
item.mind_stone.name=Gedankenstein
|
||||
item.space_stone.name=Raumstein
|
||||
infinity.snap.text=Du hättest auf den Kopf zielen sollen.
|
||||
infinity.snap.death=zerfiel zu Staub
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ item.reality_stone.name=Reality Stone
|
|||
item.soul_stone.name=Soul Stone
|
||||
item.time_stone.name=Time Stone
|
||||
item.mind_stone.name=Mind Stone
|
||||
item.space_stone.name=Space Stone
|
||||
infinity.snap.text=You should have gone for the head.
|
||||
infinity.snap.irontext=And I am ... Iron Man
|
||||
infinity.snap.death=was dusted away
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"parent": "builtin/entity",
|
||||
"display": {
|
||||
"gui": {
|
||||
"rotation": [ 30, 45, 0 ],
|
||||
"translation": [ 0, 3, 0],
|
||||
"scale":[ 3, 3, 3 ]
|
||||
},
|
||||
"ground": {
|
||||
"rotation": [ 0, 0, 0 ],
|
||||
"translation": [ 0, 0, 0],
|
||||
"scale":[ 1, 1, 1 ]
|
||||
},
|
||||
"head": {
|
||||
"rotation": [ 0, 0, 0 ],
|
||||
"translation": [ 0, 0, 0],
|
||||
"scale":[ 1, 1, 1 ]
|
||||
},
|
||||
"fixed": {
|
||||
"rotation": [ 0, 0, 0 ],
|
||||
"translation": [ 0, 2, 0],
|
||||
"scale":[ 2, 2, 2 ]
|
||||
},
|
||||
"thirdperson_righthand": {
|
||||
"rotation": [ 45, 0, 0 ],
|
||||
"translation": [ 0, 0, 0],
|
||||
"scale":[ 1, 1, 1 ]
|
||||
},
|
||||
"thirdperson_lefthand": {
|
||||
"rotation": [ 45, 0, 0 ],
|
||||
"translation": [ 0, 0, 0],
|
||||
"scale":[ 1, 1, 1 ]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"rotation": [ 0, 0, 0 ],
|
||||
"translation": [ 0, 5, 0],
|
||||
"scale":[ 1, 1, 1 ]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"rotation": [ 0, 0, 0 ],
|
||||
"translation": [ 0, 5, 0],
|
||||
"scale":[ 1, 1, 1 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
src/main/resources/assets/infinity/structures/stonetemple.nbt
Normal file
BIN
src/main/resources/assets/infinity/structures/stonetemple.nbt
Normal file
Binary file not shown.
Loading…
Reference in a new issue