Compare commits

...

68 commits
1.3 ... master

Author SHA1 Message Date
Timo Ley 0629748adf Fixed crash 2020-04-30 13:25:01 +02:00
Timo Ley 7e22d8beea Added Locate abilities 2020-04-30 13:18:06 +02:00
Timo Ley 98ac438a98 Messages when stones are generating 2020-04-30 12:06:32 +02:00
Timo Ley 7b6099e8e2 Stones now generate in the world 2020-04-28 20:00:37 +02:00
Timo Ley dd679a3e79 Updated required version 2019-06-22 00:21:59 +02:00
Timo Ley b7b7d74702 changelog 2019-06-22 00:21:25 +02:00
Timo Ley 10a7c3a52b Added api 2019-06-22 00:19:38 +02:00
Timo Ley 76e740bc26 Fixed ability colors 2019-06-21 23:59:12 +02:00
Timo Ley d862acc910 Added own Space Stone 2019-06-21 23:52:10 +02:00
Timo Ley 81fe7f456c Add stone ability colors 2019-06-21 23:41:25 +02:00
Timo Ley 0f586391e8 Improved stone detection system 2019-06-21 23:24:20 +02:00
Timo Ley 1d43d7a041 Update HeroesExpansion and LucraftCore 2019-06-20 23:33:11 +02:00
Timo Ley 25c3486cad Changelog 2019-06-08 13:41:29 +02:00
Timo Ley d978465d98 Stone colors can be configured now 2019-06-08 13:40:15 +02:00
Timo Ley 90d2609af9 Added kill evil entities snap 2019-06-08 13:17:51 +02:00
Timo Ley ba91b9db69 Improved data storage 2019-06-08 12:49:20 +02:00
Timo Ley 8a811ffb3c changelog 2019-05-30 14:19:44 +02:00
Timo Ley c794e0a1c9 Added Time Stone abilities 2019-05-30 13:49:35 +02:00
Timo Ley 0eb8b089b4 Changed icons 2019-05-30 13:48:26 +02:00
Timo Ley cf5846fc86 Fixed destroy stones for multiple gauntlets 2019-05-30 13:24:12 +02:00
Timo Ley 68ef06a068 changelog update 2019-05-30 00:48:41 +02:00
Timo Ley 1ee57b7907 fixed curse upload for other linux builders 2019-05-30 00:45:26 +02:00
Timo Ley 6aa4b66ae5 Added StarTech compatiblity 2019-05-30 00:43:17 +02:00
Timo Ley 993ed37ccc Changed Stone colors 2019-05-30 00:43:07 +02:00
Timo Ley 53f422d406 curse fix 2 2019-05-29 16:20:40 +02:00
Timo Ley c22fadbf85 fixed curse upload 2019-05-29 16:01:49 +02:00
Timo Ley 0092783f11 internal change 4 2019-05-28 20:50:02 +02:00
Timo Ley 58f675cb8f internal change 3 2019-05-28 20:46:48 +02:00
Timo Ley 18f0f660b3 Internal change 2 2019-05-28 20:44:41 +02:00
Timo Ley 8e9f28c235 internal change 2019-05-28 20:41:44 +02:00
Timo Ley bae4ad3fca Fixed command not found 2019-05-28 20:38:43 +02:00
Timo Ley 8562642a4b fixed api key 2019-05-28 20:28:03 +02:00
Timo Ley 28f58c9f62 apiKey comes from external file 2019-05-28 20:25:28 +02:00
Timo Ley 1cf210cc59 updated changelog 2019-05-28 20:14:43 +02:00
Timo Ley 20925a8893 HE Abilities can now be disabled 2019-05-28 19:57:35 +02:00
Timo Ley 253245a202 Automatic versioning 2019-05-28 19:50:30 +02:00
Timo Ley cb6c59d0c7 Snap is able with Speedster Reality Stone 2019-05-28 16:31:21 +02:00
Timo Ley 38cb1e2f12 Added dependencies 2019-05-25 09:57:00 +02:00
Timo Ley db6f7164aa Better automation 2019-05-25 09:53:45 +02:00
Timo Ley 047be59736 1.5 2019-05-24 23:14:42 +02:00
Timo Ley 8c92513378 Merge remote-tracking branch 'origin/master' 2019-05-24 23:12:39 +02:00
Timo Ley a140996243 Auto Upload 2019-05-24 23:12:28 +02:00
tilera mpz 023a598c51 Update LICENSE 2019-05-22 19:53:37 +00:00
tilera mpz a702786899 Add LICENSE 2019-05-22 19:52:37 +00:00
Timo Ley 782203b046 Improved Stone colors 2019-05-22 15:32:41 +02:00
Timo Ley b7bf1005f7 Run only manually 2019-05-21 19:08:12 +02:00
Timo Ley d85e0c7b8b Local gradlew 2019-05-21 18:40:34 +02:00
Timo Ley efbf1e3ff2 Second correction 2019-05-21 18:04:19 +02:00
Timo Ley 16eacf05d0 Corrected build 2019-05-21 18:01:04 +02:00
Timo Ley 4ec9790f04 Gitlab CI 2019-05-21 17:41:10 +02:00
Timo Ley bbb1cc57a2 Compile dependencies 2019-05-21 17:28:28 +02:00
Timo Ley 7b6355345b Added dependencies via jitpack 2019-05-21 17:19:27 +02:00
Timo Ley 95ca7f1519 addition 2019-05-20 18:13:26 +02:00
Timo Ley 99ffc6bf74 Improved Networking system 2019-05-20 18:10:30 +02:00
Timo Ley b5349cfcc6 Change version to 1.4 2019-05-19 00:30:54 +02:00
Timo Ley 713a2a47c7 Fixed Kill Ability for Multiplayer 2019-05-19 00:26:11 +02:00
Timo Ley 6545a45f52 Added achievment for the Reality Stone 2019-05-18 22:01:41 +02:00
Timo Ley 6bc9d6de75 Snap now works in all Dimensions 2019-05-18 21:15:24 +02:00
Timo Ley d66f0bba92 Kill Ability 2019-05-18 20:40:12 +02:00
Timo Ley ae0569ec92 Fixes 2019-05-18 20:39:22 +02:00
Timo Ley 3d5a4d23b3 New Condition system 2019-05-18 20:38:42 +02:00
Timo Ley b6866b0f16 Worked on Snap Abilities 2019-05-14 20:10:54 +02:00
Timo Ley 69ff7c2fb1 Improved Power Stone 2019-05-14 19:47:03 +02:00
Timo Ley 8f2d1a7b59 Added more Snap Abilities (WIP) 2019-05-14 18:30:44 +02:00
Timo Ley 0ba6efbeaf Ignore .gradle 2019-05-13 11:26:57 +02:00
Timo Ley f05928e26c Improved Helpers 2 2019-05-13 11:24:02 +02:00
Timo Ley 4bfe713152 Improved Helpers 2019-05-13 11:22:22 +02:00
Timo Ley ca5d6bbdbd Changed version number 2019-05-13 10:38:25 +02:00
86 changed files with 1925 additions and 257 deletions

