mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-05 04:49:10 +01:00
added the breathlessness effect
This commit is contained in:
parent
3cf875cc7c
commit
3598e424b0
28 changed files with 260 additions and 137 deletions
|
@ -1,14 +1,9 @@
|
||||||
package de.ellpeck.naturesaura;
|
package de.ellpeck.naturesaura;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockFlower;
|
|
||||||
import net.minecraft.block.BlockStoneBrick;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraftforge.common.config.Config;
|
import net.minecraftforge.common.config.Config;
|
||||||
import net.minecraftforge.common.config.Config.Comment;
|
import net.minecraftforge.common.config.Config.Comment;
|
||||||
import net.minecraftforge.common.config.Config.RangeDouble;
|
import net.minecraftforge.common.config.Config.RangeDouble;
|
||||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
|
||||||
|
|
||||||
@Config(modid = NaturesAura.MOD_ID, category = "")
|
@Config(modid = NaturesAura.MOD_ID, category = "")
|
||||||
public final class ModConfig {
|
public final class ModConfig {
|
||||||
|
@ -40,6 +35,8 @@ public final class ModConfig {
|
||||||
public boolean plantBoostEffect = true;
|
public boolean plantBoostEffect = true;
|
||||||
@Comment("If the Aura Imbalance effect of explosions happening randomly if Aura levels are too low should occur")
|
@Comment("If the Aura Imbalance effect of explosions happening randomly if Aura levels are too low should occur")
|
||||||
public boolean explosionEffect = true;
|
public boolean explosionEffect = true;
|
||||||
|
@Comment("If the Aura Imbalance effect of breathlessness if Aura levels are too low should occur")
|
||||||
|
public boolean breathlessEffect = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Client {
|
public static class Client {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import de.ellpeck.naturesaura.compat.Compat;
|
||||||
import de.ellpeck.naturesaura.events.CommonEvents;
|
import de.ellpeck.naturesaura.events.CommonEvents;
|
||||||
import de.ellpeck.naturesaura.items.ModItems;
|
import de.ellpeck.naturesaura.items.ModItems;
|
||||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||||
|
import de.ellpeck.naturesaura.potion.ModPotions;
|
||||||
import de.ellpeck.naturesaura.proxy.IProxy;
|
import de.ellpeck.naturesaura.proxy.IProxy;
|
||||||
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
||||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||||
|
@ -59,6 +60,7 @@ public final class NaturesAura {
|
||||||
|
|
||||||
new ModBlocks();
|
new ModBlocks();
|
||||||
new ModItems();
|
new ModItems();
|
||||||
|
new ModPotions();
|
||||||
|
|
||||||
Compat.preInit();
|
Compat.preInit();
|
||||||
PacketHandler.init();
|
PacketHandler.init();
|
||||||
|
|
|
@ -32,11 +32,11 @@ import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockAncientLeaves extends BlockLeaves implements
|
public class BlockAncientLeaves extends BlockLeaves implements
|
||||||
IModItem, IModelProvider, IColorProvidingBlock, IColorProvidingItem, ITileEntityProvider {
|
IModItem, ICreativeItem, IModelProvider, IColorProvidingBlock, IColorProvidingItem, ITileEntityProvider {
|
||||||
|
|
||||||
public BlockAncientLeaves() {
|
public BlockAncientLeaves() {
|
||||||
this.leavesFancy = true;
|
this.leavesFancy = true;
|
||||||
ModRegistry.addItemOrBlock(this);
|
ModRegistry.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,11 +49,6 @@ public class BlockAncientLeaves extends BlockLeaves implements
|
||||||
return "ancient_leaves";
|
return "ancient_leaves";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPreInit(FMLPreInitializationEvent event) {
|
public void onPreInit(FMLPreInitializationEvent event) {
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,20 @@
|
||||||
package de.ellpeck.naturesaura.blocks;
|
package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.reg.ICreativeItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModItem;
|
import de.ellpeck.naturesaura.reg.IModItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||||
import net.minecraft.block.BlockLog;
|
import net.minecraft.block.BlockLog;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
import java.util.Collections;
|
public class BlockAncientLog extends BlockLog implements IModItem, ICreativeItem, IModelProvider {
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class BlockAncientLog extends BlockLog implements IModItem, IModelProvider {
|
|
||||||
|
|
||||||
public BlockAncientLog() {
|
public BlockAncientLog() {
|
||||||
ModRegistry.addItemOrBlock(this);
|
ModRegistry.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,11 +22,6 @@ public class BlockAncientLog extends BlockLog implements IModItem, IModelProvide
|
||||||
return "ancient_log";
|
return "ancient_log";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPreInit(FMLPreInitializationEvent event) {
|
public void onPreInit(FMLPreInitializationEvent event) {
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package de.ellpeck.naturesaura.blocks;
|
package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
|
||||||
import de.ellpeck.naturesaura.gen.WorldGenAncientTree;
|
import de.ellpeck.naturesaura.gen.WorldGenAncientTree;
|
||||||
|
import de.ellpeck.naturesaura.reg.ICreativeItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModItem;
|
import de.ellpeck.naturesaura.reg.IModItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||||
|
@ -11,8 +11,6 @@ import net.minecraft.block.IGrowable;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
@ -22,11 +20,9 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockAncientSapling extends BlockBush implements IGrowable, IModItem, IModelProvider {
|
public class BlockAncientSapling extends BlockBush implements IGrowable, IModItem, ICreativeItem, IModelProvider {
|
||||||
|
|
||||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(
|
private static final AxisAlignedBB AABB = new AxisAlignedBB(
|
||||||
0.09999999403953552D, 0.0D, 0.09999999403953552D,
|
0.09999999403953552D, 0.0D, 0.09999999403953552D,
|
||||||
|
@ -36,7 +32,7 @@ public class BlockAncientSapling extends BlockBush implements IGrowable, IModIte
|
||||||
this.setHardness(0.0F);
|
this.setHardness(0.0F);
|
||||||
this.setSoundType(SoundType.PLANT);
|
this.setSoundType(SoundType.PLANT);
|
||||||
|
|
||||||
ModRegistry.addItemOrBlock(this);
|
ModRegistry.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,11 +56,6 @@ public class BlockAncientSapling extends BlockBush implements IGrowable, IModIte
|
||||||
return "ancient_sapling";
|
return "ancient_sapling";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPreInit(FMLPreInitializationEvent event) {
|
public void onPreInit(FMLPreInitializationEvent event) {
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityImpl;
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityImpl;
|
||||||
|
import de.ellpeck.naturesaura.reg.ICreativeItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModItem;
|
import de.ellpeck.naturesaura.reg.IModItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||||
|
@ -26,7 +27,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class BlockContainerImpl extends BlockContainer implements IModItem, IModelProvider {
|
public class BlockContainerImpl extends BlockContainer implements IModItem, ICreativeItem, IModelProvider {
|
||||||
|
|
||||||
private final String baseName;
|
private final String baseName;
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ public class BlockContainerImpl extends BlockContainer implements IModItem, IMod
|
||||||
this.tileClass = tileClass;
|
this.tileClass = tileClass;
|
||||||
this.tileRegName = tileReg;
|
this.tileRegName = tileReg;
|
||||||
|
|
||||||
ModRegistry.addItemOrBlock(this);
|
ModRegistry.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -58,11 +59,6 @@ public class BlockContainerImpl extends BlockContainer implements IModItem, IMod
|
||||||
return this.baseName;
|
return this.baseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPreInit(FMLPreInitializationEvent event) {
|
public void onPreInit(FMLPreInitializationEvent event) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class BlockGoldenLeaves extends BlockLeaves implements
|
||||||
|
|
||||||
public BlockGoldenLeaves() {
|
public BlockGoldenLeaves() {
|
||||||
this.leavesFancy = true;
|
this.leavesFancy = true;
|
||||||
ModRegistry.addItemOrBlock(this);
|
ModRegistry.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -50,11 +50,6 @@ public class BlockGoldenLeaves extends BlockLeaves implements
|
||||||
return "golden_leaves";
|
return "golden_leaves";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPreInit(FMLPreInitializationEvent event) {
|
public void onPreInit(FMLPreInitializationEvent event) {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package de.ellpeck.naturesaura.blocks;
|
package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
|
import de.ellpeck.naturesaura.reg.ICreativeItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModItem;
|
import de.ellpeck.naturesaura.reg.IModItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||||
|
@ -10,14 +11,14 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
public class BlockImpl extends Block implements IModItem, IModelProvider {
|
public class BlockImpl extends Block implements IModItem, ICreativeItem, IModelProvider {
|
||||||
|
|
||||||
private final String baseName;
|
private final String baseName;
|
||||||
|
|
||||||
public BlockImpl(String baseName, Material material) {
|
public BlockImpl(String baseName, Material material) {
|
||||||
super(material);
|
super(material);
|
||||||
this.baseName = baseName;
|
this.baseName = baseName;
|
||||||
ModRegistry.addItemOrBlock(this);
|
ModRegistry.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,11 +26,6 @@ public class BlockImpl extends Block implements IModItem, IModelProvider {
|
||||||
return this.baseName;
|
return this.baseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPreInit(FMLPreInitializationEvent event) {
|
public void onPreInit(FMLPreInitializationEvent event) {
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.block.properties.PropertyEnum;
|
||||||
import net.minecraft.block.state.BlockFaceShape;
|
import net.minecraft.block.state.BlockFaceShape;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
|
@ -39,8 +40,8 @@ public abstract class BlockSlabsNA extends BlockImpl implements ICustomItemBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldAddCreative() {
|
public CreativeTabs getTabToAdd() {
|
||||||
return !this.isDouble();
|
return this.isDouble() ? null : super.getTabToAdd();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package de.ellpeck.naturesaura.blocks;
|
package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
|
import de.ellpeck.naturesaura.reg.ICreativeItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModItem;
|
import de.ellpeck.naturesaura.reg.IModItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||||
|
@ -11,14 +12,14 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
public class BlockStairsNA extends BlockStairs implements IModItem, IModelProvider {
|
public class BlockStairsNA extends BlockStairs implements IModItem, ICreativeItem, IModelProvider {
|
||||||
|
|
||||||
private final String baseName;
|
private final String baseName;
|
||||||
|
|
||||||
protected BlockStairsNA(String baseName, IBlockState modelState) {
|
protected BlockStairsNA(String baseName, IBlockState modelState) {
|
||||||
super(modelState);
|
super(modelState);
|
||||||
this.baseName = baseName;
|
this.baseName = baseName;
|
||||||
ModRegistry.addItemOrBlock(this);
|
ModRegistry.add(this);
|
||||||
this.fullBlock = false;
|
this.fullBlock = false;
|
||||||
this.lightOpacity = 0;
|
this.lightOpacity = 0;
|
||||||
}
|
}
|
||||||
|
@ -28,11 +29,6 @@ public class BlockStairsNA extends BlockStairs implements IModItem, IModelProvid
|
||||||
return this.baseName;
|
return this.baseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPreInit(FMLPreInitializationEvent event) {
|
public void onPreInit(FMLPreInitializationEvent event) {
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package de.ellpeck.naturesaura.chunk.effect;
|
||||||
|
|
||||||
|
import de.ellpeck.naturesaura.ModConfig;
|
||||||
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
|
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||||
|
import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect;
|
||||||
|
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||||
|
import de.ellpeck.naturesaura.potion.ModPotions;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import org.apache.commons.lang3.mutable.MutableInt;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BreathlessEffect implements IDrainSpotEffect {
|
||||||
|
|
||||||
|
public static final ResourceLocation NAME = new ResourceLocation(NaturesAura.MOD_ID, "breathless");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(World world, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, MutableInt spot) {
|
||||||
|
if (spot.intValue() >= 0 || world.getTotalWorldTime() % 100 != 0)
|
||||||
|
return;
|
||||||
|
int aura = IAuraChunk.getAuraInArea(world, pos, 50);
|
||||||
|
if (aura > 0)
|
||||||
|
return;
|
||||||
|
int dist = Math.min(Math.abs(aura) / 500, 75);
|
||||||
|
if (dist < 10)
|
||||||
|
return;
|
||||||
|
int amp = Math.min(MathHelper.floor(Math.abs(aura) / 25000F), 3);
|
||||||
|
|
||||||
|
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class,
|
||||||
|
new AxisAlignedBB(pos).grow(dist));
|
||||||
|
for (EntityLivingBase entity : entities)
|
||||||
|
entity.addPotionEffect(new PotionEffect(ModPotions.BREATHLESS, 300, amp));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean appliesHere(Chunk chunk, IAuraChunk auraChunk, IAuraType type) {
|
||||||
|
return ModConfig.enabledFeatures.breathlessEffect;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,5 +10,6 @@ public final class DrainSpotEffects {
|
||||||
NaturesAuraAPI.DRAIN_SPOT_EFFECTS.put(ReplenishingEffect.NAME, ReplenishingEffect::new);
|
NaturesAuraAPI.DRAIN_SPOT_EFFECTS.put(ReplenishingEffect.NAME, ReplenishingEffect::new);
|
||||||
NaturesAuraAPI.DRAIN_SPOT_EFFECTS.put(BalanceEffect.NAME, BalanceEffect::new);
|
NaturesAuraAPI.DRAIN_SPOT_EFFECTS.put(BalanceEffect.NAME, BalanceEffect::new);
|
||||||
NaturesAuraAPI.DRAIN_SPOT_EFFECTS.put(ExplosionEffect.NAME, ExplosionEffect::new);
|
NaturesAuraAPI.DRAIN_SPOT_EFFECTS.put(ExplosionEffect.NAME, ExplosionEffect::new);
|
||||||
|
NaturesAuraAPI.DRAIN_SPOT_EFFECTS.put(BreathlessEffect.NAME, BreathlessEffect::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,11 @@ public class GrassDieEffect implements IDrainSpotEffect {
|
||||||
@Override
|
@Override
|
||||||
public void update(World world, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, MutableInt spot) {
|
public void update(World world, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, MutableInt spot) {
|
||||||
if (spot.intValue() < 0) {
|
if (spot.intValue() < 0) {
|
||||||
int aura = IAuraChunk.getAuraInArea(world, pos, 25);
|
int aura = IAuraChunk.getAuraInArea(world, pos, 50);
|
||||||
if (aura < 0) {
|
if (aura < 0) {
|
||||||
int amount = Math.min(300, Math.abs(aura) / 1000);
|
int amount = Math.min(300, Math.abs(aura) / 1000);
|
||||||
if (amount > 1) {
|
if (amount > 1) {
|
||||||
int dist = MathHelper.clamp(Math.abs(aura) / 750, 5, 45);
|
int dist = MathHelper.clamp(Math.abs(aura) / 750, 5, 75);
|
||||||
for (int i = amount / 2 + world.rand.nextInt(amount / 2); i >= 0; i--) {
|
for (int i = amount / 2 + world.rand.nextInt(amount / 2); i >= 0; i--) {
|
||||||
BlockPos grassPos = new BlockPos(
|
BlockPos grassPos = new BlockPos(
|
||||||
pos.getX() + world.rand.nextGaussian() * dist,
|
pos.getX() + world.rand.nextGaussian() * dist,
|
||||||
|
|
|
@ -1,26 +1,21 @@
|
||||||
package de.ellpeck.naturesaura.items;
|
package de.ellpeck.naturesaura.items;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.reg.ICreativeItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModItem;
|
import de.ellpeck.naturesaura.reg.IModItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
import java.util.Collections;
|
public class ItemImpl extends Item implements IModItem, ICreativeItem, IModelProvider {
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class ItemImpl extends Item implements IModItem, IModelProvider {
|
|
||||||
|
|
||||||
private final String baseName;
|
private final String baseName;
|
||||||
|
|
||||||
public ItemImpl(String baseName) {
|
public ItemImpl(String baseName) {
|
||||||
this.baseName = baseName;
|
this.baseName = baseName;
|
||||||
ModRegistry.addItemOrBlock(this);
|
ModRegistry.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -28,11 +23,6 @@ public class ItemImpl extends Item implements IModItem, IModelProvider {
|
||||||
return this.baseName;
|
return this.baseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPreInit(FMLPreInitializationEvent event) {
|
public void onPreInit(FMLPreInitializationEvent event) {
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.items.tools;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.Helper;
|
import de.ellpeck.naturesaura.Helper;
|
||||||
import de.ellpeck.naturesaura.items.ModItems;
|
import de.ellpeck.naturesaura.items.ModItems;
|
||||||
|
import de.ellpeck.naturesaura.reg.ICreativeItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModItem;
|
import de.ellpeck.naturesaura.reg.IModItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||||
|
@ -17,13 +18,13 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class ItemAxeNA extends ItemAxe implements IModItem, IModelProvider {
|
public class ItemAxeNA extends ItemAxe implements IModItem, ICreativeItem, IModelProvider {
|
||||||
private final String baseName;
|
private final String baseName;
|
||||||
|
|
||||||
public ItemAxeNA(String baseName, ToolMaterial material, float damage, float speed) {
|
public ItemAxeNA(String baseName, ToolMaterial material, float damage, float speed) {
|
||||||
super(material, damage, speed);
|
super(material, damage, speed);
|
||||||
this.baseName = baseName;
|
this.baseName = baseName;
|
||||||
ModRegistry.addItemOrBlock(this);
|
ModRegistry.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -31,11 +32,6 @@ public class ItemAxeNA extends ItemAxe implements IModItem, IModelProvider {
|
||||||
return this.baseName;
|
return this.baseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPreInit(FMLPreInitializationEvent event) {
|
public void onPreInit(FMLPreInitializationEvent event) {
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package de.ellpeck.naturesaura.items.tools;
|
package de.ellpeck.naturesaura.items.tools;
|
||||||
|
|
||||||
|
import crafttweaker.api.creativetabs.ICreativeTab;
|
||||||
import de.ellpeck.naturesaura.Helper;
|
import de.ellpeck.naturesaura.Helper;
|
||||||
import de.ellpeck.naturesaura.items.ModItems;
|
import de.ellpeck.naturesaura.items.ModItems;
|
||||||
|
import de.ellpeck.naturesaura.reg.ICreativeItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModItem;
|
import de.ellpeck.naturesaura.reg.IModItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||||
|
@ -24,14 +26,14 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class ItemHoeNA extends ItemHoe implements IModItem, IModelProvider {
|
public class ItemHoeNA extends ItemHoe implements IModItem, ICreativeItem, IModelProvider {
|
||||||
|
|
||||||
private final String baseName;
|
private final String baseName;
|
||||||
|
|
||||||
public ItemHoeNA(String baseName, ToolMaterial material) {
|
public ItemHoeNA(String baseName, ToolMaterial material) {
|
||||||
super(material);
|
super(material);
|
||||||
this.baseName = baseName;
|
this.baseName = baseName;
|
||||||
ModRegistry.addItemOrBlock(this);
|
ModRegistry.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -66,11 +68,6 @@ public class ItemHoeNA extends ItemHoe implements IModItem, IModelProvider {
|
||||||
return this.baseName;
|
return this.baseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPreInit(FMLPreInitializationEvent event) {
|
public void onPreInit(FMLPreInitializationEvent event) {
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,12 @@ package de.ellpeck.naturesaura.items.tools;
|
||||||
import de.ellpeck.naturesaura.Helper;
|
import de.ellpeck.naturesaura.Helper;
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
import de.ellpeck.naturesaura.items.ModItems;
|
import de.ellpeck.naturesaura.items.ModItems;
|
||||||
|
import de.ellpeck.naturesaura.reg.ICreativeItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModItem;
|
import de.ellpeck.naturesaura.reg.IModItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||||
import net.minecraft.block.BlockStoneBrick;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.init.SoundEvents;
|
import net.minecraft.init.SoundEvents;
|
||||||
import net.minecraft.item.ItemPickaxe;
|
import net.minecraft.item.ItemPickaxe;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -27,14 +26,14 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class ItemPickaxeNA extends ItemPickaxe implements IModItem, IModelProvider {
|
public class ItemPickaxeNA extends ItemPickaxe implements IModItem, ICreativeItem, IModelProvider {
|
||||||
|
|
||||||
private final String baseName;
|
private final String baseName;
|
||||||
|
|
||||||
public ItemPickaxeNA(String baseName, ToolMaterial material) {
|
public ItemPickaxeNA(String baseName, ToolMaterial material) {
|
||||||
super(material);
|
super(material);
|
||||||
this.baseName = baseName;
|
this.baseName = baseName;
|
||||||
ModRegistry.addItemOrBlock(this);
|
ModRegistry.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,11 +41,6 @@ public class ItemPickaxeNA extends ItemPickaxe implements IModItem, IModelProvid
|
||||||
return this.baseName;
|
return this.baseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPreInit(FMLPreInitializationEvent event) {
|
public void onPreInit(FMLPreInitializationEvent event) {
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.items.tools;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.Helper;
|
import de.ellpeck.naturesaura.Helper;
|
||||||
import de.ellpeck.naturesaura.items.ModItems;
|
import de.ellpeck.naturesaura.items.ModItems;
|
||||||
|
import de.ellpeck.naturesaura.reg.ICreativeItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModItem;
|
import de.ellpeck.naturesaura.reg.IModItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||||
|
@ -27,13 +28,13 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class ItemShovelNA extends ItemSpade implements IModItem, IModelProvider {
|
public class ItemShovelNA extends ItemSpade implements IModItem, ICreativeItem, IModelProvider {
|
||||||
private final String baseName;
|
private final String baseName;
|
||||||
|
|
||||||
public ItemShovelNA(String baseName, ToolMaterial material) {
|
public ItemShovelNA(String baseName, ToolMaterial material) {
|
||||||
super(material);
|
super(material);
|
||||||
this.baseName = baseName;
|
this.baseName = baseName;
|
||||||
ModRegistry.addItemOrBlock(this);
|
ModRegistry.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -81,11 +82,6 @@ public class ItemShovelNA extends ItemSpade implements IModItem, IModelProvider
|
||||||
return this.baseName;
|
return this.baseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPreInit(FMLPreInitializationEvent event) {
|
public void onPreInit(FMLPreInitializationEvent event) {
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.items.tools;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.Helper;
|
import de.ellpeck.naturesaura.Helper;
|
||||||
import de.ellpeck.naturesaura.items.ModItems;
|
import de.ellpeck.naturesaura.items.ModItems;
|
||||||
|
import de.ellpeck.naturesaura.reg.ICreativeItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModItem;
|
import de.ellpeck.naturesaura.reg.IModItem;
|
||||||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||||
|
@ -18,13 +19,13 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class ItemSwordNA extends ItemSword implements IModItem, IModelProvider {
|
public class ItemSwordNA extends ItemSword implements IModItem, ICreativeItem, IModelProvider {
|
||||||
private final String baseName;
|
private final String baseName;
|
||||||
|
|
||||||
public ItemSwordNA(String baseName, ToolMaterial material) {
|
public ItemSwordNA(String baseName, ToolMaterial material) {
|
||||||
super(material);
|
super(material);
|
||||||
this.baseName = baseName;
|
this.baseName = baseName;
|
||||||
ModRegistry.addItemOrBlock(this);
|
ModRegistry.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -32,11 +33,6 @@ public class ItemSwordNA extends ItemSword implements IModItem, IModelProvider {
|
||||||
return this.baseName;
|
return this.baseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldAddCreative() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPreInit(FMLPreInitializationEvent event) {
|
public void onPreInit(FMLPreInitializationEvent event) {
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package de.ellpeck.naturesaura.potion;
|
||||||
|
|
||||||
|
import net.minecraft.potion.Potion;
|
||||||
|
|
||||||
|
public final class ModPotions {
|
||||||
|
|
||||||
|
public static final Potion BREATHLESS = new PotionBreathless().setIconIndex(0, 0);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package de.ellpeck.naturesaura.potion;
|
||||||
|
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.DamageSource;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.entity.living.LivingHealEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class PotionBreathless extends PotionImpl {
|
||||||
|
|
||||||
|
private final Random random = new Random();
|
||||||
|
|
||||||
|
protected PotionBreathless() {
|
||||||
|
super("breathless", true, 0);
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onHeal(LivingHealEvent event) {
|
||||||
|
PotionEffect effect = event.getEntityLiving().getActivePotionEffect(this);
|
||||||
|
if (effect == null)
|
||||||
|
return;
|
||||||
|
float chance = (effect.getAmplifier() + 1) / 15F;
|
||||||
|
if (this.random.nextFloat() <= chance) {
|
||||||
|
event.setAmount(event.getAmount() / 4F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isReady(int duration, int amplifier) {
|
||||||
|
int mod = 200 >> amplifier;
|
||||||
|
return mod > 0 && duration % mod == 0 && this.random.nextBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void performEffect(EntityLivingBase entity, int amplifier) {
|
||||||
|
entity.attackEntityFrom(DamageSource.MAGIC, 1F);
|
||||||
|
}
|
||||||
|
}
|
58
src/main/java/de/ellpeck/naturesaura/potion/PotionImpl.java
Normal file
58
src/main/java/de/ellpeck/naturesaura/potion/PotionImpl.java
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
package de.ellpeck.naturesaura.potion;
|
||||||
|
|
||||||
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
|
import de.ellpeck.naturesaura.reg.IModItem;
|
||||||
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.potion.Potion;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
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.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public class PotionImpl extends Potion implements IModItem {
|
||||||
|
|
||||||
|
private static final ResourceLocation TEXTURE = new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/potions.png");
|
||||||
|
protected final String baseName;
|
||||||
|
|
||||||
|
protected PotionImpl(String baseName, boolean isBadEffectIn, int liquidColorIn) {
|
||||||
|
super(isBadEffectIn, liquidColorIn);
|
||||||
|
this.baseName = baseName;
|
||||||
|
|
||||||
|
ModRegistry.add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Potion setIconIndex(int x, int y) {
|
||||||
|
return super.setIconIndex(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getStatusIconIndex() {
|
||||||
|
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
|
||||||
|
return super.getStatusIconIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getBaseName() {
|
||||||
|
return this.baseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPreInit(FMLPreInitializationEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInit(FMLInitializationEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPostInit(FMLPostInitializationEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
11
src/main/java/de/ellpeck/naturesaura/reg/ICreativeItem.java
Normal file
11
src/main/java/de/ellpeck/naturesaura/reg/ICreativeItem.java
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
package de.ellpeck.naturesaura.reg;
|
||||||
|
|
||||||
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
|
||||||
|
public interface ICreativeItem {
|
||||||
|
|
||||||
|
default CreativeTabs getTabToAdd() {
|
||||||
|
return NaturesAura.CREATIVE_TAB;
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,8 +8,6 @@ public interface IModItem {
|
||||||
|
|
||||||
String getBaseName();
|
String getBaseName();
|
||||||
|
|
||||||
boolean shouldAddCreative();
|
|
||||||
|
|
||||||
void onPreInit(FMLPreInitializationEvent event);
|
void onPreInit(FMLPreInitializationEvent event);
|
||||||
|
|
||||||
void onInit(FMLInitializationEvent event);
|
void onInit(FMLInitializationEvent event);
|
||||||
|
|
|
@ -3,9 +3,11 @@ package de.ellpeck.naturesaura.reg;
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.potion.Potion;
|
||||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
@ -19,23 +21,27 @@ public final class ModRegistry {
|
||||||
|
|
||||||
private static final List<IModItem> ALL_ITEMS = new ArrayList<>();
|
private static final List<IModItem> ALL_ITEMS = new ArrayList<>();
|
||||||
|
|
||||||
public static void addItemOrBlock(IModItem item) {
|
public static void add(IModItem item) {
|
||||||
ALL_ITEMS.add(item);
|
ALL_ITEMS.add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerItem(Item item, String name, boolean addCreative) {
|
private static void registerPotion(Potion potion, String name) {
|
||||||
|
potion.setPotionName("potion." + NaturesAura.MOD_ID + "." + name + ".name");
|
||||||
|
|
||||||
|
potion.setRegistryName(NaturesAura.MOD_ID, name);
|
||||||
|
ForgeRegistries.POTIONS.register(potion);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void registerItem(Item item, String name, CreativeTabs tab) {
|
||||||
item.setTranslationKey(NaturesAura.MOD_ID + "." + name);
|
item.setTranslationKey(NaturesAura.MOD_ID + "." + name);
|
||||||
|
|
||||||
item.setRegistryName(NaturesAura.MOD_ID, name);
|
item.setRegistryName(NaturesAura.MOD_ID, name);
|
||||||
ForgeRegistries.ITEMS.register(item);
|
ForgeRegistries.ITEMS.register(item);
|
||||||
|
|
||||||
if (addCreative)
|
item.setCreativeTab(tab);
|
||||||
item.setCreativeTab(NaturesAura.CREATIVE_TAB);
|
|
||||||
else
|
|
||||||
item.setCreativeTab(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerBlock(Block block, String name, ItemBlock item, boolean addCreative) {
|
private static void registerBlock(Block block, String name, ItemBlock item, CreativeTabs tab) {
|
||||||
block.setTranslationKey(NaturesAura.MOD_ID + "." + name);
|
block.setTranslationKey(NaturesAura.MOD_ID + "." + name);
|
||||||
|
|
||||||
block.setRegistryName(NaturesAura.MOD_ID, name);
|
block.setRegistryName(NaturesAura.MOD_ID, name);
|
||||||
|
@ -46,17 +52,20 @@ public final class ModRegistry {
|
||||||
ForgeRegistries.ITEMS.register(item);
|
ForgeRegistries.ITEMS.register(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addCreative)
|
item.setCreativeTab(tab);
|
||||||
block.setCreativeTab(NaturesAura.CREATIVE_TAB);
|
}
|
||||||
else
|
|
||||||
block.setCreativeTab(null);
|
private static CreativeTabs getTab(IModItem item) {
|
||||||
|
if (item instanceof ICreativeItem)
|
||||||
|
return ((ICreativeItem) item).getTabToAdd();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void preInit(FMLPreInitializationEvent event) {
|
public static void preInit(FMLPreInitializationEvent event) {
|
||||||
for (IModItem item : ALL_ITEMS) {
|
for (IModItem item : ALL_ITEMS) {
|
||||||
if (item instanceof Item)
|
if (item instanceof Item) {
|
||||||
registerItem((Item) item, item.getBaseName(), item.shouldAddCreative());
|
registerItem((Item) item, item.getBaseName(), getTab(item));
|
||||||
else if (item instanceof Block) {
|
} else if (item instanceof Block) {
|
||||||
Block block = (Block) item;
|
Block block = (Block) item;
|
||||||
|
|
||||||
ItemBlock itemBlock;
|
ItemBlock itemBlock;
|
||||||
|
@ -65,8 +74,9 @@ public final class ModRegistry {
|
||||||
else
|
else
|
||||||
itemBlock = new ItemBlock(block);
|
itemBlock = new ItemBlock(block);
|
||||||
|
|
||||||
registerBlock(block, item.getBaseName(), itemBlock, item.shouldAddCreative());
|
registerBlock(block, item.getBaseName(), itemBlock, getTab(item));
|
||||||
}
|
} else if (item instanceof Potion)
|
||||||
|
registerPotion((Potion) item, item.getBaseName());
|
||||||
|
|
||||||
if (item instanceof IModelProvider) {
|
if (item instanceof IModelProvider) {
|
||||||
Map<ItemStack, ModelResourceLocation> models = ((IModelProvider) item).getModelLocations();
|
Map<ItemStack, ModelResourceLocation> models = ((IModelProvider) item).getModelLocations();
|
||||||
|
|
|
@ -108,4 +108,6 @@ advancement.naturesaura.offering.desc=Create an Offering Table for the Offering
|
||||||
advancement.naturesaura.sky_ingot=Sturdy and light
|
advancement.naturesaura.sky_ingot=Sturdy and light
|
||||||
advancement.naturesaura.sky_ingot.desc=Create an Ingot of the Skies using the Offering to the Gods
|
advancement.naturesaura.sky_ingot.desc=Create an Ingot of the Skies using the Offering to the Gods
|
||||||
|
|
||||||
command.naturesaura.aura.usage=/naaura <action> <amount> <range>
|
command.naturesaura.aura.usage=/naaura <action> <amount> <range>
|
||||||
|
|
||||||
|
potion.naturesaura.breathless.name=Breathless
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"name": "Breathlessness",
|
||||||
|
"icon": "minecraft:wool",
|
||||||
|
"category": "effects",
|
||||||
|
"advancement": "naturesaura:furnace_heater",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "The removal of $(aura) from an area not only has an effect on plantlife around the effected area, but also on creatures that require $(item)oxygen$() to breathe. These creatures will quickly notice that, the more $(aura) is drained, the less easy it becomes to breathe: Their lungs will start producing an acute pain that stings in irregular intervals, and it becomes severely harder to regenerate health."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
BIN
src/main/resources/assets/naturesaura/textures/gui/potions.png
Normal file
BIN
src/main/resources/assets/naturesaura/textures/gui/potions.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
Loading…
Reference in a new issue