1
.gitignore vendored
View file

@ -3,4 +3,5 @@ out
run
*.iml
.idea
.gradle
classes

9
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,9 @@
before_script:
- ./gradlew setupDecompWorkspace
build:
script:
- ./gradlew build
- ./gradlew curseforge285509
only:
- web

View file

@ -1,2 +0,0 @@
#Wed May 08 19:45:11 CEST 2019
gradle.version=4.4.1

View file

@ -1 +0,0 @@
This mapping 'stable_39' was designed for MC 1.12! Use at your own peril.

3
LICENSE Normal file
View file

@ -0,0 +1,3 @@
Everyone is allowed to modify this software and use the modified version for private purposes.
Distribution of this software is only allowed with my (tilera's) permission and then only the official builds, no modified versions and only with a author notice that refers to me (tilera).
You are not permitted to distribute this software for commercial use.

View file

@ -1,3 +1,4 @@
buildscript {
repositories {
jcenter()
@ -5,6 +6,7 @@ buildscript {
name = "forge"
url = "https://files.minecraftforge.net/maven"
}
}
dependencies {
classpath "net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT"
@ -12,8 +14,19 @@ buildscript {
}
apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: 'idea'
version = modVersion
def getVersionName = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
return stdout.toString().trim()
}
version = getVersionName()
group = modGroup
archivesBaseName = modBaseName
@ -28,8 +41,12 @@ minecraft {
// simply re-run your setup task after changing the mappings to update your workspace.
mappings = project.mcpVersion
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
replace '${version}', project.version
}
repositories {
mavenCentral()
maven {
@ -44,6 +61,10 @@ repositories {
name = "CoFH Maven"
url = "http://maven.covers1624.net"
}
maven {
name = "CurseForge"
url = "https://minecraft.curseforge.com/api/maven/"
}
maven { url "https://jitpack.io" }
maven { url "https://maven.latmod.com/" }
@ -52,16 +73,22 @@ repositories {
}
dependencies {
deobfCompile ("com.gitlab.lcoremodders:LucraftCore:${core_version}")
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'])
}
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'deobf'
manifest {
attributes 'FMLCorePlugin': 'lucraft.mods.lucraftcore.core.LucraftCoreCoreMod', 'FMLCorePluginContainsFMLMod': 'true'
}
}
artifacts {
@ -71,7 +98,7 @@ artifacts {
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "version", getVersionName
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
@ -79,7 +106,7 @@ processResources {
include "mcmod.info"
// replace version and mcversion
expand "version": project.version, "mcversion": project.minecraft.version
expand "version": getVersionName, "mcversion": project.minecraft.version
}
// copy everything else, thats not the mcmod.info
@ -87,3 +114,5 @@ processResources {
exclude "mcmod.info"
}
}

4
changelog.txt Normal file
View file

@ -0,0 +1,4 @@
-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

View file

@ -1,6 +1,6 @@
modGroup=anvil
modVersion=1.2
modBaseName=infinity
forgeVersion=1.12.2-14.23.5.2814
forgeVersion=1.12.2-14.23.5.2847
mcpVersion=stable_39
core_version=d406868225
core_version=d406868225
projectID=285509

View file

@ -1,16 +1,31 @@
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;
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;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
//Test
@ -24,91 +39,43 @@ public class Infinity {
public static final String MOD_ID = "infinity";
public static final String MOD_NAME = "Infinityraft";
public static final String VERSION = "1.2";
public static final String DEPENDENCIES = "required-after:lucraftcore@[1.12.2-2.4.0,)";
public static final String VERSION = "${version}";
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());
CompatHandler.check();
int netID = 0;
NETWORK_WRAPPER.registerMessage(LookAbilityReturnPackageHandler.class, PackageKillAbility.class, netID++, Side.SERVER);
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"));
*/
}
}
}

View file

@ -1,26 +0,0 @@
package anvil.infinity.abilities;
import anvil.infinity.Infinity;
import lucraft.mods.lucraftcore.superpowers.abilities.AbilityEntry;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@Mod.EventBusSubscriber(modid = Infinity.MOD_ID)
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")));
}
}

View file

@ -0,0 +1,45 @@
package anvil.infinity.abilities;
import anvil.infinity.capabilities.GauntletUserInformation;
import anvil.infinity.capabilities.ICapabilityPlayerData;
import anvil.infinity.items.Items;
import lucraft.mods.lucraftcore.superpowers.abilities.AbilityAction;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class AbilityChangeSnap extends AbilityAction {
public AbilityChangeSnap(EntityLivingBase entity) {
super(entity);
}
@Override
public boolean action() {
ICapabilityPlayerData data = GauntletUserInformation.getDataByEntity(entity);
data.setSnapResult(data.getSnapResult().next());
if (entity instanceof EntityPlayer) {
((EntityPlayer) entity).sendStatusMessage(new TextComponentString("Selected ability is: " + data.getSnapResult()),true);
}
return true;
}
@SideOnly(Side.CLIENT)
@Override
public void drawIcon(Minecraft mc, Gui gui, int x, int y) {
float zLevel = Minecraft.getMinecraft().getRenderItem().zLevel;
mc.getRenderItem().zLevel = -100.5F;
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, 0);
mc.getRenderItem().renderItemIntoGUI(new ItemStack(Items.MIND_STONE), 0, 0);
GlStateManager.popMatrix();
mc.getRenderItem().zLevel = zLevel;
}
}

View file

@ -0,0 +1,42 @@
package anvil.infinity.abilities;
import lucraft.mods.lucraftcore.superpowers.abilities.AbilityHeld;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class AbilityFastForward extends AbilityHeld {
World w;
public AbilityFastForward(EntityLivingBase entity) {
super(entity);
w = entity.getEntityWorld();
}
@Override
public void updateTick() {
long time = w.getWorldTime();
w.setWorldTime(time + 100);
}
@SideOnly(Side.CLIENT)
@Override
public void drawIcon(Minecraft mc, Gui gui, int x, int y) {
float zLevel = Minecraft.getMinecraft().getRenderItem().zLevel;
mc.getRenderItem().zLevel = -100.5F;
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, 0);
mc.getRenderItem().renderItemIntoGUI(new ItemStack(Items.CLOCK), 0, 0);
GlStateManager.popMatrix();
mc.getRenderItem().zLevel = zLevel;
}
}

View file

@ -1,10 +0,0 @@
package anvil.infinity.abilities;
import net.minecraft.entity.EntityLivingBase;
public class AbilityHasMindStone extends AbilityHasStone {
public AbilityHasMindStone(EntityLivingBase entity) {
super(entity);
}
}

View file

@ -1,11 +0,0 @@
package anvil.infinity.abilities;
import net.minecraft.entity.EntityLivingBase;
public class AbilityHasPowerStone extends AbilityHasStone {
public AbilityHasPowerStone(EntityLivingBase entity) {
super(entity);
}
}

View file

@ -1,10 +0,0 @@
package anvil.infinity.abilities;
import net.minecraft.entity.EntityLivingBase;
public class AbilityHasRealityStone extends AbilityHasStone {
public AbilityHasRealityStone(EntityLivingBase entity) {
super(entity);
}
}

View file

@ -1,10 +0,0 @@
package anvil.infinity.abilities;
import net.minecraft.entity.EntityLivingBase;
public class AbilityHasSoulStone extends AbilityHasStone {
public AbilityHasSoulStone(EntityLivingBase entity) {
super(entity);
}
}

View file

@ -1,10 +0,0 @@
package anvil.infinity.abilities;
import net.minecraft.entity.EntityLivingBase;
public class AbilityHasTimeStone extends AbilityHasStone {
public AbilityHasTimeStone(EntityLivingBase entity) {
super(entity);
}
}

View file

@ -0,0 +1,62 @@
package anvil.infinity.abilities;
import anvil.infinity.Infinity;
import anvil.infinity.conditions.ICondition;
import anvil.infinity.items.Items;
import anvil.infinity.networking.PackageReq;
import io.netty.buffer.ByteBuf;
import lucraft.mods.lucraftcore.superpowers.abilities.AbilityAction;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class AbilityKill extends AbilityAction {
ICondition condition;
public AbilityKill(EntityLivingBase entity) {
super(entity);
condition = new ICondition<EntityLivingBase>() {
@Override
public boolean isFulfilled(EntityLivingBase information) {
return true;
}
};
}
public AbilityKill(EntityLivingBase entity, ICondition condition) {
super(entity);
this.condition = condition;
}
@Override
public boolean action() {
if (condition.isFulfilled(entity) && entity instanceof EntityPlayerMP) {
Infinity.NETWORK_WRAPPER.sendTo(new PackageReq(), (EntityPlayerMP) entity);
return true;
}
return false;
}
@SideOnly(Side.CLIENT)
@Override
public void drawIcon(Minecraft mc, Gui gui, int x, int y) {
float zLevel = Minecraft.getMinecraft().getRenderItem().zLevel;
mc.getRenderItem().zLevel = -100.5F;
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, 0);
mc.getRenderItem().renderItemIntoGUI(new ItemStack(Items.SOUL_STONE), 0, 0);
GlStateManager.popMatrix();
mc.getRenderItem().zLevel = zLevel;
}
}

View file

@ -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);
}

View file

@ -0,0 +1,20 @@
package anvil.infinity.abilities;
import lucraft.mods.lucraftcore.superpowers.abilities.AbilityConstant;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
public class AbilitySaturation extends AbilityConstant {
public AbilitySaturation(EntityLivingBase entity) {
super(entity);
}
@Override
public void updateTick() {
if (entity instanceof EntityPlayer) {
((EntityPlayer) entity).getFoodStats().setFoodLevel(20);
}
}
}

View file

@ -1,33 +1,19 @@
package anvil.infinity.abilities;
import anvil.infinity.compat.CompatHandler;
import anvil.infinity.registry.Effects;
import anvil.infinity.snap.SnapHelper;
import lucraft.mods.lucraftcore.infinity.ModuleInfinity;
import lucraft.mods.lucraftcore.superpowers.abilities.AbilityAction;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntityRabbit;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.management.PlayerList;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
import java.util.Random;
public class AbilitySnap extends AbilityAction {
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
public AbilitySnap(EntityLivingBase entity) {
@ -36,31 +22,7 @@ public class AbilitySnap extends AbilityAction {
@Override
public boolean action() {
if (CompatHandler.HeroesExpension.hasFullGauntlet(entity)) {
World w = entity.getEntityWorld();
List<Entity> entities = w.loadedEntityList;
boolean kill = false;
PlayerList players = server.getPlayerList();
TextComponentString msg = new TextComponentString(entity.getName() + ": ");
msg.appendSibling(new TextComponentTranslation("infinity.snap.text"));
msg.getStyle().setColor(TextFormatting.DARK_PURPLE);
msg.getStyle().setBold(true);
players.sendMessage(msg);
Random random = new Random();
for (int i = 0; i < entities.size(); i++) {
if (entities.get(i) != entity && entities.get(i) instanceof EntityLivingBase && kill && !(entities.get(i) instanceof EntityRabbit)) {
EntityLivingBase e = ((EntityLivingBase) entities.get(i));
e.addPotionEffect(new PotionEffect(Effects.snapEffect, random.nextInt((1200 - 10) + 1) - 10));
}
kill = !kill;
}
return true;
}
return false;
return SnapHelper.snap(entity);
}
@SideOnly(Side.CLIENT)

View file

@ -0,0 +1,41 @@
package anvil.infinity.abilities;
import anvil.infinity.items.Items;
import lucraft.mods.lucraftcore.superpowers.abilities.AbilityToggle;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class AbilityStopTime extends AbilityToggle {
World w;
public AbilityStopTime(EntityLivingBase entity) {
super(entity);
w = entity.getEntityWorld();
}
@Override
public void updateTick() {
long time = w.getWorldTime();
w.setWorldTime(time - 1);
}
@SideOnly(Side.CLIENT)
@Override
public void drawIcon(Minecraft mc, Gui gui, int x, int y) {
float zLevel = Minecraft.getMinecraft().getRenderItem().zLevel;
mc.getRenderItem().zLevel = -100.5F;
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, 0);
mc.getRenderItem().renderItemIntoGUI(new ItemStack(Items.TIME_STONE), 0, 0);
GlStateManager.popMatrix();
mc.getRenderItem().zLevel = zLevel;
}
}

View file

@ -1,10 +0,0 @@
package anvil.infinity.abilities;
import net.minecraft.entity.EntityLivingBase;
public class AbilityhasSpaceStone extends AbilityHasStone {
public AbilityhasSpaceStone(EntityLivingBase entity) {
super(entity);
}
}

View 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;
}
}
}

View 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);
}

View 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;
}
}

View file

@ -0,0 +1,22 @@
package anvil.infinity.capabilities;
import anvil.infinity.Infinity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@Mod.EventBusSubscriber(modid = Infinity.MOD_ID)
public class CapabilityEventListener {
@SubscribeEvent
public static void onAttachCapabilities(AttachCapabilitiesEvent<Entity> e) {
Entity entity = e.getObject();
if (entity instanceof EntityPlayer) {
e.addCapability(new ResourceLocation(Infinity.MOD_ID, "playerCapability"), new CapabilityPlayerDataProvider(new CapabilityPlayerData()));
}
}
}

View file

@ -0,0 +1,95 @@
package anvil.infinity.capabilities;
import anvil.infinity.snap.SnapResult;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
public class CapabilityPlayerData implements ICapabilityPlayerData {
@CapabilityInject(ICapabilityPlayerData.class)
public static final Capability<ICapabilityPlayerData> capability = null;
public int xPos;
public int yPos;
public int zPos;
public int dim;
public SnapResult selectedSnapResult;
public CapabilityPlayerData() {
selectedSnapResult = SnapResult.KILLHALF;
}
@Override
public int getXPos() {
return xPos;
}
@Override
public int getYPos() {
return yPos;
}
@Override
public int getZPos() {
return zPos;
}
@Override
public int getDim() {
return dim;
}
@Override
public void setXPos(int xPos) {
this.xPos = xPos;
}
@Override
public void setYPos(int yPos) {
this.yPos = yPos;
}
@Override
public void setZPos(int zPos) {
this.zPos = zPos;
}
@Override
public void setDim(int dim) {
this.dim = dim;
}
@Override
public SnapResult getSnapResult() {
return selectedSnapResult;
}
@Override
public void setSnapResult(SnapResult snapResult) {
selectedSnapResult = snapResult;
}
@Override
public void readNBT(NBTTagCompound tag) {
setXPos(tag.getInteger("xPos"));
setYPos(tag.getInteger("YPos"));
setZPos(tag.getInteger("zPos"));
setDim(tag.getInteger("dim"));
setSnapResult(SnapResult.fromString(tag.getString("snapResult")));
}
@Override
public NBTTagCompound writeNBT() {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("xPos", getXPos());
nbt.setInteger("yPos", getYPos());
nbt.setInteger("zPos", getZPos());
nbt.setInteger("dim", getDim());
nbt.setString("snapResult", getSnapResult().toString());
return nbt;
}
}

View file

@ -0,0 +1,39 @@
package anvil.infinity.capabilities;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class CapabilityPlayerDataProvider implements ICapabilitySerializable<NBTTagCompound> {
ICapabilityPlayerData instance;
public CapabilityPlayerDataProvider(ICapabilityPlayerData instance) {
this.instance = instance;
}
@Override
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
return capability == CapabilityPlayerData.capability;
}
@Nullable
@Override
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
return capability == CapabilityPlayerData.capability ? CapabilityPlayerData.capability.<T>cast(instance) : null;
}
@Override
public NBTTagCompound serializeNBT() {
return (NBTTagCompound) CapabilityPlayerData.capability.getStorage().writeNBT(CapabilityPlayerData.capability, instance, null);
}
@Override
public void deserializeNBT(NBTTagCompound nbt) {
CapabilityPlayerData.capability.getStorage().readNBT(CapabilityPlayerData.capability, instance, null, nbt);
}
}

View file

@ -0,0 +1,11 @@
package anvil.infinity.capabilities;
import java.util.concurrent.Callable;
public class Factory implements Callable<ICapabilityPlayerData> {
@Override
public ICapabilityPlayerData call() throws Exception {
return new CapabilityPlayerData();
}
}

View file

@ -0,0 +1,18 @@
package anvil.infinity.capabilities;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import java.util.ArrayList;
import java.util.List;
public class GauntletUserInformation {
public static ICapabilityPlayerData getDataByEntity(EntityLivingBase entity) {
if (entity instanceof EntityPlayer && entity.hasCapability(CapabilityPlayerData.capability, null)) {
return entity.getCapability(CapabilityPlayerData.capability, null);
}
return new CapabilityPlayerData();
}
}

View file

@ -0,0 +1,24 @@
package anvil.infinity.capabilities;
import anvil.infinity.snap.SnapResult;
import net.minecraft.nbt.NBTTagCompound;
public interface ICapabilityPlayerData {
int getXPos();
int getYPos();
int getZPos();
int getDim();
void setXPos(int xPos);
void setYPos(int yPos);
void setZPos(int zPos);
void setDim(int dim);
SnapResult getSnapResult();
void setSnapResult(SnapResult snapResult);
void readNBT(NBTTagCompound nbt);
NBTTagCompound writeNBT();
}

View file

@ -0,0 +1,27 @@
package anvil.infinity.capabilities;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import javax.annotation.Nullable;
import java.util.List;
public class Storage implements Capability.IStorage<ICapabilityPlayerData> {
@Nullable
@Override
public NBTBase writeNBT(Capability<ICapabilityPlayerData> capability, ICapabilityPlayerData instance, EnumFacing side) {
return instance.writeNBT();
}
@Override
public void readNBT(Capability<ICapabilityPlayerData> capability, ICapabilityPlayerData instance, EnumFacing side, NBTBase nbt) {
if (nbt instanceof NBTTagCompound) {
instance.readNBT((NBTTagCompound) nbt);
}
}
}

View 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);
}
}

View file

@ -5,13 +5,16 @@ import net.minecraftforge.fml.common.Loader;
public class CompatHandler {
public static boolean isHeroesExpansion;
public static boolean isSpeedsterHeroes;
public static boolean isStarTech;
public static HEProxy HeroesExpension;
public static SHProxy SpeedsterHeroes;
public static STProxy StarTech;
public static void check() {
isHeroesExpansion = Loader.isModLoaded("heroesexpansion");
isSpeedsterHeroes = Loader.isModLoaded("speedsterheroes");
isStarTech = Loader.isModLoaded("star-tech");
if (isHeroesExpansion) {
HeroesExpension = new HELoadedProxy();
@ -25,5 +28,11 @@ public class CompatHandler {
SpeedsterHeroes = new SHNotLoadedProxy();
}
if (isStarTech) {
StarTech = new STLoadedProxy();
} else {
StarTech = new STNotLoadedProxy();
}
}
}

View file

@ -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 hasFullGauntlet(EntityLivingBase entity) {
return Ability.hasAbility(entity, AbilityPortal.class) && Ability.hasAbility(entity, AbilityHasPowerStone.class) && Ability.hasAbility(entity, AbilityHasRealityStone.class) && Ability.hasAbility(entity, AbilityHasSoulStone.class) && Ability.hasAbility(entity, AbilityHasTimeStone.class) && Ability.hasAbility(entity, AbilityHasMindStone.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);
}
}

View file

@ -12,7 +12,22 @@ public class HENotLoadedProxy implements HEProxy {
}
@Override
public boolean hasFullGauntlet(EntityLivingBase entity) {
return Ability.hasAbility(entity, AbilityHasPowerStone.class) && Ability.hasAbility(entity, AbilityHasRealityStone.class) && Ability.hasAbility(entity, AbilityHasSoulStone.class) && Ability.hasAbility(entity, AbilityHasTimeStone.class) && Ability.hasAbility(entity, AbilityHasMindStone.class);
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;
}
}

View file

@ -7,6 +7,12 @@ public interface HEProxy {
Ability getAbilityGrabEntity(EntityLivingBase entity);
boolean hasFullGauntlet(EntityLivingBase entity);
Ability getAbilityPortal(EntityLivingBase entity);
Ability getAbilityForcefield(EntityLivingBase entity);
Ability getAbilityBlackhole(EntityLivingBase entity);
boolean canLocate(EntityLivingBase entity);
}

View file

@ -22,4 +22,5 @@ public class SHLoadedProxy implements SHProxy {
public Ability getAbilityTurnIntoBubbles(EntityLivingBase entity) {
return new AbilityTurnIntoBubbles(entity);
}
}

View file

@ -19,4 +19,5 @@ public class SHNotLoadedProxy implements SHProxy {
public Ability getAbilityTurnIntoBubbles(EntityLivingBase entity) {
return null;
}
}

View file

@ -0,0 +1,38 @@
package anvil.infinity.compat;
import com.nic.st.power.*;
import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
import net.minecraft.entity.EntityLivingBase;
public class STLoadedProxy implements STProxy {
@Override
public Ability getAbilityPowerBlast(EntityLivingBase entity) {
return new AbilityPowerBlast(entity);
}
@Override
public Ability getAbilityPowerImpower(EntityLivingBase entity) {
return new AbilityPowerImpower(entity);
}
@Override
public Ability getAbilityPowerRocketBurst(EntityLivingBase entity) {
return new AbilityRocketBurst(entity);
}
@Override
public Ability getAbilityTendrils(EntityLivingBase entity) {
return new AbilityTendrils(entity);
}
@Override
public Ability getAbilityCyclone(EntityLivingBase entity) {
return new AbilityPowerCyclone(entity);
}
@Override
public Ability getAbilityBurnout(EntityLivingBase entity) {
return new AbilityGiveBurnout(entity);
}
}

View file

@ -0,0 +1,37 @@
package anvil.infinity.compat;
import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
import net.minecraft.entity.EntityLivingBase;
public class STNotLoadedProxy implements STProxy {
@Override
public Ability getAbilityPowerBlast(EntityLivingBase entity) {
return null;
}
@Override
public Ability getAbilityPowerImpower(EntityLivingBase entity) {
return null;
}
@Override
public Ability getAbilityPowerRocketBurst(EntityLivingBase entity) {
return null;
}
@Override
public Ability getAbilityTendrils(EntityLivingBase entity) {
return null;
}
@Override
public Ability getAbilityCyclone(EntityLivingBase entity) {
return null;
}
@Override
public Ability getAbilityBurnout(EntityLivingBase entity) {
return null;
}
}

View file

@ -0,0 +1,20 @@
package anvil.infinity.compat;
import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
import net.minecraft.entity.EntityLivingBase;
public interface STProxy {
Ability getAbilityPowerBlast(EntityLivingBase entity);
Ability getAbilityPowerImpower(EntityLivingBase entity);
Ability getAbilityPowerRocketBurst(EntityLivingBase entity);
Ability getAbilityTendrils(EntityLivingBase entity);
Ability getAbilityCyclone(EntityLivingBase entity);
Ability getAbilityBurnout(EntityLivingBase entity);
}

View file

@ -0,0 +1,7 @@
package anvil.infinity.conditions;
public interface ICondition<T> {
boolean isFulfilled(T information);
}

View file

@ -7,10 +7,19 @@ 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 powerStoneColor;
public static int powerStoneShine;
public static int realityStoneColor;
public static int realityStoneShine;
public static int timeStoneColor;
public static int timeStoneShine;
public static int mindStoneColor;
public static int mindStoneShine;
public static int soulStoneColor;
public static int soulStoneShine;
public static int spaceStoneColor;
public static int spaceStoneShine;
public static void refreshConfig(File file) {
config = new Configuration(file);
@ -22,11 +31,20 @@ public class ConfigHandler {
}
private static void syncConfig() {
String category = Configuration.CATEGORY_GENERAL;
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");
String colorcat = Configuration.CATEGORY_CLIENT;
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");
realityStoneShine = config.getInt("Reality Stone shine", colorcat, 0xFF0130, 0x000000, 0xFFFFFF, "Shine color of the Reality Stone");
timeStoneColor = config.getInt("Time Stone color", colorcat, 0x13CF55, 0x000000, 0xFFFFFF, "Color of the Time Stone");
timeStoneShine = config.getInt("Time Stone shine", colorcat, 0x12E772, 0x000000, 0xFFFFFF, "Shine color of the Time Stone");
mindStoneColor = config.getInt("Mind Stone color", colorcat, 0xFFD300, 0x000000, 0xFFFFFF, "Color of the Mind Stone");
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");
}
}

View 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;
}
}

View file

@ -1,12 +1,10 @@
package anvil.infinity.effects;
import anvil.infinity.Infinity;
import anvil.infinity.SoundHelper;
import anvil.infinity.helpers.SnapMessageHelper;
import anvil.infinity.registry.Effects;
import anvil.infinity.registry.Sounds;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraftforge.event.entity.living.LivingEvent;

View file

@ -0,0 +1,40 @@
package anvil.infinity.helpers;
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 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 ItemInfinityStone.hasStone(entity, Ability.EnumAbilityContext.MAIN_HAND, EnumInfinityStone.SPACE) || ItemInfinityStone.hasStone(entity, Ability.EnumAbilityContext.OFF_HAND, EnumInfinityStone.SPACE);
}
public static boolean hasRealityStone(EntityLivingBase entity) {
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 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 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 ItemInfinityStone.hasStone(entity, Ability.EnumAbilityContext.MAIN_HAND, EnumInfinityStone.MIND) || ItemInfinityStone.hasStone(entity, Ability.EnumAbilityContext.OFF_HAND, EnumInfinityStone.MIND);
}
public static boolean hasFullGauntlet(EntityLivingBase entity) {
return hasPowerStone(entity) && hasSpaceStone(entity) && hasRealityStone(entity) && hasSoulStone(entity) && hasTimeStone(entity) && hasMindStone(entity);
}
}

View file

@ -0,0 +1,21 @@
package anvil.infinity.helpers;
import anvil.infinity.registry.Effects;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.PotionEffect;
public class LookAbilityHelper {
public static final int KILL = 0;
public static void activateEntityLookAbility(Entity entity, int abilityID) {
switch (abilityID) {
case KILL: if (entity instanceof EntityLivingBase) {
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Effects.snapEffect, 1));
} break;
}
}
}

View file

@ -1,4 +1,4 @@
package anvil.infinity;
package anvil.infinity.helpers;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.SoundEvent;

View file

@ -1,12 +1,16 @@
package anvil.infinity.items;
import anvil.infinity.abilities.AbilityHasMindStone;
import anvil.infinity.abilities.AbilityChangeSnap;
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;
@ -33,11 +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));
if (CompatHandler.isHeroesExpansion) {
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);
}

View file

@ -1,18 +1,23 @@
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;
import java.awt.*;
import java.util.UUID;
public class ItemPowerStone extends ItemInfinityStone {
public class ItemPowerStone extends ItemInfinityStone implements IAbilityProvider {
public ItemPowerStone(String name) {
this.setTranslationKey(name);
@ -34,11 +39,21 @@ public class ItemPowerStone extends ItemInfinityStone {
@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 && 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);
}
@ -47,5 +62,17 @@ public class ItemPowerStone extends ItemInfinityStone {
return Integer.MAX_VALUE;
}
@Override
public Ability.AbilityMap addDefaultAbilities(EntityLivingBase entity, Ability.AbilityMap abilities, Ability.EnumAbilityContext context) {
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));
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));
}
return abilities;
}
}

View file

@ -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);
}

View file

@ -1,8 +1,12 @@
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;
import lucraft.mods.lucraftcore.infinity.items.ItemInfinityStone;
@ -10,11 +14,19 @@ 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;
public class ItemSoulStone extends ItemInfinityStone {
ICondition killCond = new ICondition<EntityLivingBase>() {
@Override
public boolean isFulfilled(EntityLivingBase information) {
return GauntelHelper.hasPowerStone(information) && GauntelHelper.hasSpaceStone(information) && GauntelHelper.hasRealityStone(information) && GauntelHelper.hasSoulStone(information);
}
};
public ItemSoulStone(String name) {
this.setTranslationKey(name);
this.setRegistryName(StringHelper.unlocalizedToResourceName(name));
@ -35,12 +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("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);
}

View 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);
}
}

View file

@ -1,10 +1,13 @@
package anvil.infinity.items;
import anvil.infinity.abilities.AbilityHasTimeStone;
import anvil.infinity.abilities.AbilityFastForward;
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;
@ -30,7 +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).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);
}

View file

@ -2,6 +2,8 @@ package anvil.infinity.items;
import anvil.infinity.Infinity;
import java.awt.*;
import anvil.infinity.config.ConfigHandler;
import lucraft.mods.lucraftcore.infinity.render.ItemRendererInfinityStone;
import lucraft.mods.lucraftcore.util.helper.ItemHelper;
import net.minecraft.item.Item;
@ -21,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) {
@ -30,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);
}
@ -38,17 +42,20 @@ public class Items {
public static void onRegisterModels(ModelRegistryEvent e) {
OBJLoader.INSTANCE.addDomain(Infinity.MOD_ID);
POWER_STONE.setTileEntityItemStackRenderer(new ItemRendererInfinityStone(Color.MAGENTA, Color.WHITE));
MIND_STONE.setTileEntityItemStackRenderer(new ItemRendererInfinityStone(Color.YELLOW, Color.WHITE));
REALITY_STONE.setTileEntityItemStackRenderer(new ItemRendererInfinityStone(Color.RED, Color.WHITE));
SOUL_STONE.setTileEntityItemStackRenderer(new ItemRendererInfinityStone(Color.ORANGE, Color.WHITE));
TIME_STONE.setTileEntityItemStackRenderer(new ItemRendererInfinityStone(Color.GREEN, Color.WHITE));
POWER_STONE.setTileEntityItemStackRenderer(new ItemRendererInfinityStone(new Color(ConfigHandler.powerStoneColor), new Color(ConfigHandler.powerStoneShine)));
MIND_STONE.setTileEntityItemStackRenderer(new ItemRendererInfinityStone(new Color(ConfigHandler.mindStoneColor), new Color(ConfigHandler.mindStoneShine)));
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");
ItemHelper.registerItemModel(MIND_STONE, Infinity.MOD_ID, "mind_stone");
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");
}

View file

@ -0,0 +1,24 @@
package anvil.infinity.networking;
import anvil.infinity.Infinity;
import net.minecraft.client.Minecraft;
import net.minecraft.util.math.RayTraceResult;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
public class LookAbilityPackageHandler implements IMessageHandler<PackageReq, IMessage> {
@Override
public IMessage onMessage(PackageReq message, MessageContext ctx) {
RayTraceResult result = Minecraft.getMinecraft().objectMouseOver;
if (result.typeOfHit == RayTraceResult.Type.ENTITY) {
PackageKillAbility pack = new PackageKillAbility();
pack.entity = result.entityHit;
pack.abilityID = message.id;
Infinity.NETWORK_WRAPPER.sendToServer(pack);
}
return null;
}
}

View file

@ -0,0 +1,19 @@
package anvil.infinity.networking;
import anvil.infinity.helpers.LookAbilityHelper;
import anvil.infinity.registry.Effects;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
public class LookAbilityReturnPackageHandler implements IMessageHandler<PackageKillAbility, IMessage> {
@Override
public IMessage onMessage(PackageKillAbility message, MessageContext ctx) {
LookAbilityHelper.activateEntityLookAbility(message.entity, message.abilityID);
return null;
}
}

View file

@ -0,0 +1,44 @@
package anvil.infinity.networking;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.network.ByteBufUtils;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
public class PackageKillAbility implements IMessage {
Entity entity;
public int abilityID;
public PackageKillAbility(Entity entity) {
super();
this.entity = entity;
}
public PackageKillAbility() {
super();
}
@Override
public void fromBytes(ByteBuf buf) {
String input = ByteBufUtils.readUTF8String(buf);
String[] inputs = input.split(":");
int dim = Integer.parseInt(inputs[0]);
int id = Integer.parseInt(inputs[1]);
abilityID = Integer.parseInt(inputs[2]);
World world = FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(dim);
entity = world.getEntityByID(id);
}
@Override
public void toBytes(ByteBuf buf) {
ByteBufUtils.writeUTF8String(buf, entity.dimension + ":" + entity.getEntityId() + ":" + abilityID);
}
}

View file

@ -0,0 +1,30 @@
package anvil.infinity.networking;
import anvil.infinity.helpers.LookAbilityHelper;
import io.netty.buffer.ByteBuf;
import net.minecraftforge.fml.common.network.ByteBufUtils;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
public class PackageReq implements IMessage {
int id;
public PackageReq() {
id = LookAbilityHelper.KILL;
}
public PackageReq(int abilityID) {
id = abilityID;
}
@Override
public void fromBytes(ByteBuf buf) {
id = Integer.parseInt(ByteBufUtils.readUTF8String(buf));
}
@Override
public void toBytes(ByteBuf buf) {
ByteBufUtils.writeUTF8String(buf, "" + id);
}
}

View file

@ -0,0 +1,26 @@
package anvil.infinity.registry;
import anvil.infinity.Infinity;
import anvil.infinity.abilities.*;
import lucraft.mods.lucraftcore.superpowers.abilities.AbilityEntry;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@Mod.EventBusSubscriber(modid = Infinity.MOD_ID)
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(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")));
}
}

View file

@ -0,0 +1,129 @@
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;
import lucraft.mods.lucraftcore.superpowers.abilities.supplier.IAbilityProvider;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.passive.EntityRabbit;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.management.PlayerList;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumHand;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.GameType;
import net.minecraft.world.WorldServer;
import net.minecraftforge.fml.common.FMLCommonHandler;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class SnapHelper {
static MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
public static boolean snap(EntityLivingBase entity) {
ICapabilityPlayerData data = GauntletUserInformation.getDataByEntity(entity);
if (GauntelHelper.hasFullGauntlet(entity)) {
WorldServer[] worlds = server.worlds;
if (data.getSnapResult() == SnapResult.KILLHALF) {
List<Entity> entities = new ArrayList<Entity>();
for (int i = 0; i < worlds.length; i++) {
entities.addAll(worlds[i].loadedEntityList);
}
boolean kill = false;
PlayerList players = server.getPlayerList();
TextComponentString msg = new TextComponentString(entity.getName() + ": ");
msg.appendSibling(new TextComponentTranslation("infinity.snap.text"));
msg.getStyle().setColor(TextFormatting.DARK_PURPLE);
msg.getStyle().setBold(true);
players.sendMessage(msg);
Random random = new Random();
for (int i = 0; i < entities.size(); i++) {
if (entities.get(i) != entity && entities.get(i) instanceof EntityLivingBase && kill && !(entities.get(i) instanceof EntityRabbit)) {
EntityLivingBase e = ((EntityLivingBase) entities.get(i));
e.addPotionEffect(new PotionEffect(Effects.snapEffect, random.nextInt((1200 - 10) + 1) - 10));
}
kill = !kill;
}
return true;
} else if (data.getSnapResult() == SnapResult.DESTROYSTONES) {
entity.setHealth(1);
Item mainHand = entity.getHeldItemMainhand().getItem();
Item offHand = entity.getHeldItemOffhand().getItem();
if (mainHand instanceof IAbilityProvider) {
entity.setHeldItem(EnumHand.MAIN_HAND, new ItemStack(mainHand));
}
if (offHand instanceof IAbilityProvider) {
entity.setHeldItem(EnumHand.OFF_HAND, new ItemStack(offHand));
}
entity.attackEntityFrom(DamageSource.MAGIC, (entity.getHealth() / 10) - 0.01f);
} else if (data.getSnapResult() == SnapResult.CREATIVE) {
if (ModConfig.General.snapCreative) {
if (entity instanceof EntityPlayer) {
if (((EntityPlayer) entity).capabilities.isCreativeMode) {
((EntityPlayer) entity).setGameType(GameType.SURVIVAL);
} else {
((EntityPlayer) entity).setGameType(GameType.CREATIVE);
}
return true;
}
}
} else if (data.getSnapResult() == SnapResult.BRINGBACK) {
} else if (data.getSnapResult() == SnapResult.RECREATE) {
} else if (data.getSnapResult() == SnapResult.KILLEVIL) {
List<Entity> entities = new ArrayList<Entity>();
for (int i = 0; i < worlds.length; i++) {
entities.addAll(worlds[i].loadedEntityList);
}
PlayerList players = server.getPlayerList();
TextComponentString msg = new TextComponentString(entity.getName() + ": ");
msg.appendSibling(new TextComponentTranslation("infinity.snap.irontext"));
msg.getStyle().setColor(TextFormatting.RED);
msg.getStyle().setBold(true);
players.sendMessage(msg);
Random random = new Random();
for (int i = 0; i < entities.size(); i++) {
if (entities.get(i) != entity && entities.get(i) instanceof EntityLivingBase) {
EntityLivingBase e = ((EntityLivingBase) entities.get(i));
if (e instanceof EntityMob) {
e.addPotionEffect(new PotionEffect(Effects.snapEffect, random.nextInt((1200 - 10) + 1) - 10));
} else if (e instanceof EntityPlayer && e.hasCapability(CapabilityKarma.KARMA_CAP, null)) {
if (e.getCapability(CapabilityKarma.KARMA_CAP, null).getKarma() < 1) {
e.addPotionEffect(new PotionEffect(Effects.snapEffect, random.nextInt((1200 - 10) + 1) - 10));
}
}
}
}
}
}
return false;
}
}

View file

@ -0,0 +1,60 @@
package anvil.infinity.snap;
import anvil.infinity.config.ConfigHandler;
import anvil.infinity.config.ModConfig;
public enum SnapResult {
KILLHALF,
DESTROYSTONES,
BRINGBACK,
RECREATE,
KILLEVIL,
CREATIVE;
final static String KILLHALFID = "Kill half";
final static String DESTROYSTONESID = "Destroy the Stones";
final static String BRINGBACKID = "Bring back the dusted (WIP)";
final static String RECREATEID = "Recreate the Universe (WIP)";
final static String KILLEVILID = "Kill evil entities";
final static String CREATIVEID = "Change to Creative";
public SnapResult next() {
switch(this) {
case KILLHALF: return DESTROYSTONES;
case DESTROYSTONES: return BRINGBACK;
case BRINGBACK: return RECREATE;
case RECREATE: return KILLEVIL;
case KILLEVIL: if (ModConfig.General.snapCreative) {return CREATIVE;} else {return KILLHALF;}
case CREATIVE: return KILLHALF;
}
return KILLHALF;
}
@Override
public String toString() {
switch (this) {
case KILLHALF: return KILLHALFID;
case DESTROYSTONES: return DESTROYSTONESID;
case BRINGBACK: return BRINGBACKID;
case RECREATE: return RECREATEID;
case KILLEVIL: return KILLEVILID;
case CREATIVE: return CREATIVEID;
}
return "Kill half";
}
public static SnapResult fromString(String s) {
switch (s) {
case KILLHALFID: return KILLHALF;
case DESTROYSTONESID: return DESTROYSTONES;
case BRINGBACKID: return BRINGBACK;
case RECREATEID: return RECREATE;
case KILLEVILID: return KILLEVIL;
case CREATIVEID: return CREATIVE;
}
return KILLHALF;
}
}

View file

@ -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;
}
}

View 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);
}
}

View 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;
}
}

View file

@ -0,0 +1,27 @@
{
"display": {
"icon": {
"item": "infinity:reality_stone"
},
"title": {
"translate": "infinity.advancements.infinity.reality_stone.title"
},
"description": {
"translate": "infinity.advancements.infinity.reality_stone.description"
},
"frame": "goal"
},
"parent": "lucraftcore:infinity/root",
"criteria": {
"item": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "infinity:reality_stone"
}
]
}
}
}
}

View file

@ -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
@ -15,4 +16,6 @@ infinity.advancements.infinity.soul_stone.description=Finde den Seelenstein
infinity.advancements.infinity.mind_stone.title=Gedanke
infinity.advancements.infinity.mind_stone.description=Finde den Gedankenstein
infinity.advancements.infinity.power_stone.title=Macht
infinity.advancements.infinity.power_stone.description=Finde den Machtstein
infinity.advancements.infinity.power_stone.description=Finde den Stein der Macht
infinity.advancements.infinity.reality_stone.title=Realität
infinity.advancements.infinity.reality_stone.description=Finde den Realitätsstein

View file

@ -3,7 +3,9 @@ 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
@ -17,3 +19,5 @@ infinity.advancements.infinity.mind_stone.title=Mind
infinity.advancements.infinity.mind_stone.description=Get the Mind Stone
infinity.advancements.infinity.power_stone.title=Power
infinity.advancements.infinity.power_stone.description=Get the Power Stone
infinity.advancements.infinity.reality_stone.title=Reality
infinity.advancements.infinity.reality_stone.description=Get the Reality Stone

View file

@ -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 ]
}
}
}