Merge pull request #62 from Quarris/master

port part 1
This commit is contained in:
Ellpeck 2019-11-04 19:14:33 +01:00 committed by GitHub
commit b81155ceb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
179 changed files with 1872 additions and 2255 deletions

View file

@ -1,6 +1,5 @@
package de.ellpeck.naturesaura; package de.ellpeck.naturesaura;
import baubles.api.BaublesApi;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer; import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
@ -9,6 +8,7 @@ import de.ellpeck.naturesaura.api.multiblock.IMultiblock;
import de.ellpeck.naturesaura.blocks.multi.Multiblock; import de.ellpeck.naturesaura.blocks.multi.Multiblock;
import de.ellpeck.naturesaura.compat.Compat; import de.ellpeck.naturesaura.compat.Compat;
import de.ellpeck.naturesaura.misc.WorldData; import de.ellpeck.naturesaura.misc.WorldData;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -17,11 +17,9 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
import org.apache.commons.lang3.mutable.MutableFloat; import org.apache.commons.lang3.mutable.MutableFloat;
import org.apache.commons.lang3.mutable.MutableInt; import org.apache.commons.lang3.mutable.MutableInt;
import org.apache.commons.lang3.mutable.MutableObject; import org.apache.commons.lang3.mutable.MutableObject;
import org.lwjgl.util.vector.Vector3f;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -39,10 +37,11 @@ public class InternalHooks implements NaturesAuraAPI.IInternalHooks {
} }
private boolean auraPlayerInteraction(PlayerEntity player, int amount, boolean extract, boolean simulate) { private boolean auraPlayerInteraction(PlayerEntity player, int amount, boolean extract, boolean simulate) {
if (extract && player.capabilities.isCreativeMode) if (extract && player.isCreative())
return true; return true;
if (Compat.baubles) { if (Compat.baubles) { // Baubles dont exist for 1.14 yet
/*
IItemHandler baubles = BaublesApi.getBaublesHandler(player); IItemHandler baubles = BaublesApi.getBaublesHandler(player);
for (int i = 0; i < baubles.getSlots(); i++) { for (int i = 0; i < baubles.getSlots(); i++) {
ItemStack stack = baubles.getStackInSlot(i); ItemStack stack = baubles.getStackInSlot(i);
@ -56,12 +55,13 @@ public class InternalHooks implements NaturesAuraAPI.IInternalHooks {
return true; return true;
} }
} }
*/
} }
for (int i = 0; i < player.inventory.getSizeInventory(); i++) { for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack stack = player.inventory.getStackInSlot(i); ItemStack stack = player.inventory.getStackInSlot(i);
if (!stack.isEmpty() && stack.hasCapability(NaturesAuraAPI.capAuraContainer, null)) { if (!stack.isEmpty() && stack.getCapability(NaturesAuraAPI.capAuraContainer).isPresent()) {
IAuraContainer container = stack.getCapability(NaturesAuraAPI.capAuraContainer, null); IAuraContainer container = stack.getCapability(NaturesAuraAPI.capAuraContainer).orElse(null);
if (extract) if (extract)
amount -= container.drainAura(amount, simulate); amount -= container.drainAura(amount, simulate);
else else
@ -81,10 +81,10 @@ public class InternalHooks implements NaturesAuraAPI.IInternalHooks {
@Override @Override
public void spawnParticleStream(float startX, float startY, float startZ, float endX, float endY, float endZ, float speed, int color, float scale) { public void spawnParticleStream(float startX, float startY, float startZ, float endX, float endY, float endZ, float speed, int color, float scale) {
Vector3f dir = new Vector3f(endX - startX, endY - startY, endZ - startZ); Vec3d dir = new Vec3d(endX - startX, endY - startY, endZ - startZ);
float length = dir.length(); double length = dir.length();
if (length > 0) { if (length > 0) {
dir.normalise(); dir.normalize();
this.spawnMagicParticle(startX, startY, startZ, this.spawnMagicParticle(startX, startY, startZ,
dir.x * speed, dir.y * speed, dir.z * speed, dir.x * speed, dir.y * speed, dir.z * speed,
color, scale, (int) (length / speed), 0F, false, false); color, scale, (int) (length / speed), 0F, false, false);

View file

@ -8,52 +8,54 @@ import de.ellpeck.naturesaura.api.misc.IWorldData;
import de.ellpeck.naturesaura.blocks.ModBlocks; import de.ellpeck.naturesaura.blocks.ModBlocks;
import de.ellpeck.naturesaura.blocks.multi.Multiblocks; import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
import de.ellpeck.naturesaura.chunk.effect.DrainSpotEffects; import de.ellpeck.naturesaura.chunk.effect.DrainSpotEffects;
import de.ellpeck.naturesaura.commands.CommandAura;
import de.ellpeck.naturesaura.compat.Compat; import de.ellpeck.naturesaura.compat.Compat;
import de.ellpeck.naturesaura.entities.ModEntities; import de.ellpeck.naturesaura.entities.ModEntities;
import de.ellpeck.naturesaura.events.CommonEvents; import de.ellpeck.naturesaura.events.CommonEvents;
import de.ellpeck.naturesaura.gui.GuiHandler; import de.ellpeck.naturesaura.gui.GuiHandler;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.items.OreDict;
import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.potion.ModPotions; import de.ellpeck.naturesaura.potion.ModPotions;
import de.ellpeck.naturesaura.proxy.ClientProxy;
import de.ellpeck.naturesaura.proxy.IProxy; import de.ellpeck.naturesaura.proxy.IProxy;
import de.ellpeck.naturesaura.proxy.ServerProxy;
import de.ellpeck.naturesaura.recipes.ModRecipes; import de.ellpeck.naturesaura.recipes.ModRecipes;
import de.ellpeck.naturesaura.reg.ModRegistry; import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
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 org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import java.util.Locale; import java.util.Locale;
@Mod(modid = NaturesAura.MOD_ID, name = NaturesAura.MOD_NAME, version = NaturesAura.VERSION, dependencies = NaturesAura.DEPS) @Mod(NaturesAura.MOD_ID)
public final class NaturesAura { public final class NaturesAura {
public static final String MOD_ID = NaturesAuraAPI.MOD_ID; public static final String MOD_ID = NaturesAuraAPI.MOD_ID;
public static final String MOD_ID_UPPER = MOD_ID.toUpperCase(Locale.ROOT); public static final String MOD_ID_UPPER = MOD_ID.toUpperCase(Locale.ROOT);
public static final String PROXY_LOCATION = "de.ellpeck." + MOD_ID + ".proxy.";
public static final String MOD_NAME = "Nature's Aura"; public static final String MOD_NAME = "Nature's Aura";
public static final String VERSION = "@VERSION@"; public static final String VERSION = "@VERSION@";
public static final String DEPS = "required-after:patchouli;";
public static final Logger LOGGER = LogManager.getLogger(MOD_NAME); public static final Logger LOGGER = LogManager.getLogger(MOD_NAME);
@Instance(value = MOD_ID)
public static NaturesAura instance; public static NaturesAura instance;
@SidedProxy(modId = MOD_ID, clientSide = PROXY_LOCATION + "ClientProxy", serverSide = PROXY_LOCATION + "ServerProxy") public NaturesAura() {
public static IProxy proxy; instance = this;
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
eventBus.addListener(this::setup);
}
public static IProxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> ServerProxy::new);
public static final ItemGroup CREATIVE_TAB = new ItemGroup(MOD_ID) { public static final ItemGroup CREATIVE_TAB = new ItemGroup(MOD_ID) {
@Override @Override
@ -62,8 +64,17 @@ public final class NaturesAura {
} }
}; };
@EventHandler public static ResourceLocation createRes(String resource) {
public void preInit(FMLPreInitializationEvent event) { return new ResourceLocation(MOD_ID, resource);
}
public void setup(FMLCommonSetupEvent event) {
preInit(event);
init(event);
postInit(event);
}
public void preInit(FMLCommonSetupEvent event) {
NaturesAuraAPI.setInstance(new InternalHooks()); NaturesAuraAPI.setInstance(new InternalHooks());
Helper.registerCap(IAuraContainer.class); Helper.registerCap(IAuraContainer.class);
Helper.registerCap(IAuraRecharge.class); Helper.registerCap(IAuraRecharge.class);
@ -85,31 +96,28 @@ public final class NaturesAura {
proxy.preInit(event); proxy.preInit(event);
} }
@EventHandler public void init(FMLCommonSetupEvent event) {
public void init(FMLInitializationEvent event) {
ModConfig.initOrReload(false); ModConfig.initOrReload(false);
ModRecipes.init(); ModRecipes.init();
ModRegistry.init(event); ModRegistry.init(event);
DrainSpotEffects.init(); DrainSpotEffects.init();
OreDict.init();
new GuiHandler(); new GuiHandler();
proxy.init(event); proxy.init(event);
} }
@EventHandler public void postInit(FMLCommonSetupEvent event) {
public void postInit(FMLPostInitializationEvent event) {
ModRegistry.postInit(event); ModRegistry.postInit(event);
Compat.postInit(); Compat.postInit();
proxy.postInit(event); proxy.postInit(event);
if (ModConfig.enabledFeatures.removeDragonBreathContainerItem) { if (ModConfig.enabledFeatures.removeDragonBreathContainerItem) {
Items.DRAGON_BREATH.setContainerItem(null); // TODO Items.DRAGON_BREATH.setContainerItem(null);
} }
} }
@EventHandler
public void serverStarting(FMLServerStartingEvent event) { public void serverStarting(FMLServerStartingEvent event) {
event.registerServerCommand(new CommandAura()); // TODO event.registerServerCommand(new CommandAura());
} }
} }

View file

@ -1,117 +1,64 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAncientLeaves; import de.ellpeck.naturesaura.blocks.tiles.TileEntityAncientLeaves;
import de.ellpeck.naturesaura.reg.*; import de.ellpeck.naturesaura.reg.*;
import net.minecraft.block.LeavesBlock;
import net.minecraft.block.BlockPlanks;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.LeavesBlock;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
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.registry.GameRegistry;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.Random; import java.util.Random;
public class BlockAncientLeaves extends LeavesBlock implements public class BlockAncientLeaves extends LeavesBlock implements
IModItem, ICreativeItem, IModelProvider, IColorProvidingBlock, IColorProvidingItem, ITileEntityProvider { IModItem, IModelProvider, IColorProvidingBlock, IColorProvidingItem {
public BlockAncientLeaves() { public BlockAncientLeaves() {
this.leavesFancy = true; super(ModBlocks.prop(Material.LEAVES, MaterialColor.PINK));
ModRegistry.add(this); ModRegistry.add(this);
} }
@Override
public MaterialColor getMapColor(BlockState state, IBlockAccess worldIn, BlockPos pos) {
return MaterialColor.PINK;
}
@Override @Override
public String getBaseName() { public String getBaseName() {
return "ancient_leaves"; return "ancient_leaves";
} }
public void onInit(FMLCommonSetupEvent event) {
//GameRegistry.registerTileEntity(TileEntityAncientLeaves.class, new ResourceLocation(NaturesAura.MOD_ID, "ancient_leaves"));
}
/* Appears to be handled already somewhere by super
@Override @Override
public void onPreInit(FMLPreInitializationEvent event) { public void beginLeaveDecay(BlockState state, IWorldReader world, BlockPos pos) {
if (!state.get(DISTANCE).intValue() && state.getValue(DECAYABLE)) {
} world.getChunk(pos).setBlockState(pos, state.with(CHECK_DECAY, true), false);
@Override
public void onInit(FMLInitializationEvent event) {
GameRegistry.registerTileEntity(TileEntityAncientLeaves.class, new ResourceLocation(NaturesAura.MOD_ID, "ancient_leaves"));
}
@Override
public void onPostInit(FMLPostInitializationEvent event) {
}
@Override
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) {
return Collections.singletonList(new ItemStack(this, 1, 0));
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, CHECK_DECAY, DECAYABLE);
}
@Override
public BlockState getStateFromMeta(int meta) {
boolean check = (meta & 1) != 0;
boolean decay = (meta & 2) != 0;
return this.getDefaultState().withProperty(CHECK_DECAY, check).withProperty(DECAYABLE, decay);
}
@Override
public int getMetaFromState(BlockState state) {
boolean check = state.getValue(CHECK_DECAY);
boolean decay = state.getValue(DECAYABLE);
return (check ? 1 : 0) | (decay ? 1 : 0) << 1;
}
@Override
public void beginLeavesDecay(BlockState state, World world, BlockPos pos) {
if (!state.getValue(CHECK_DECAY) && state.getValue(DECAYABLE)) {
world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4);
} }
} }
*/
/* // Appears to auto remove TE during setting of the state by the world
@Override @Override
public void breakBlock(World worldIn, BlockPos pos, BlockState state) { public void breakBlock(World worldIn, BlockPos pos, BlockState state) {
super.breakBlock(worldIn, pos, state); super.breakBlock(worldIn, pos, state);
worldIn.removeTileEntity(pos); worldIn.removeTileEntity(pos);
} }
*/
@Override
public BlockPlanks.EnumType getWoodType(int meta) {
return null;
}
@Nullable @Nullable
@Override @Override
public TileEntity createNewTileEntity(World worldIn, int meta) { public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return (meta & 2) != 0 ? new TileEntityAncientLeaves() : null; return new TileEntityAncientLeaves();
} }
@Override @Override
@ -128,9 +75,9 @@ public class BlockAncientLeaves extends LeavesBlock implements
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { public void animateTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
super.randomDisplayTick(stateIn, worldIn, pos, rand); super.animateTick(stateIn, worldIn, pos, rand);
if (rand.nextFloat() >= 0.95F && !worldIn.getBlockState(pos.down()).isFullBlock()) { if (rand.nextFloat() >= 0.95F && !worldIn.getBlockState(pos.down()).isOpaqueCube(worldIn, pos)) {
TileEntity tile = worldIn.getTileEntity(pos); TileEntity tile = worldIn.getTileEntity(pos);
if (tile instanceof TileEntityAncientLeaves) { if (tile instanceof TileEntityAncientLeaves) {
if (((TileEntityAncientLeaves) tile).getAuraContainer(null).getStoredAura() > 0) { if (((TileEntityAncientLeaves) tile).getAuraContainer(null).getStoredAura() > 0) {
@ -147,13 +94,8 @@ public class BlockAncientLeaves extends LeavesBlock implements
} }
@Override @Override
public Item getItemDropped(BlockState state, Random rand, int fortune) { public void tick(BlockState state, World worldIn, BlockPos pos, Random random) {
return Item.getItemFromBlock(ModBlocks.ANCIENT_SAPLING); super.tick(state, worldIn, pos, random);
}
@Override
public void updateTick(World worldIn, BlockPos pos, BlockState state, Random rand) {
super.updateTick(worldIn, pos, state, rand);
if (!worldIn.isRemote) { if (!worldIn.isRemote) {
TileEntity tile = worldIn.getTileEntity(pos); TileEntity tile = worldIn.getTileEntity(pos);
if (tile instanceof TileEntityAncientLeaves) { if (tile instanceof TileEntityAncientLeaves) {

View file

@ -1,21 +1,18 @@
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;
import net.minecraft.block.LogBlock; import net.minecraft.block.LogBlock;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.material.Material;
import net.minecraft.block.BlockState; import net.minecraft.block.material.MaterialColor;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
public class BlockAncientLog extends LogBlock implements IModItem, ICreativeItem, IModelProvider { public class BlockAncientLog extends LogBlock implements IModItem, IModelProvider {
private final String baseName; private final String baseName;
public BlockAncientLog(String baseName) { public BlockAncientLog(String baseName) {
super(MaterialColor.PURPLE, ModBlocks.prop(Material.WOOD));
this.baseName = baseName; this.baseName = baseName;
ModRegistry.add(this); ModRegistry.add(this);
} }
@ -24,34 +21,4 @@ public class BlockAncientLog extends LogBlock implements IModItem, ICreativeItem
public String getBaseName() { public String getBaseName() {
return this.baseName; return this.baseName;
} }
@Override
public void onPreInit(FMLPreInitializationEvent event) {
}
@Override
public void onInit(FMLInitializationEvent event) {
}
@Override
public void onPostInit(FMLPostInitializationEvent event) {
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, LOG_AXIS);
}
@Override
public int getMetaFromState(BlockState state) {
return state.getValue(LOG_AXIS).ordinal();
}
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(LOG_AXIS, EnumAxis.values()[meta]);
}
} }

View file

@ -1,16 +1,12 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
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;
import net.minecraft.block.BushBlock; import net.minecraft.block.*;
import net.minecraft.block.SaplingBlock; import net.minecraft.block.material.Material;
import net.minecraft.block.IGrowable;
import net.minecraft.block.SoundType;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.BlockState;
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,16 +18,15 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import java.util.Random; import java.util.Random;
public class BlockAncientSapling extends BushBlock implements IGrowable, IModItem, ICreativeItem, IModelProvider { // Make this extend SaplingBlock?
public class BlockAncientSapling extends BushBlock implements IGrowable, IModItem, 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,
0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D); 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D);
public BlockAncientSapling() { public BlockAncientSapling() {
this.setHardness(0.0F); super(ModBlocks.prop(Material.PLANTS).hardnessAndResistance(0.0F).sound(SoundType.PLANT));
this.setSoundType(SoundType.PLANT);
ModRegistry.add(this); ModRegistry.add(this);
} }
@ -56,21 +51,6 @@ public class BlockAncientSapling extends BushBlock implements IGrowable, IModIte
return "ancient_sapling"; return "ancient_sapling";
} }
@Override
public void onPreInit(FMLPreInitializationEvent event) {
}
@Override
public void onInit(FMLInitializationEvent event) {
}
@Override
public void onPostInit(FMLPostInitializationEvent event) {
}
@Override @Override
public BlockState getStateFromMeta(int meta) { public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(SaplingBlock.STAGE, meta); return this.getDefaultState().withProperty(SaplingBlock.STAGE, meta);

View file

@ -4,33 +4,29 @@ import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.api.render.IVisualizable;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAnimalGenerator; import de.ellpeck.naturesaura.blocks.tiles.TileEntityAnimalGenerator;
import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.INPC; import net.minecraft.entity.INPC;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.monster.IMob; import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.IAnimal; import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
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.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.event.entity.living.LivingExperienceDropEvent; import net.minecraftforge.event.entity.living.LivingExperienceDropEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockAnimalGenerator extends BlockContainerImpl implements IVisualizable { public class BlockAnimalGenerator extends BlockContainerImpl implements IVisualizable {
public BlockAnimalGenerator() { public BlockAnimalGenerator() {
super(Material.ROCK, "animal_generator", TileEntityAnimalGenerator.class, "animal_generator"); super("animal_generator", TileEntityAnimalGenerator.class, "animal_generator", ModBlocks.prop(Material.ROCK).hardnessAndResistance(3F).sound(SoundType.STONE));
this.setSoundType(SoundType.STONE);
this.setHardness(3F);
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
} }
@ -38,17 +34,17 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali
@SubscribeEvent @SubscribeEvent
public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) { public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) {
LivingEntity entity = event.getEntityLiving(); LivingEntity entity = event.getEntityLiving();
if (entity.world.isRemote || !(entity instanceof IAnimal) || entity instanceof IMob || entity instanceof INPC) if (entity.world.isRemote || !(entity instanceof AnimalEntity) || entity instanceof IMob || entity instanceof INPC)
return; return;
CompoundNBT data = entity.getEntityData(); CompoundNBT data = entity.getPersistentData();
int timeAlive = data.getInteger(NaturesAura.MOD_ID + ":time_alive"); int timeAlive = data.getInt(NaturesAura.MOD_ID + ":time_alive");
data.setInteger(NaturesAura.MOD_ID + ":time_alive", timeAlive + 1); data.putInt(NaturesAura.MOD_ID + ":time_alive", timeAlive + 1);
} }
@SubscribeEvent @SubscribeEvent
public void onEntityDeath(LivingDeathEvent event) { public void onEntityDeath(LivingDeathEvent event) {
LivingEntity entity = event.getEntityLiving(); LivingEntity entity = event.getEntityLiving();
if (entity.world.isRemote || !(entity instanceof IAnimal) || entity instanceof IMob || entity instanceof INPC) if (entity.world.isRemote || !(entity instanceof AnimalEntity) || entity instanceof IMob || entity instanceof INPC)
return; return;
BlockPos pos = entity.getPosition(); BlockPos pos = entity.getPosition();
Helper.getTileEntitiesInArea(entity.world, pos, 5, tile -> { Helper.getTileEntitiesInArea(entity.world, pos, 5, tile -> {
@ -56,8 +52,8 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali
return false; return false;
TileEntityAnimalGenerator gen = (TileEntityAnimalGenerator) tile; TileEntityAnimalGenerator gen = (TileEntityAnimalGenerator) tile;
CompoundNBT data = entity.getEntityData(); CompoundNBT data = entity.getPersistentData();
data.setBoolean(NaturesAura.MOD_ID + ":no_drops", true); data.putBoolean(NaturesAura.MOD_ID + ":no_drops", true);
if (gen.isBusy()) if (gen.isBusy())
return false; return false;
@ -66,7 +62,7 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali
float timeMod = child ? 0.5F : 1; float timeMod = child ? 0.5F : 1;
float amountMod = child ? 0.667F : 1; float amountMod = child ? 0.667F : 1;
int timeAlive = data.getInteger(NaturesAura.MOD_ID + ":time_alive"); int timeAlive = data.getInt(NaturesAura.MOD_ID + ":time_alive");
int time = Math.min(MathHelper.floor((timeAlive - 15000) / 500F * timeMod), 200); int time = Math.min(MathHelper.floor((timeAlive - 15000) / 500F * timeMod), 200);
int amount = Math.min(MathHelper.floor((timeAlive - 8000) / 2F * amountMod), 25000); int amount = Math.min(MathHelper.floor((timeAlive - 8000) / 2F * amountMod), 25000);
if (time <= 0 || amount <= 0) if (time <= 0 || amount <= 0)
@ -74,11 +70,14 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali
gen.setGenerationValues(time, amount); gen.setGenerationValues(time, amount);
BlockPos genPos = gen.getPos(); BlockPos genPos = gen.getPos();
/* TODO
PacketHandler.sendToAllAround(entity.world, pos, 32, new PacketParticles( PacketHandler.sendToAllAround(entity.world, pos, 32, new PacketParticles(
(float) entity.posX, (float) entity.posY, (float) entity.posZ, 17, (float) entity.posX, (float) entity.posY, (float) entity.posZ, 17,
child ? 1 : 0, child ? 1 : 0,
(int) (entity.getEyeHeight() * 10F), (int) (entity.getEyeHeight() * 10F),
genPos.getX(), genPos.getY(), genPos.getZ())); genPos.getX(), genPos.getY(), genPos.getZ()));
*/
return true; return true;
}); });
} }
@ -86,14 +85,14 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali
@SubscribeEvent @SubscribeEvent
public void onEntityDrops(LivingDropsEvent event) { public void onEntityDrops(LivingDropsEvent event) {
LivingEntity entity = event.getEntityLiving(); LivingEntity entity = event.getEntityLiving();
if (entity.getEntityData().getBoolean(NaturesAura.MOD_ID + ":no_drops")) if (entity.getPersistentData().getBoolean(NaturesAura.MOD_ID + ":no_drops"))
event.setCanceled(true); event.setCanceled(true);
} }
@SubscribeEvent @SubscribeEvent
public void onEntityExp(LivingExperienceDropEvent event) { public void onEntityExp(LivingExperienceDropEvent event) {
LivingEntity entity = event.getEntityLiving(); LivingEntity entity = event.getEntityLiving();
if (entity.getEntityData().getBoolean(NaturesAura.MOD_ID + ":no_drops")) if (entity.getPersistentData().getBoolean(NaturesAura.MOD_ID + ":no_drops"))
event.setCanceled(true); event.setCanceled(true);
} }

View file

@ -6,8 +6,6 @@ import net.minecraft.block.material.Material;
public class BlockAnimalSpawner extends BlockContainerImpl { public class BlockAnimalSpawner extends BlockContainerImpl {
public BlockAnimalSpawner() { public BlockAnimalSpawner() {
super(Material.ROCK, "animal_spawner", TileEntityAnimalSpawner.class, "animal_spawner"); super("animal_spawner", TileEntityAnimalSpawner.class, "animal_spawner", ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE));
this.setHardness(2F);
this.setSoundType(SoundType.STONE);
} }
} }

View file

@ -11,9 +11,7 @@ import net.minecraft.world.World;
public class BlockAuraDetector extends BlockContainerImpl { public class BlockAuraDetector extends BlockContainerImpl {
public BlockAuraDetector() { public BlockAuraDetector() {
super(Material.ROCK, "aura_detector", TileEntityAuraDetector.class, "aura_detector"); super("aura_detector", TileEntityAuraDetector.class, "aura_detector", ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE));
this.setSoundType(SoundType.STONE);
this.setHardness(2F);
} }
@Override @Override

View file

@ -1,43 +1,29 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAutoCrafter; import de.ellpeck.naturesaura.blocks.tiles.TileEntityAutoCrafter;
import net.minecraft.block.HorizontalBlock; import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyDirection; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.state.DirectionProperty;
import net.minecraft.block.BlockState; import net.minecraft.state.StateContainer;
import net.minecraft.entity.LivingEntity; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockAutoCrafter extends BlockContainerImpl { public class BlockAutoCrafter extends BlockContainerImpl {
public static final PropertyDirection FACING = HorizontalBlock.FACING; public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public BlockAutoCrafter() { public BlockAutoCrafter() {
super(Material.WOOD, "auto_crafter", TileEntityAutoCrafter.class, "auto_crafter"); super("auto_crafter", TileEntityAutoCrafter.class, "auto_crafter", ModBlocks.prop(Material.WOOD).hardnessAndResistance(1.5F).sound(SoundType.WOOD));
this.setSoundType(SoundType.WOOD);
this.setHardness(1.5F);
} }
@Override @Override
protected BlockStateContainer createBlockState() { protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
return new BlockStateContainer(this, FACING); builder.add(FACING);
} }
@Override @Override
public int getMetaFromState(BlockState state) { public BlockState getStateForPlacement(BlockItemUseContext context) {
return state.getValue(FACING).getHorizontalIndex(); return this.getDefaultState().with(FACING, context.getPlayer().getHorizontalFacing());
}
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(FACING, Direction.byHorizontalIndex(meta));
}
@Override
public BlockState getStateForPlacement(World worldIn, BlockPos pos, Direction facing, float hitX, float hitY, float hitZ, int meta, LivingEntity placer) {
return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing());
} }
} }

View file

@ -4,17 +4,24 @@ import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.api.render.IVisualizable;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityChunkLoader; import de.ellpeck.naturesaura.blocks.tiles.TileEntityChunkLoader;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
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.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IEnviromentBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket; import net.minecraftforge.common.ForgeChunkManager.Ticket;
@ -27,19 +34,19 @@ import java.util.Random;
public class BlockChunkLoader extends BlockContainerImpl implements IVisualizable { public class BlockChunkLoader extends BlockContainerImpl implements IVisualizable {
private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(4 / 16F, 4 / 16F, 4 / 16F, 12 / 16F, 12 / 16F, 12 / 16F); private static final VoxelShape SHAPE = makeCuboidShape(4, 4, 4, 12, 12, 12);
public BlockChunkLoader() { public BlockChunkLoader() {
super(Material.ROCK, "chunk_loader", TileEntityChunkLoader.class, "chunk_loader"); super("chunk_loader", TileEntityChunkLoader.class, "chunk_loader", ModBlocks.prop(Material.ROCK).hardnessAndResistance(3F).sound(SoundType.STONE));
this.setSoundType(SoundType.STONE);
this.setHardness(3F);
} }
/* TODO Chunk Loading
@Override @Override
public void onInit(FMLInitializationEvent event) { public void onInit(FMLInitializationEvent event) {
super.onInit(event); super.onInit(event);
ForgeChunkManager.setForcedChunkLoadingCallback(NaturesAura.instance, new ChunkLoadingCallback()); ForgeChunkManager.setForcedChunkLoadingCallback(NaturesAura.instance, new ChunkLoadingCallback());
} }
*/
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@ -62,7 +69,7 @@ public class BlockChunkLoader extends BlockContainerImpl implements IVisualizabl
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { public void animateTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
TileEntity tile = worldIn.getTileEntity(pos); TileEntity tile = worldIn.getTileEntity(pos);
if (tile instanceof TileEntityChunkLoader) { if (tile instanceof TileEntityChunkLoader) {
int range = ((TileEntityChunkLoader) tile).range(); int range = ((TileEntityChunkLoader) tile).range();
@ -81,28 +88,8 @@ public class BlockChunkLoader extends BlockContainerImpl implements IVisualizabl
} }
@Override @Override
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return BOUND_BOX; return SHAPE;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean isOpaqueCube(BlockState state) {
return false;
}
@Override
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
return false;
}
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
return BlockFaceShape.UNDEFINED;
} }
public static class ChunkLoadingCallback implements ForgeChunkManager.LoadingCallback { public static class ChunkLoadingCallback implements ForgeChunkManager.LoadingCallback {

View file

@ -2,41 +2,38 @@ 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;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.ContainerBlock; import net.minecraft.block.BlockRenderType;
import net.minecraft.block.material.Material;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.ContainerBlock;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.block.BlockRenderType;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
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.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Random; import java.util.Random;
public class BlockContainerImpl extends ContainerBlock implements IModItem, ICreativeItem, IModelProvider { public class BlockContainerImpl extends ContainerBlock implements IModItem, IModelProvider {
private final String baseName; private final String baseName;
private final Class<? extends TileEntity> tileClass; private final Class<? extends TileEntity> tileClass;
private final String tileRegName; private final String tileRegName;
public BlockContainerImpl(Material material, String baseName, Class<? extends TileEntity> tileClass, String tileReg) { public BlockContainerImpl(String baseName, Class<? extends TileEntity> tileClass, String tileReg, Block.Properties properties) {
super(material); super(properties);
this.baseName = baseName; this.baseName = baseName;
this.tileClass = tileClass; this.tileClass = tileClass;
@ -47,7 +44,8 @@ public class BlockContainerImpl extends ContainerBlock implements IModItem, ICre
@Nullable @Nullable
@Override @Override
public TileEntity createNewTileEntity(World world, int meta) { public TileEntity createNewTileEntity(IBlockReader world) {
// TODO TYPES BLUTRGHGHGH
try { try {
return this.tileClass.newInstance(); return this.tileClass.newInstance();
} catch (Exception e) { } catch (Exception e) {
@ -60,20 +58,10 @@ public class BlockContainerImpl extends ContainerBlock implements IModItem, ICre
return this.baseName; return this.baseName;
} }
@Override
public void onPreInit(FMLPreInitializationEvent event) {
}
@Override
public void onInit(FMLInitializationEvent event) { public void onInit(FMLInitializationEvent event) {
GameRegistry.registerTileEntity(this.tileClass, new ResourceLocation(NaturesAura.MOD_ID, this.tileRegName)); GameRegistry.registerTileEntity(this.tileClass, new ResourceLocation(NaturesAura.MOD_ID, this.tileRegName));
} }
@Override
public void onPostInit(FMLPostInitializationEvent event) {
}
@Override @Override
public BlockRenderType getRenderType(BlockState state) { public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL; return BlockRenderType.MODEL;

View file

@ -1,10 +1,9 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.BlockState;
import net.minecraft.item.Items;
import net.minecraft.item.Item;
import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -16,16 +15,7 @@ import java.util.Random;
public class BlockDecayedLeaves extends BlockImpl { public class BlockDecayedLeaves extends BlockImpl {
public BlockDecayedLeaves() { public BlockDecayedLeaves() {
super("decayed_leaves", Material.LEAVES); super("decayed_leaves", ModBlocks.prop(Material.LEAVES).hardnessAndResistance(0.2F).sound(SoundType.PLANT).variableOpacity().tickRandomly());
this.setTickRandomly(true);
this.setHardness(0.2F);
this.setLightOpacity(1);
this.setSoundType(SoundType.PLANT);
}
@Override
public boolean isOpaqueCube(BlockState state) {
return false;
} }
@Override @Override
@ -35,14 +25,9 @@ public class BlockDecayedLeaves extends BlockImpl {
} }
@Override @Override
public void updateTick(World worldIn, BlockPos pos, BlockState state, Random random) { public void tick(BlockState state, World world, BlockPos pos, Random random) {
if (!worldIn.isRemote) { if (!world.isRemote) {
worldIn.setBlockToAir(pos); world.setBlockState(pos, Blocks.AIR.getDefaultState());
} }
} }
@Override
public Item getItemDropped(BlockState state, Random rand, int fortune) {
return Items.AIR;
}
} }

View file

@ -2,52 +2,47 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.packet.PacketClient;
import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
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.AbstractRailBlock; import net.minecraft.block.AbstractRailBlock;
import net.minecraft.block.SoundType; import net.minecraft.block.Block;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.item.minecart.AbstractMinecartEntity; import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.SoundEvents;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.util.Direction; import net.minecraft.state.EnumProperty;
import net.minecraft.state.IProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.state.properties.RailShape;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
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.dimension.DimensionType; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.ServerWorld; import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraft.world.gen.Heightmap;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
public class BlockDimensionRail extends AbstractRailBlock implements IModItem, ICreativeItem, IModelProvider { public class BlockDimensionRail extends AbstractRailBlock implements IModItem, IModelProvider {
public static final PropertyEnum<EnumRailDirection> SHAPE = PropertyEnum.create("shape", EnumRailDirection.class, EnumRailDirection.NORTH_SOUTH, EnumRailDirection.EAST_WEST); public static final EnumProperty<RailShape> SHAPE = BlockStateProperties.RAIL_SHAPE;
private final String name; private final String name;
private final int goalDim; private final int goalDim;
private final DimensionType[] canUseDims; private final DimensionType[] canUseDims;
public BlockDimensionRail(String name, DimensionType goalDim, DimensionType... canUseDims) { public BlockDimensionRail(String name, DimensionType goalDim, DimensionType... canUseDims) {
super(false); super(false, ModBlocks.prop(Blocks.RAIL));
this.name = name; this.name = name;
this.goalDim = goalDim.getId(); this.goalDim = goalDim.getId();
this.canUseDims = canUseDims; this.canUseDims = canUseDims;
this.setHardness(0.8F);
this.setSoundType(SoundType.METAL);
ModRegistry.add(this); ModRegistry.add(this);
} }
@ -60,13 +55,12 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem, I
} }
@Override @Override
public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
ItemStack stack = playerIn.getHeldItem(hand); ItemStack stack = player.getHeldItem(hand);
if (stack.getItem() == ModItems.RANGE_VISUALIZER) { if (stack.getItem() == ModItems.RANGE_VISUALIZER) {
if (!worldIn.isRemote) { if (!worldIn.isRemote) {
BlockPos goalPos = this.getGoalCoords(worldIn, pos); BlockPos goalPos = this.getGoalCoords(worldIn, pos);
PacketHandler.sendTo(playerIn, // TODO PacketHandler.sendTo(player, new PacketClient(0, this.goalDim, goalPos.getX(), goalPos.getY(), goalPos.getZ()));
new PacketClient(0, this.goalDim, goalPos.getX(), goalPos.getY(), goalPos.getZ()));
} }
return true; return true;
} }
@ -74,96 +68,73 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem, I
} }
@Override @Override
public void onMinecartPass(World world, AbstractMinecartEntity cart, BlockPos pos) { public void onMinecartPass(BlockState state, World world, BlockPos pos, AbstractMinecartEntity cart) {
if (world.isRemote) if (world.isRemote)
return; return;
if (cart.isBeingRidden()) if (cart.isBeingRidden())
return; return;
if (!this.canUseHere(world.provider.getDimensionType())) if (!this.canUseHere(world.getDimension().getType()))
return; return;
AxisAlignedBB box = cart.getEntityBoundingBox(); AxisAlignedBB box = cart.getCollisionBoundingBox();
PacketHandler.sendToAllAround(world, pos, 32, // TODO PacketHandler.sendToAllAround(world, pos, 32, new PacketParticles((float) box.minX, (float) box.minY, (float) box.minZ, 25, (int) ((box.maxX - box.minX) * 100F), (int) ((box.maxY - box.minY) * 100F), (int) ((box.maxZ - box.minZ) * 100F)));
new PacketParticles((float) box.minX, (float) box.minY, (float) box.minZ, 25, world.playSound(null, pos, SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.BLOCKS, 1F, 1F);
(int) ((box.maxX - box.minX) * 100F), (int) ((box.maxY - box.minY) * 100F), (int) ((box.maxZ - box.minZ) * 100F)));
world.playSound(null, pos, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.BLOCKS, 1F, 1F);
BlockPos goalCoords = this.getGoalCoords(world, pos); BlockPos goalCoords = this.getGoalCoords(world, pos);
cart.changeDimension(this.goalDim, (newWorld, entity, yaw) ->
entity.moveToBlockPosAndAngles(goalCoords, yaw, entity.rotationPitch)); cart.changeDimension(DimensionType.getById(this.goalDim));
// (newWorld, entity, yaw) -> entity.moveToBlockPosAndAngles(goalCoords, yaw, entity.rotationPitch)
BlockPos spot = IAuraChunk.getHighestSpot(world, pos, 35, pos); BlockPos spot = IAuraChunk.getHighestSpot(world, pos, 35, pos);
IAuraChunk.getAuraChunk(world, spot).drainAura(spot, 50000); IAuraChunk.getAuraChunk(world, spot).drainAura(spot, 50000);
} }
private BlockPos getGoalCoords(World world, BlockPos pos) { private BlockPos getGoalCoords(World world, BlockPos pos) {
MinecraftServer server = world.getMinecraftServer(); MinecraftServer server = world.getServer();
DimensionType goalDimType = DimensionType.getById(this.goalDim);
if (this == ModBlocks.DIMENSION_RAIL_NETHER) { if (this == ModBlocks.DIMENSION_RAIL_NETHER) {
// travel to the nether from the overworld // travel to the nether from the overworld
return new BlockPos(pos.getX() / 8, pos.getY() / 2, pos.getZ() / 8); return new BlockPos(pos.getX() / 8, pos.getY() / 2, pos.getZ() / 8);
} else if (this == ModBlocks.DIMENSION_RAIL_END) { } else if (this == ModBlocks.DIMENSION_RAIL_END) {
// travel to the end from the overworld // travel to the end from the overworld
ServerWorld end = server.getWorld(this.goalDim); ServerWorld end = server.getWorld(goalDimType);
return end.getSpawnCoordinate().up(8); return end.getSpawnCoordinate().up(8);
} else { } else {
if (world.provider.getDimensionType() == DimensionType.NETHER) { if (world.getDimension().getType() == DimensionType.THE_NETHER) {
// travel to the overworld from the nether // travel to the overworld from the nether
return new BlockPos(pos.getX() * 8, pos.getY() * 2, pos.getZ() * 8); return new BlockPos(pos.getX() * 8, pos.getY() * 2, pos.getZ() * 8);
} else { } else {
// travel to the overworld from the end // travel to the overworld from the end
World overworld = server.getWorld(this.goalDim); World overworld = server.getWorld(goalDimType);
return overworld.getTopSolidOrLiquidBlock(overworld.getSpawnPoint()); BlockPos spawn = overworld.getSpawnPoint();
BlockPos ret = new BlockPos(spawn.getX(), 0, spawn.getZ());
return ret.up(overworld.getHeight(Heightmap.Type.WORLD_SURFACE_WG, spawn.getX(), spawn.getZ()));
} }
} }
} }
@Override @Override
public IProperty<EnumRailDirection> getShapeProperty() { public IProperty<RailShape> getShapeProperty() {
return SHAPE; return SHAPE;
} }
@Override
public boolean isFlexibleRail(IBlockAccess world, BlockPos pos) { public boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos) {
return false; return false;
} }
@Override @Override
public boolean canMakeSlopes(IBlockAccess world, BlockPos pos) { public boolean canMakeSlopes(BlockState state, IBlockReader world, BlockPos pos) {
return false; return false;
} }
@Override @Override
protected BlockStateContainer createBlockState() { protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
return new BlockStateContainer(this, SHAPE); builder.add(SHAPE);
}
@Override
public int getMetaFromState(BlockState state) {
return state.getValue(SHAPE).getMetadata();
}
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(SHAPE, EnumRailDirection.byMetadata(meta));
} }
@Override @Override
public String getBaseName() { public String getBaseName() {
return "dimension_rail_" + this.name; return "dimension_rail_" + this.name;
} }
@Override
public void onPreInit(FMLPreInitializationEvent event) {
}
@Override
public void onInit(FMLInitializationEvent event) {
}
@Override
public void onPostInit(FMLPostInitializationEvent event) {
}
} }

View file

@ -1,41 +1,36 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityEndFlower; import de.ellpeck.naturesaura.blocks.tiles.TileEntityEndFlower;
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.BushBlock;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.SoundType;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.BushBlock;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.boss.dragon.EnderDragonEntity; import net.minecraft.entity.boss.dragon.EnderDragonEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.block.Blocks; import net.minecraft.fluid.IFluidState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList; import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.Heightmap;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class BlockEndFlower extends BushBlock implements IModItem, ICreativeItem, IModelProvider, ITileEntityProvider { public class BlockEndFlower extends BushBlock implements IModItem, IModelProvider {
public BlockEndFlower() { public BlockEndFlower() {
this.setHardness(0.5F); super(ModBlocks.prop(Material.PLANTS).hardnessAndResistance(0.5F).sound(SoundType.PLANT));
this.setSoundType(SoundType.PLANT);
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
ModRegistry.add(this); ModRegistry.add(this);
@ -43,7 +38,7 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICreativeItem
} }
@SubscribeEvent @SubscribeEvent
public void onDraonTick(LivingUpdateEvent event) { public void onDragonTick(LivingUpdateEvent event) {
LivingEntity living = event.getEntityLiving(); LivingEntity living = event.getEntityLiving();
if (living.world.isRemote || !(living instanceof EnderDragonEntity)) if (living.world.isRemote || !(living instanceof EnderDragonEntity))
return; return;
@ -54,7 +49,7 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICreativeItem
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
int x = dragon.world.rand.nextInt(256) - 128; int x = dragon.world.rand.nextInt(256) - 128;
int z = dragon.world.rand.nextInt(256) - 128; int z = dragon.world.rand.nextInt(256) - 128;
BlockPos pos = new BlockPos(x, dragon.world.getHeight(x, z), z); BlockPos pos = new BlockPos(x, dragon.world.getHeight(Heightmap.Type.WORLD_SURFACE_WG, x, z), z);
if (!dragon.world.isBlockLoaded(pos)) if (!dragon.world.isBlockLoaded(pos))
continue; continue;
if (dragon.world.getBlockState(pos.down()).getBlock() != Blocks.END_STONE) if (dragon.world.getBlockState(pos.down()).getBlock() != Blocks.END_STONE)
@ -64,69 +59,36 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICreativeItem
} }
@Override @Override
protected boolean canSustainBush(BlockState state) { public boolean canSustainPlant(BlockState state, IBlockReader world, BlockPos pos, Direction facing, IPlantable plantable) {
return state.getBlock() == Blocks.END_STONE; return state.getBlock() == Blocks.END_STONE;
} }
@Override
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
return this.canSustainBush(worldIn.getBlockState(pos.down()));
}
@Override
public boolean canBlockStay(World worldIn, BlockPos pos, BlockState state) {
return this.canSustainBush(worldIn.getBlockState(pos.down()));
}
@Override @Override
public String getBaseName() { public String getBaseName() {
return "end_flower"; return "end_flower";
} }
@Override /*
public void onPreInit(FMLPreInitializationEvent event) {
}
@Override @Override
public void onInit(FMLInitializationEvent event) { public void onInit(FMLInitializationEvent event) {
GameRegistry.registerTileEntity(TileEntityEndFlower.class, new ResourceLocation(NaturesAura.MOD_ID, "end_flower")); GameRegistry.registerTileEntity(TileEntityEndFlower.class, new ResourceLocation(NaturesAura.MOD_ID, "end_flower"));
} }
*/
@Override
public void onPostInit(FMLPostInitializationEvent event) {
}
@Nullable @Nullable
@Override @Override
public TileEntity createNewTileEntity(World worldIn, int meta) { public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new TileEntityEndFlower(); return new TileEntityEndFlower();
} }
@Override @Override
public void breakBlock(World worldIn, BlockPos pos, BlockState state) { public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, IFluidState fluid) {
super.breakBlock(worldIn, pos, state); return willHarvest || super.removedByPlayer(state, world, pos, player, false, fluid);
worldIn.removeTileEntity(pos);
}
@Override
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityEndFlower && ((TileEntityEndFlower) tile).isDrainMode)
return;
super.getDrops(drops, world, pos, state, fortune);
}
@Override
public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest) {
return willHarvest || super.removedByPlayer(state, world, pos, player, false);
} }
@Override @Override
public void harvestBlock(World worldIn, PlayerEntity player, BlockPos pos, BlockState state, @Nullable TileEntity te, ItemStack stack) { public void harvestBlock(World worldIn, PlayerEntity player, BlockPos pos, BlockState state, @Nullable TileEntity te, ItemStack stack) {
super.harvestBlock(worldIn, player, pos, state, te, stack); super.harvestBlock(worldIn, player, pos, state, te, stack);
worldIn.setBlockToAir(pos); worldIn.setBlockState(pos, Blocks.AIR.getDefaultState());
} }
} }

View file

@ -7,31 +7,33 @@ import de.ellpeck.naturesaura.blocks.tiles.render.RenderEnderCrate;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.reg.ITESRProvider; import de.ellpeck.naturesaura.reg.ITESRProvider;
import net.minecraft.block.AnvilBlock; import net.minecraft.block.AnvilBlock;
import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.item.Items;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Tuple; import net.minecraft.util.Tuple;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.AnvilUpdateEvent; import net.minecraftforge.event.AnvilUpdateEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
@ -44,29 +46,25 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
private static final ThreadLocal<WeakReference<World>> CACHED_WORLD = new ThreadLocal<>(); private static final ThreadLocal<WeakReference<World>> CACHED_WORLD = new ThreadLocal<>();
public BlockEnderCrate() { public BlockEnderCrate() {
super(Material.ROCK, "ender_crate", TileEntityEnderCrate.class, "ender_crate"); super("ender_crate", TileEntityEnderCrate.class, "ender_crate", ModBlocks.prop(Material.ROCK).hardnessAndResistance(5F).lightValue(7).sound(SoundType.STONE));
this.setSoundType(SoundType.STONE);
this.setHardness(5F);
this.setLightLevel(0.75F);
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
} }
public static String getEnderName(ItemStack stack) { public static String getEnderName(ItemStack stack) {
if (!stack.hasTagCompound()) if (!stack.hasTag())
return ""; return "";
CompoundNBT compound = stack.getTagCompound(); return stack.getTag().getString(NaturesAura.MOD_ID + ":ender_name");
return compound.getString(NaturesAura.MOD_ID + ":ender_name");
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void addEnderNameInfo(ItemStack stack, List<String> tooltip) { public static void addEnderNameInfo(ItemStack stack, List<ITextComponent> tooltip) {
String name = getEnderName(stack); String name = getEnderName(stack);
if (name != null && !name.isEmpty()) if (name != null && !name.isEmpty())
tooltip.add(TextFormatting.DARK_PURPLE + I18n.format("info." + NaturesAura.MOD_ID + ".ender_name", tooltip.add(new StringTextComponent(TextFormatting.DARK_PURPLE + I18n.format("info." + NaturesAura.MOD_ID + ".ender_name",
TextFormatting.ITALIC + name + TextFormatting.RESET)); TextFormatting.ITALIC + name + TextFormatting.RESET)));
else else
tooltip.add(TextFormatting.DARK_PURPLE + I18n.format("info." + NaturesAura.MOD_ID + ".ender_name.missing")); tooltip.add(new StringTextComponent(TextFormatting.DARK_PURPLE + I18n.format("info." + NaturesAura.MOD_ID + ".ender_name.missing")));
} }
@SubscribeEvent @SubscribeEvent
@ -96,23 +94,21 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
if (IWorldData.getOverworldData(world.get()).isEnderStorageLocked(name)) if (IWorldData.getOverworldData(world.get()).isEnderStorageLocked(name))
return; return;
ItemStack output = stack.copy(); ItemStack output = stack.copy();
if (!output.hasTagCompound()) output.getOrCreateTag().putString(NaturesAura.MOD_ID + ":ender_name", name);
output.setTagCompound(new CompoundNBT());
output.getTagCompound().setString(NaturesAura.MOD_ID + ":ender_name", name);
event.setOutput(output); event.setOutput(output);
event.setMaterialCost(stack.getCount()); event.setMaterialCost(stack.getCount());
event.setCost(1); event.setCost(1);
} }
@Override @Override
public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!worldIn.isRemote) { if (!worldIn.isRemote) {
TileEntity tile = worldIn.getTileEntity(pos); TileEntity tile = worldIn.getTileEntity(pos);
if (tile instanceof TileEntityEnderCrate) { if (tile instanceof TileEntityEnderCrate) {
TileEntityEnderCrate crate = (TileEntityEnderCrate) tile; TileEntityEnderCrate crate = (TileEntityEnderCrate) tile;
if (crate.canOpen()) { if (crate.canOpen()) {
crate.drainAura(10000); crate.drainAura(10000);
playerIn.openGui(NaturesAura.MOD_ID, 0, worldIn, pos.getX(), pos.getY(), pos.getZ()); // TODO playerIn.openGui(NaturesAura.MOD_ID, 0, worldIn, pos.getX(), pos.getY(), pos.getZ());
} }
} }
} }
@ -121,13 +117,13 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
addEnderNameInfo(stack, tooltip); addEnderNameInfo(stack, tooltip);
} }
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { public void animateTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
int j = rand.nextInt(2) * 2 - 1; int j = rand.nextInt(2) * 2 - 1;
int k = rand.nextInt(2) * 2 - 1; int k = rand.nextInt(2) * 2 - 1;
@ -137,7 +133,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
double d3 = (double) (rand.nextFloat() * (float) j); double d3 = (double) (rand.nextFloat() * (float) j);
double d4 = ((double) rand.nextFloat() - 0.5D) * 0.125D; double d4 = ((double) rand.nextFloat() - 0.5D) * 0.125D;
double d5 = (double) (rand.nextFloat() * (float) k); double d5 = (double) (rand.nextFloat() * (float) k);
worldIn.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5); worldIn.addParticle(ParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5);
} }
} }

View file

@ -3,19 +3,18 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityFieldCreator; import de.ellpeck.naturesaura.blocks.tiles.TileEntityFieldCreator;
import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -24,19 +23,17 @@ import java.util.Random;
public class BlockFieldCreator extends BlockContainerImpl { public class BlockFieldCreator extends BlockContainerImpl {
public BlockFieldCreator() { public BlockFieldCreator() {
super(Material.ROCK, "field_creator", TileEntityFieldCreator.class, "field_creator"); super("field_creator", TileEntityFieldCreator.class, "field_creator", ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE));
this.setSoundType(SoundType.STONE);
this.setHardness(2F);
} }
@Override @Override
public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
TileEntity tile = worldIn.getTileEntity(pos); TileEntity tile = worldIn.getTileEntity(pos);
if (tile instanceof TileEntityFieldCreator) { if (tile instanceof TileEntityFieldCreator) {
if (!worldIn.isRemote) { if (!worldIn.isRemote) {
String key = NaturesAura.MOD_ID + ":field_creator_pos"; String key = NaturesAura.MOD_ID + ":field_creator_pos";
CompoundNBT compound = playerIn.getEntityData(); CompoundNBT compound = player.getPersistentData();
if (!playerIn.isSneaking() && compound.hasKey(key)) { if (!player.isSneaking() && compound.contains(key)) {
BlockPos stored = BlockPos.fromLong(compound.getLong(key)); BlockPos stored = BlockPos.fromLong(compound.getLong(key));
TileEntityFieldCreator creator = (TileEntityFieldCreator) tile; TileEntityFieldCreator creator = (TileEntityFieldCreator) tile;
if (!pos.equals(stored)) { if (!pos.equals(stored)) {
@ -52,17 +49,17 @@ public class BlockFieldCreator extends BlockContainerImpl {
otherCreator.isMain = false; otherCreator.isMain = false;
otherCreator.sendToClients(); otherCreator.sendToClients();
compound.removeTag(key); compound.remove(key);
playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".connected"), true); player.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".connected"), true);
} else } else
playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".stored_pos_gone"), true); player.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".stored_pos_gone"), true);
} else } else
playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".too_far"), true); player.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".too_far"), true);
} else } else
playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".same_position"), true); player.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".same_position"), true);
} else { } else {
compound.setLong(key, pos.toLong()); compound.putLong(key, pos.toLong());
playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".stored_pos"), true); player.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".stored_pos"), true);
} }
} }
return true; return true;
@ -72,7 +69,7 @@ public class BlockFieldCreator extends BlockContainerImpl {
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { public void animateTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
TileEntity tile = worldIn.getTileEntity(pos); TileEntity tile = worldIn.getTileEntity(pos);
if (tile instanceof TileEntityFieldCreator) { if (tile instanceof TileEntityFieldCreator) {
TileEntityFieldCreator creator = (TileEntityFieldCreator) tile; TileEntityFieldCreator creator = (TileEntityFieldCreator) tile;
@ -99,27 +96,12 @@ public class BlockFieldCreator extends BlockContainerImpl {
} }
@Override @Override
public boolean isFullCube(BlockState state) { public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) {
return false; return false;
} }
@Override @Override
public boolean isOpaqueCube(BlockState state) { public boolean isSolid(BlockState state) {
return false; return false;
} }
@Override
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
return false;
}
@Override
public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) {
return false;
}
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
return BlockFaceShape.UNDEFINED;
}
} }

View file

@ -12,9 +12,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockFireworkGenerator extends BlockContainerImpl implements IVisualizable { public class BlockFireworkGenerator extends BlockContainerImpl implements IVisualizable {
public BlockFireworkGenerator() { public BlockFireworkGenerator() {
super(Material.ROCK, "firework_generator", TileEntityFireworkGenerator.class, "firework_generator"); super("firework_generator", TileEntityFireworkGenerator.class, "firework_generator", ModBlocks.prop(Material.ROCK).hardnessAndResistance(3F).sound(SoundType.STONE));
this.setSoundType(SoundType.STONE);
this.setHardness(3F);
} }
@Override @Override

View file

@ -13,9 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockFlowerGenerator extends BlockContainerImpl implements IVisualizable { public class BlockFlowerGenerator extends BlockContainerImpl implements IVisualizable {
public BlockFlowerGenerator() { public BlockFlowerGenerator() {
super(Material.WOOD, "flower_generator", TileEntityFlowerGenerator.class, "flower_generator"); super("flower_generator", TileEntityFlowerGenerator.class, "flower_generator", ModBlocks.prop(Material.WOOD).sound(SoundType.WOOD).hardnessAndResistance(2F));
this.setSoundType(SoundType.WOOD);
this.setHardness(2F);
} }
@Override @Override

View file

@ -2,46 +2,49 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityFurnaceHeater; import de.ellpeck.naturesaura.blocks.tiles.TileEntityFurnaceHeater;
import net.minecraft.block.material.Material; import net.minecraft.block.Block;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.LivingEntity; import net.minecraft.block.material.Material;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
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.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ToolType;
import javax.annotation.Nullable;
import java.util.Random; import java.util.Random;
public class BlockFurnaceHeater extends BlockContainerImpl { public class BlockFurnaceHeater extends BlockContainerImpl {
public static final PropertyDirection FACING = PropertyDirection.create("facing"); public static final DirectionProperty FACING = BlockStateProperties.FACING;
private static final AxisAlignedBB AABB_UP = new AxisAlignedBB(2 / 16F, 0F, 2 / 16F, 14 / 16F, 4 / 16F, 14 / 16F); private static final VoxelShape[] SHAPES = new VoxelShape[]{
private static final AxisAlignedBB AABB_DOWN = new AxisAlignedBB(2 / 16F, 12 / 16F, 2 / 16F, 14 / 16F, 1F, 14 / 16F); Block.makeCuboidShape(2, 12, 2, 14, 1, 14), // Down
private static final AxisAlignedBB AABB_NORTH = new AxisAlignedBB(2 / 16F, 2 / 16F, 12 / 16F, 14 / 16F, 14 / 16F, 1F); Block.makeCuboidShape(2, 0, 2, 14, 4, 14), // Up
private static final AxisAlignedBB AABB_EAST = new AxisAlignedBB(0F, 2 / 16F, 2 / 16F, 4 / 16F, 14 / 16F, 14 / 16F); Block.makeCuboidShape(2, 2, 12, 14, 14, 1F), // North
private static final AxisAlignedBB AABB_SOUTH = new AxisAlignedBB(2 / 16F, 2 / 16F, 0F, 14 / 16F, 14 / 16F, 4 / 16F); Block.makeCuboidShape(2, 2, 0, 14, 14, 4), // South
private static final AxisAlignedBB AABB_WEST = new AxisAlignedBB(12 / 16F, 2 / 16F, 2 / 16F, 1F, 14 / 16F, 14 / 16F); Block.makeCuboidShape(12, 2, 2, 1, 14, 14), // West
Block.makeCuboidShape(0, 2, 2, 4, 14, 14) // East
};
public BlockFurnaceHeater() { public BlockFurnaceHeater() {
super(Material.ROCK, "furnace_heater", TileEntityFurnaceHeater.class, "furnace_heater"); super("furnace_heater", TileEntityFurnaceHeater.class, "furnace_heater", ModBlocks.prop(Material.ROCK).hardnessAndResistance(3F).harvestLevel(1).harvestTool(ToolType.PICKAXE));
this.setHardness(3F);
this.setHarvestLevel("pickaxe", 1);
} }
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { public void animateTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
TileEntity tile = worldIn.getTileEntity(pos); TileEntity tile = worldIn.getTileEntity(pos);
if (tile instanceof TileEntityFurnaceHeater && ((TileEntityFurnaceHeater) tile).isActive) { if (tile instanceof TileEntityFurnaceHeater && ((TileEntityFurnaceHeater) tile).isActive) {
Direction facing = stateIn.getValue(FACING); Direction facing = stateIn.get(FACING);
float x; float x;
float y; float y;
@ -70,65 +73,28 @@ public class BlockFurnaceHeater extends BlockContainerImpl {
} }
@Override @Override
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
switch (state.getValue(FACING)) { return SHAPES[state.get(FACING).getIndex()];
case DOWN:
return AABB_DOWN;
case NORTH:
return AABB_NORTH;
case EAST:
return AABB_EAST;
case SOUTH:
return AABB_SOUTH;
case WEST:
return AABB_WEST;
default:
return AABB_UP;
}
} }
@Override @Override
public boolean isFullCube(BlockState state) { public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) {
return false; return false;
} }
@Override @Override
public boolean isOpaqueCube(BlockState state) { public boolean isSolid(BlockState state) {
return false; return false;
} }
@Override @Override
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) { protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
return false; builder.add(FACING);
} }
@Nullable
@Override @Override
public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) { public BlockState getStateForPlacement(BlockItemUseContext context) {
return false; return this.getDefaultState().with(FACING, context.getFace());
}
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
return BlockFaceShape.UNDEFINED;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, FACING);
}
@Override
public int getMetaFromState(BlockState state) {
return state.getValue(FACING).getIndex();
}
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(FACING, Direction.byIndex(meta));
}
@Override
public BlockState getStateForPlacement(World world, BlockPos pos, Direction facing, float hitX, float hitY, float hitZ, int meta, LivingEntity placer, Hand hand) {
return this.getDefaultState().withProperty(FACING, facing);
} }
} }

View file

@ -13,9 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockGeneratorLimitRemover extends BlockContainerImpl implements ITESRProvider { public class BlockGeneratorLimitRemover extends BlockContainerImpl implements ITESRProvider {
public BlockGeneratorLimitRemover() { public BlockGeneratorLimitRemover() {
super(Material.ROCK, "generator_limit_remover", TileEntityGeneratorLimitRemover.class, "generator_limit_remover"); super("generator_limit_remover", TileEntityGeneratorLimitRemover.class, "generator_limit_remover", ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE));
this.setSoundType(SoundType.STONE);
this.setHardness(2F);
} }
@Override @Override

View file

@ -2,70 +2,66 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.reg.IColorProvidingBlock; import de.ellpeck.naturesaura.reg.IColorProvidingBlock;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.state.EnumProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
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.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nullable; import javax.annotation.Nullable;
// TODO
public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock { public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock {
public static final PropertyEnum<AttachPos> NORTH = PropertyEnum.create("north", AttachPos.class); public static final EnumProperty<AttachPos> NORTH = EnumProperty.create("north", AttachPos.class);
public static final PropertyEnum<AttachPos> EAST = PropertyEnum.create("east", AttachPos.class); public static final EnumProperty<AttachPos> EAST = EnumProperty.create("east", AttachPos.class);
public static final PropertyEnum<AttachPos> SOUTH = PropertyEnum.create("south", AttachPos.class); public static final EnumProperty<AttachPos> SOUTH = EnumProperty.create("south", AttachPos.class);
public static final PropertyEnum<AttachPos> WEST = PropertyEnum.create("west", AttachPos.class); public static final EnumProperty<AttachPos> WEST = EnumProperty.create("west", AttachPos.class);
protected static final AxisAlignedBB[] AABBS = new AxisAlignedBB[]{ protected static final VoxelShape[] SHAPES = new VoxelShape[]{
new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 0.8125D), VoxelShapes.create(0.1875D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 0.8125D),
new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 1.0D), VoxelShapes.create(0.1875D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 0.8125D), VoxelShapes.create(0.0D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 0.8125D),
new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 1.0D), VoxelShapes.create(0.0D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 1.0D),
new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 0.8125D, 0.0625D, 0.8125D), VoxelShapes.create(0.1875D, 0.0D, 0.0D, 0.8125D, 0.0625D, 0.8125D),
new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 0.8125D, 0.0625D, 1.0D), VoxelShapes.create(0.1875D, 0.0D, 0.0D, 0.8125D, 0.0625D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.8125D, 0.0625D, 0.8125D), VoxelShapes.create(0.0D, 0.0D, 0.0D, 0.8125D, 0.0625D, 0.8125D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.8125D, 0.0625D, 1.0D), VoxelShapes.create(0.0D, 0.0D, 0.0D, 0.8125D, 0.0625D, 1.0D),
new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 1.0D, 0.0625D, 0.8125D), VoxelShapes.create(0.1875D, 0.0D, 0.1875D, 1.0D, 0.0625D, 0.8125D),
new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 1.0D, 0.0625D, 1.0D), VoxelShapes.create(0.1875D, 0.0D, 0.1875D, 1.0D, 0.0625D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 1.0D, 0.0625D, 0.8125D), VoxelShapes.create(0.0D, 0.0D, 0.1875D, 1.0D, 0.0625D, 0.8125D),
new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 1.0D, 0.0625D, 1.0D), VoxelShapes.create(0.0D, 0.0D, 0.1875D, 1.0D, 0.0625D, 1.0D),
new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 1.0D, 0.0625D, 0.8125D), VoxelShapes.create(0.1875D, 0.0D, 0.0D, 1.0D, 0.0625D, 0.8125D),
new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 1.0D, 0.0625D, 1.0D), VoxelShapes.create(0.1875D, 0.0D, 0.0D, 1.0D, 0.0625D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.0625D, 0.8125D), VoxelShapes.create(0.0D, 0.0D, 0.0D, 1.0D, 0.0625D, 0.8125D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.0625D, 1.0D) VoxelShapes.create(0.0D, 0.0D, 0.0D, 1.0D, 0.0625D, 1.0D)
}; };
public BlockGoldPowder() { public BlockGoldPowder() {
super("gold_powder", Material.CIRCUITS); super("gold_powder", ModBlocks.prop(Blocks.REDSTONE_WIRE));
this.setSoundType(SoundType.STONE);
this.setHardness(0F);
this.setDefaultState(this.getDefaultState() this.setDefaultState(this.getDefaultState()
.withProperty(NORTH, AttachPos.NONE) .with(NORTH, AttachPos.NONE)
.withProperty(EAST, AttachPos.NONE) .with(EAST, AttachPos.NONE)
.withProperty(SOUTH, AttachPos.NONE) .with(SOUTH, AttachPos.NONE)
.withProperty(WEST, AttachPos.NONE)); .with(WEST, AttachPos.NONE));
} }
@Override @Override
protected BlockStateContainer createBlockState() { protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
return new BlockStateContainer(this, NORTH, EAST, SOUTH, WEST); builder.add(NORTH, EAST, SOUTH, WEST);
}
@Override
public int getMetaFromState(BlockState state) {
return 0;
} }
@Override @Override
@ -74,16 +70,21 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock {
} }
@Override @Override
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return AABBS[getAABBIndex(state.getActualState(source, pos))]; return SHAPES[getShapeIndex(state)];
} }
private static int getAABBIndex(BlockState state) { @Override
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
return SHAPES[getShapeIndex(state.getActualState(source, pos))];
}
private static int getShapeIndex(BlockState state) {
int i = 0; int i = 0;
boolean n = state.getValue(NORTH) != AttachPos.NONE; boolean n = state.get(NORTH) != AttachPos.NONE;
boolean e = state.getValue(EAST) != AttachPos.NONE; boolean e = state.get(EAST) != AttachPos.NONE;
boolean s = state.getValue(SOUTH) != AttachPos.NONE; boolean s = state.get(SOUTH) != AttachPos.NONE;
boolean w = state.getValue(WEST) != AttachPos.NONE; boolean w = state.get(WEST) != AttachPos.NONE;
if (n || s && !n && !e && !w) { if (n || s && !n && !e && !w) {
i |= 1 << Direction.NORTH.getHorizontalIndex(); i |= 1 << Direction.NORTH.getHorizontalIndex();
@ -133,34 +134,28 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock {
} }
@Override @Override
public AxisAlignedBB getCollisionBoundingBox(BlockState blockState, IBlockAccess worldIn, BlockPos pos) { public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return NULL_AABB; return VoxelShapes.empty();
} }
@Override @Override
public boolean isOpaqueCube(BlockState state) { public boolean isFireSource(BlockState state, IBlockReader world, BlockPos pos, Direction side) {
return false; return false;
} }
@Override public boolean canPlaceBlockAt(IWorldReader worldIn, BlockPos pos) {
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
BlockState downState = worldIn.getBlockState(pos.down()); BlockState downState = worldIn.getBlockState(pos.down());
return downState.isTopSolid() return downState.isSolid()
|| downState.getBlockFaceShape(worldIn, pos.down(), Direction.UP) == BlockFaceShape.SOLID || downState.getBlockFaceShape(worldIn, pos.down(), Direction.UP) == BlockFaceShape.SOLID
|| worldIn.getBlockState(pos.down()).getBlock() == Blocks.GLOWSTONE; || worldIn.getBlockState(pos.down()).getBlock() == Blocks.GLOWSTONE;
} }
@Override @Override
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { public void onNeighborChange(BlockState state, IWorldReader world, BlockPos pos, BlockPos neighbor) {
if (!worldIn.isRemote) { if (!world.isRemote()) {
if (!this.canPlaceBlockAt(worldIn, pos)) { if (!this.canPlaceBlockAt(world, pos)) {
this.dropBlockAsItem(worldIn, pos, state, 0); this.dropBlockAsItem(world, pos, state, 0);
worldIn.setBlockToAir(pos); world.setBlockToAir(pos);
} }
} }
} }
@ -180,11 +175,6 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;
} }
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
return BlockFaceShape.UNDEFINED;
}
private enum AttachPos implements IStringSerializable { private enum AttachPos implements IStringSerializable {
UP("up"), UP("up"),
SIDE("side"), SIDE("side"),

View file

@ -2,73 +2,45 @@ package de.ellpeck.naturesaura.blocks;
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.reg.*; import de.ellpeck.naturesaura.reg.*;
import net.minecraft.block.LeavesBlock; import net.minecraft.block.Block;
import net.minecraft.block.BlockPlanks;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.LeavesBlock;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.state.IntegerProperty;
import net.minecraft.item.ItemStack; import net.minecraft.state.StateContainer;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeColors; import net.minecraft.world.biome.BiomeColors;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.List;
import java.util.Random; import java.util.Random;
public class BlockGoldenLeaves extends LeavesBlock implements public class BlockGoldenLeaves extends LeavesBlock implements
IModItem, IModelProvider, IColorProvidingBlock, IColorProvidingItem { IModItem, IModelProvider, IColorProvidingBlock, IColorProvidingItem {
private static final int HIGHEST_STAGE = 3; private static final int HIGHEST_STAGE = 3;
private static final PropertyInteger STAGE = PropertyInteger.create("stage", 0, HIGHEST_STAGE); private static final IntegerProperty STAGE = IntegerProperty.create("stage", 0, HIGHEST_STAGE);
public BlockGoldenLeaves() { public BlockGoldenLeaves() {
this.leavesFancy = true; super(ModBlocks.prop(Material.LEAVES, MaterialColor.GOLD));
ModRegistry.add(this); ModRegistry.add(this);
} }
@Override
public MaterialColor getMapColor(BlockState state, IBlockAccess worldIn, BlockPos pos) {
return MaterialColor.GOLD;
}
@Override @Override
public String getBaseName() { public String getBaseName() {
return "golden_leaves"; return "golden_leaves";
} }
@Override
public void onPreInit(FMLPreInitializationEvent event) {
}
@Override
public void onInit(FMLInitializationEvent event) {
}
@Override
public void onPostInit(FMLPostInitializationEvent event) {
}
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { public void animateTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
if (stateIn.getValue(STAGE) == HIGHEST_STAGE && rand.nextFloat() >= 0.75F) if (stateIn.get(STAGE) == HIGHEST_STAGE && rand.nextFloat() >= 0.75F)
NaturesAuraAPI.instance().spawnMagicParticle( NaturesAuraAPI.instance().spawnMagicParticle(
pos.getX() + rand.nextFloat(), pos.getX() + rand.nextFloat(),
pos.getY() + rand.nextFloat(), pos.getY() + rand.nextFloat(),
@ -77,45 +49,19 @@ public class BlockGoldenLeaves extends LeavesBlock implements
0xF2FF00, 0.5F + rand.nextFloat(), 50, 0F, false, true); 0xF2FF00, 0.5F + rand.nextFloat(), 50, 0F, false, true);
} }
/* Replaced by json loot tables
@Override @Override
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) { public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) {
NonNullList<ItemStack> drops = NonNullList.create(); NonNullList<ItemStack> drops = NonNullList.create();
this.getDrops(drops, world, pos, world.getBlockState(pos), fortune); this.getDrops(drops, world, pos, world.getBlockState(pos), fortune);
return drops; return drops;
} }
*/
@Override @Override
protected BlockStateContainer createBlockState() { protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
return new BlockStateContainer(this, CHECK_DECAY, DECAYABLE, STAGE); super.fillStateContainer(builder);
} builder.add(STAGE);
@Override
public BlockState getStateFromMeta(int meta) {
boolean check = (meta & 4) != 0; // 4th bit
boolean decay = (meta & 8) != 0; // 3rd bit
int stage = meta & HIGHEST_STAGE; // 1st and 2nd bit
return this.getDefaultState().withProperty(CHECK_DECAY, check).withProperty(DECAYABLE, decay).withProperty(STAGE, stage);
}
@Override
public int getMetaFromState(BlockState state) {
boolean check = state.getValue(CHECK_DECAY);
boolean decay = state.getValue(DECAYABLE);
return (check ? 1 : 0) << 3 | (decay ? 1 : 0) << 2 | state.getValue(STAGE);
}
@Override
public void beginLeavesDecay(BlockState state, World world, BlockPos pos) {
if (!state.getValue(CHECK_DECAY) && state.getValue(DECAYABLE)) {
world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4);
}
}
@Override
public BlockPlanks.EnumType getWoodType(int meta) {
return null;
} }
@Override @Override
@ -124,8 +70,8 @@ public class BlockGoldenLeaves extends LeavesBlock implements
return (state, worldIn, pos, tintIndex) -> { return (state, worldIn, pos, tintIndex) -> {
int color = 0xF2FF00; int color = 0xF2FF00;
if (state != null && worldIn != null && pos != null) { if (state != null && worldIn != null && pos != null) {
int foliage = BiomeColors.getFoliageColorAtPos(worldIn, pos); int foliage = BiomeColors.getFoliageColor(worldIn, pos);
return Helper.blendColors(color, foliage, state.getValue(STAGE) / (float) HIGHEST_STAGE); return Helper.blendColors(color, foliage, state.get(STAGE) / (float) HIGHEST_STAGE);
} else { } else {
return color; return color;
} }
@ -138,6 +84,7 @@ public class BlockGoldenLeaves extends LeavesBlock implements
return (stack, tintIndex) -> 0xF2FF00; return (stack, tintIndex) -> 0xF2FF00;
} }
/* Replaced by json loot tables
@Override @Override
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) { public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) {
Random rand = world instanceof World ? ((World) world).rand : RANDOM; Random rand = world instanceof World ? ((World) world).rand : RANDOM;
@ -149,37 +96,34 @@ public class BlockGoldenLeaves extends LeavesBlock implements
drops.add(new ItemStack(ModItems.GOLD_LEAF)); drops.add(new ItemStack(ModItems.GOLD_LEAF));
} }
} }
*/
@Override @Override
public void updateTick(World worldIn, BlockPos pos, BlockState state, Random rand) { public void tick(BlockState state, World worldIn, BlockPos pos, Random random) {
super.updateTick(worldIn, pos, state, rand); super.tick(state, worldIn, pos, random);
if (!worldIn.isRemote) { if (!worldIn.isRemote) {
int stage = state.getValue(STAGE); int stage = state.get(STAGE);
if (stage < HIGHEST_STAGE) { if (stage < HIGHEST_STAGE) {
worldIn.setBlockState(pos, state.withProperty(STAGE, stage + 1)); worldIn.setBlockState(pos, state.with(STAGE, stage + 1));
} }
if (stage > 1) { if (stage > 1) {
BlockPos offset = pos.offset(Direction.random(rand)); BlockPos offset = pos.offset(Direction.random(random));
if (worldIn.isBlockLoaded(offset)) if (worldIn.isBlockLoaded(offset))
convert(worldIn, offset); convert(worldIn, offset);
} }
} }
} }
@Override
public boolean canSilkHarvest(World world, BlockPos pos, BlockState state, PlayerEntity player) {
return false;
}
public static boolean convert(World world, BlockPos pos) { public static boolean convert(World world, BlockPos pos) {
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
if (state.getBlock().isLeaves(state, world, pos) && if (state.getBlock().isFoliage(state, world, pos) &&
!(state.getBlock() instanceof BlockAncientLeaves || state.getBlock() instanceof BlockGoldenLeaves)) { !(state.getBlock() instanceof BlockAncientLeaves || state.getBlock() instanceof BlockGoldenLeaves)) {
if (!world.isRemote) { if (!world.isRemote) {
world.setBlockState(pos, ModBlocks.GOLDEN_LEAVES.getDefaultState() world.setBlockState(pos, ModBlocks.GOLDEN_LEAVES.getDefaultState()
.withProperty(CHECK_DECAY, state.getPropertyKeys().contains(CHECK_DECAY) ? state.getValue(CHECK_DECAY) : false) .with(DISTANCE, state.has(DISTANCE) ? state.get(DISTANCE) : 1)
.withProperty(DECAYABLE, state.getPropertyKeys().contains(DECAYABLE) ? state.getValue(DECAYABLE) : false)); .with(PERSISTENT, state.has(PERSISTENT) ? state.get(PERSISTENT) : false));
} }
return true; return true;
} }

View file

@ -12,11 +12,15 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.state.DirectionProperty;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.*;
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.util.math.BlockRayTraceResult;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
@ -28,23 +32,33 @@ import java.util.List;
public class BlockGratedChute extends BlockContainerImpl { public class BlockGratedChute extends BlockContainerImpl {
public static final PropertyDirection FACING = HopperBlock.FACING; public static final DirectionProperty FACING = HopperBlock.FACING;
private static final AxisAlignedBB BASE_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.625D, 1.0D); private static final AxisAlignedBB BASE_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.625D, 1.0D);
private static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D); private static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D);
private static final AxisAlignedBB NORTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 1.0D, 1.0D); private static final AxisAlignedBB NORTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 1.0D, 1.0D);
private static final AxisAlignedBB WEST_AABB = new AxisAlignedBB(0.875D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); private static final AxisAlignedBB WEST_AABB = new AxisAlignedBB(0.875D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
private static final AxisAlignedBB EAST_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D); private static final AxisAlignedBB EAST_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D);
private static final VoxelShape BASE_TOP = makeCuboidShape(0, 9, 0, 16, 10, 16);
private static final VoxelShape BASE_SOUTH = makeCuboidShape(0, 9, 0, 16, 16, 1);
private static final VoxelShape BASE_NORTH = makeCuboidShape(0, 9, 15, 16, 16, 16);
private static final VoxelShape BASE_WEST = makeCuboidShape(15, 9, 0, 16, 26, 16);
private static final VoxelShape BASE_EAST = makeCuboidShape(0, 9, 0, 1, 16, 16);
private static final VoxelShape BASE_BOTTOM = makeCuboidShape(4, 4, 4, 12, 9, 12);
private static VoxelShape BASE = VoxelShapes.combine()
private static final VoxelShape SHAPES[] {
}
public BlockGratedChute() { public BlockGratedChute() {
super(Material.IRON, "grated_chute", TileEntityGratedChute.class, "grated_chute"); super("grated_chute", TileEntityGratedChute.class, "grated_chute", ModBlocks.prop(Material.IRON).hardnessAndResistance(3.0F, 8.0F).sound(SoundType.METAL));
this.setHardness(3.0F);
this.setResistance(8.0F);
this.setSoundType(SoundType.METAL);
} }
@Override @Override
public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!playerIn.isSneaking()) if (!player.isSneaking())
return false; return false;
TileEntity tile = worldIn.getTileEntity(pos); TileEntity tile = worldIn.getTileEntity(pos);
if (!(tile instanceof TileEntityGratedChute)) if (!(tile instanceof TileEntityGratedChute))

View file

@ -12,9 +12,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockHopperUpgrade extends BlockContainerImpl implements IVisualizable { public class BlockHopperUpgrade extends BlockContainerImpl implements IVisualizable {
public BlockHopperUpgrade() { public BlockHopperUpgrade() {
super(Material.IRON, "hopper_upgrade", TileEntityHopperUpgrade.class, "hopper_upgrade"); super("hopper_upgrade", TileEntityHopperUpgrade.class, "hopper_upgrade", ModBlocks.prop(Material.IRON).hardnessAndResistance(2.5F).sound(SoundType.METAL));
this.setSoundType(SoundType.METAL);
this.setHardness(2.5F);
} }
@Override @Override

View file

@ -1,23 +1,19 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.reg.ICreativeItem; import de.ellpeck.naturesaura.NaturesAura;
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.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
public class BlockImpl extends Block implements IModItem, ICreativeItem, 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, Block.Properties properties) {
super(material); super(properties);
this.baseName = baseName; this.baseName = baseName;
this.setRegistryName(NaturesAura.createRes(this.getBaseName()));
ModRegistry.add(this); ModRegistry.add(this);
} }
@ -25,24 +21,4 @@ public class BlockImpl extends Block implements IModItem, ICreativeItem, IModelP
public String getBaseName() { public String getBaseName() {
return this.baseName; return this.baseName;
} }
@Override
public void onPreInit(FMLPreInitializationEvent event) {
}
@Override
public void onInit(FMLInitializationEvent event) {
}
@Override
public void onPostInit(FMLPostInitializationEvent event) {
}
@Override
public Block setSoundType(SoundType sound) {
return super.setSoundType(sound);
}
} }

View file

@ -12,9 +12,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockMossGenerator extends BlockContainerImpl implements IVisualizable { public class BlockMossGenerator extends BlockContainerImpl implements IVisualizable {
public BlockMossGenerator() { public BlockMossGenerator() {
super(Material.ROCK, "moss_generator", TileEntityMossGenerator.class, "moss_generator"); super("moss_generator", TileEntityMossGenerator.class, "moss_generator", ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE));
this.setSoundType(SoundType.STONE);
this.setHardness(2.5F);
} }
@Override @Override

View file

@ -4,6 +4,7 @@ import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar; import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar; import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar;
import de.ellpeck.naturesaura.reg.ITESRProvider; import de.ellpeck.naturesaura.reg.ITESRProvider;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -18,15 +19,14 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ToolType;
public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvider { public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvider {
private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(0F, 0F, 0F, 1F, 12 / 16F, 1F); private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(0F, 0F, 0F, 1F, 12 / 16F, 1F);
public BlockNatureAltar() { public BlockNatureAltar() {
super(Material.ROCK, "nature_altar", TileEntityNatureAltar.class, "nature_altar"); super("nature_altar", TileEntityNatureAltar.class, "nature_altar", ModBlocks.prop(Material.ROCK).hardnessAndResistance(4F).harvestLevel(1).harvestTool(ToolType.PICKAXE));
this.setHardness(4F);
this.setHarvestLevel("pickaxe", 1);
} }
@Override @Override

View file

@ -22,9 +22,7 @@ import java.util.Random;
public class BlockOakGenerator extends BlockContainerImpl implements IVisualizable { public class BlockOakGenerator extends BlockContainerImpl implements IVisualizable {
public BlockOakGenerator() { public BlockOakGenerator() {
super(Material.WOOD, "oak_generator", TileEntityOakGenerator.class, "oak_generator"); super("oak_generator", TileEntityOakGenerator.class, "oak_generator", ModBlocks.prop(Material.WOOD).hardnessAndResistance(2F).sound(SoundType.WOOD));
this.setHardness(2F);
this.setSoundType(SoundType.WOOD);
MinecraftForge.TERRAIN_GEN_BUS.register(this); MinecraftForge.TERRAIN_GEN_BUS.register(this);
} }

View file

@ -25,9 +25,7 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi
private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(2 / 16F, 0F, 2 / 16F, 14 / 16F, 1F, 14 / 16F); private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(2 / 16F, 0F, 2 / 16F, 14 / 16F, 1F, 14 / 16F);
public BlockOfferingTable() { public BlockOfferingTable() {
super(Material.WOOD, "offering_table", TileEntityOfferingTable.class, "offering_table"); super("offering_table", TileEntityOfferingTable.class, "offering_table", ModBlocks.prop(Material.WOOD).hardnessAndResistance(2F).sound(SoundType.WOOD));
this.setSoundType(SoundType.WOOD);
this.setHardness(2F);
} }
@Override @Override

View file

@ -21,9 +21,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockPickupStopper extends BlockContainerImpl implements IVisualizable { public class BlockPickupStopper extends BlockContainerImpl implements IVisualizable {
public BlockPickupStopper() { public BlockPickupStopper() {
super(Material.ROCK, "pickup_stopper", TileEntityPickupStopper.class, "pickup_stopper"); super("pickup_stopper", TileEntityPickupStopper.class, "pickup_stopper", ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE));
this.setSoundType(SoundType.STONE);
this.setHardness(2F);
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
} }

View file

@ -13,9 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockPlacer extends BlockContainerImpl implements IVisualizable { public class BlockPlacer extends BlockContainerImpl implements IVisualizable {
public BlockPlacer() { public BlockPlacer() {
super(Material.ROCK, "placer", TileEntityPlacer.class, "placer"); super("placer", TileEntityPlacer.class, "placer", ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE));
this.setSoundType(SoundType.STONE);
this.setHardness(2.5F);
} }
@Override @Override

View file

@ -2,11 +2,10 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityPotionGenerator; import de.ellpeck.naturesaura.blocks.tiles.TileEntityPotionGenerator;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraftforge.common.ToolType;
public class BlockPotionGenerator extends BlockContainerImpl { public class BlockPotionGenerator extends BlockContainerImpl {
public BlockPotionGenerator() { public BlockPotionGenerator() {
super(Material.ROCK, "potion_generator", TileEntityPotionGenerator.class, "potion_generator"); super("potion_generator", TileEntityPotionGenerator.class, "potion_generator", ModBlocks.prop(Material.ROCK).hardnessAndResistance(5F).harvestTool(ToolType.PICKAXE).harvestLevel(1));
this.setHardness(5F);
this.setHarvestLevel("pickaxe", 1);
} }
} }

View file

@ -14,9 +14,7 @@ public class BlockPowderPlacer extends BlockContainerImpl {
private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(0F, 0F, 0F, 1F, 4 / 16F, 1F); private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(0F, 0F, 0F, 1F, 4 / 16F, 1F);
public BlockPowderPlacer() { public BlockPowderPlacer() {
super(Material.ROCK, "powder_placer", TileEntityPowderPlacer.class, "powder_placer"); super("powder_placer", TileEntityPowderPlacer.class, "powder_placer", ModBlocks.prop(Material.ROCK).hardnessAndResistance(2,5F).sound(SoundType.STONE));
this.setSoundType(SoundType.STONE);
this.setHardness(2.5F);
} }
@Override @Override

View file

@ -28,9 +28,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockProjectileGenerator extends BlockContainerImpl implements ITESRProvider { public class BlockProjectileGenerator extends BlockContainerImpl implements ITESRProvider {
public BlockProjectileGenerator() { public BlockProjectileGenerator() {
super(Material.ROCK, "projectile_generator", TileEntityProjectileGenerator.class, "projectile_generator"); super("projectile_generator", TileEntityProjectileGenerator.class, "projectile_generator", ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE));
this.setSoundType(SoundType.STONE);
this.setHardness(2.5F);
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
} }

View file

@ -1,169 +0,0 @@
package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.items.ItemSlabNA;
import de.ellpeck.naturesaura.reg.ICustomItemBlockProvider;
import net.minecraft.block.BlockSlab.EnumBlockHalf;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemGroup;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.BlockItem;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeModContainer;
import org.apache.commons.lang3.mutable.MutableObject;
import java.util.Random;
import java.util.function.Supplier;
public abstract class BlockSlabsNA extends BlockImpl implements ICustomItemBlockProvider {
protected static final PropertyEnum<EnumBlockHalf> HALF = PropertyEnum.create("half", EnumBlockHalf.class);
protected static final AxisAlignedBB AABB_BOTTOM_HALF = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.5D, 1.0D);
protected static final AxisAlignedBB AABB_TOP_HALF = new AxisAlignedBB(0.0D, 0.5D, 0.0D, 1.0D, 1.0D, 1.0D);
private final Supplier<BlockSlabsNA> singleSlab;
private final Supplier<BlockSlabsNA> doubleSlab;
public BlockSlabsNA(String baseName, Material materialIn, Supplier<BlockSlabsNA> singleSlab, Supplier<BlockSlabsNA> doubleSlab) {
super(baseName, materialIn);
this.singleSlab = singleSlab;
this.doubleSlab = doubleSlab;
}
@Override
public ItemGroup getTabToAdd() {
return this.isDouble() ? null : super.getTabToAdd();
}
@Override
protected boolean canSilkHarvest() {
return false;
}
@Override
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
if (this.isDouble())
return FULL_BLOCK_AABB;
else
return state.getValue(HALF) == EnumBlockHalf.TOP ? AABB_TOP_HALF : AABB_BOTTOM_HALF;
}
@Override
public boolean isTopSolid(BlockState state) {
return this.isDouble() || state.getValue(HALF) == EnumBlockHalf.TOP;
}
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
if (this.isDouble())
return BlockFaceShape.SOLID;
else if (face == Direction.UP && state.getValue(HALF) == EnumBlockHalf.TOP)
return BlockFaceShape.SOLID;
else
return face == Direction.DOWN && state.getValue(HALF) == EnumBlockHalf.BOTTOM ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED;
}
@Override
public boolean isOpaqueCube(BlockState state) {
return this.isDouble();
}
@Override
public boolean isFullCube(BlockState state) {
return this.isDouble();
}
@Override
public boolean isFullBlock(BlockState state) {
return this.isDouble();
}
@Override
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
return this.isDouble();
}
@Override
public boolean doesSideBlockRendering(BlockState state, IBlockAccess world, BlockPos pos, Direction face) {
if (ForgeModContainer.disableStairSlabCulling)
return super.doesSideBlockRendering(state, world, pos, face);
if (state.isOpaqueCube())
return true;
EnumBlockHalf side = state.getValue(HALF);
return (side == EnumBlockHalf.TOP && face == Direction.UP) || (side == EnumBlockHalf.BOTTOM && face == Direction.DOWN);
}
@Override
public BlockState getStateForPlacement(World worldIn, BlockPos pos, Direction facing, float hitX, float hitY, float hitZ, int meta, LivingEntity placer) {
if (this.isDouble())
return this.getDefaultState();
else {
BlockState state = this.getStateFromMeta(meta);
return facing != Direction.DOWN && (facing == Direction.UP || (double) hitY <= 0.5D) ?
state.withProperty(HALF, EnumBlockHalf.BOTTOM) : state.withProperty(HALF, EnumBlockHalf.TOP);
}
}
@Override
public int quantityDropped(Random random) {
return this.isDouble() ? 2 : 1;
}
@Override
public Item getItemDropped(BlockState state, Random rand, int fortune) {
return Item.getItemFromBlock(this.singleSlab.get());
}
@Override
public BlockItem getItemBlock() {
return new ItemSlabNA(this, this.singleSlab, this.doubleSlab);
}
@Override
protected BlockStateContainer createBlockState() {
return this.isDouble() ? new BlockStateContainer(this) : new BlockStateContainer(this, HALF);
}
@Override
public int getMetaFromState(BlockState state) {
return this.isDouble() ? 0 : (state.getValue(HALF) == EnumBlockHalf.TOP ? 1 : 0);
}
@Override
public BlockState getStateFromMeta(int meta) {
return this.isDouble() ? this.getDefaultState() : this.getDefaultState().withProperty(HALF, meta == 1 ? EnumBlockHalf.TOP : EnumBlockHalf.BOTTOM);
}
public abstract boolean isDouble();
public static BlockSlabsNA makeSlab(String baseName, Material material, SoundType soundType, float hardness) {
MutableObject<BlockSlabsNA> singl = new MutableObject<>();
MutableObject<BlockSlabsNA> doubl = new MutableObject<>();
singl.setValue(new BlockSlabsNA(baseName, material, singl::getValue, doubl::getValue) {
@Override
public boolean isDouble() {
return false;
}
});
singl.getValue().setSoundType(soundType).setHardness(hardness);
doubl.setValue(new BlockSlabsNA(baseName + "_double", material, singl::getValue, doubl::getValue) {
@Override
public boolean isDouble() {
return true;
}
});
doubl.getValue().setSoundType(soundType).setHardness(hardness);
return singl.getValue();
}
}

View file

@ -18,6 +18,7 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IWorld;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent;
@ -31,18 +32,15 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable
private static final AxisAlignedBB AABB = new AxisAlignedBB(4 / 16F, 0F, 4 / 16F, 12 / 16F, 13 / 16F, 12 / 16F); private static final AxisAlignedBB AABB = new AxisAlignedBB(4 / 16F, 0F, 4 / 16F, 12 / 16F, 13 / 16F, 12 / 16F);
public BlockSpawnLamp() { public BlockSpawnLamp() {
super(Material.IRON, "spawn_lamp", TileEntitySpawnLamp.class, "spawn_lamp"); super("spawn_lamp", TileEntitySpawnLamp.class, "spawn_lamp", ModBlocks.prop(Material.IRON).hardnessAndResistance(3F).lightValue(1F).sound(SoundType.METAL));
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
this.setLightLevel(1F);
this.setSoundType(SoundType.METAL);
this.setHardness(3F);
} }
@SubscribeEvent @SubscribeEvent
public void onSpawn(LivingSpawnEvent.CheckSpawn event) { public void onSpawn(LivingSpawnEvent.CheckSpawn event) {
if (event.getSpawner() != null) if (event.getSpawner() != null)
return; return;
World world = event.getWorld(); IWorld world = event.getWorld();
BlockPos pos = new BlockPos(event.getX(), event.getY(), event.getZ()); BlockPos pos = new BlockPos(event.getX(), event.getY(), event.getZ());
Helper.getTileEntitiesInArea(world, pos, 48, tile -> { Helper.getTileEntitiesInArea(world, pos, 48, tile -> {
if (!(tile instanceof TileEntitySpawnLamp)) if (!(tile instanceof TileEntitySpawnLamp))

View file

@ -1,66 +1,26 @@
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;
import net.minecraft.block.StairsBlock; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos; import net.minecraft.block.StairsBlock;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.common.event.FMLInitializationEvent; import java.util.function.Supplier;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
public class BlockStairsNA extends StairsBlock implements IModItem, ICreativeItem, IModelProvider { public class BlockStairsNA extends StairsBlock implements IModItem, ICreativeItem, IModelProvider {
private final String baseName; private final String baseName;
protected BlockStairsNA(String baseName, BlockState modelState) { public BlockStairsNA(String baseName, Supplier<BlockState> modelState, Block.Properties properties) {
super(modelState); super(modelState, properties.variableOpacity());
this.baseName = baseName; this.baseName = baseName;
ModRegistry.add(this); ModRegistry.add(this);
this.fullBlock = false;
this.lightOpacity = 0;
} }
@Override @Override
public String getBaseName() { public String getBaseName() {
return this.baseName; return this.baseName;
} }
@Override
public void onPreInit(FMLPreInitializationEvent event) {
}
@Override
public void onInit(FMLInitializationEvent event) {
}
@Override
public void onPostInit(FMLPostInitializationEvent event) {
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean isFullBlock(BlockState state) {
return false;
}
@Override
public boolean isOpaqueCube(BlockState state) {
return false;
}
@Override
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
return false;
}
} }

View file

@ -6,8 +6,6 @@ import net.minecraft.block.material.Material;
public class BlockTimeChanger extends BlockContainerImpl { public class BlockTimeChanger extends BlockContainerImpl {
public BlockTimeChanger() { public BlockTimeChanger() {
super(Material.ROCK, "time_changer", TileEntityTimeChanger.class, "time_changer"); super("time_changer", TileEntityTimeChanger.class, "time_changer", ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE));
this.setSoundType(SoundType.STONE);
this.setHardness(2.5F);
} }
} }

View file

@ -7,6 +7,7 @@ import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityWoodStand; import de.ellpeck.naturesaura.blocks.tiles.TileEntityWoodStand;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderWoodStand; import de.ellpeck.naturesaura.blocks.tiles.render.RenderWoodStand;
import de.ellpeck.naturesaura.reg.ITESRProvider; import de.ellpeck.naturesaura.reg.ITESRProvider;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.BlockFaceShape;
@ -24,6 +25,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.event.terraingen.SaplingGrowTreeEvent; import net.minecraftforge.event.terraingen.SaplingGrowTreeEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
@ -39,10 +41,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider
private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(3 / 16F, 0F, 3 / 16F, 13 / 16F, 13 / 16F, 13 / 16F); private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(3 / 16F, 0F, 3 / 16F, 13 / 16F, 13 / 16F, 13 / 16F);
public BlockWoodStand() { public BlockWoodStand() {
super(Material.WOOD, "wood_stand", TileEntityWoodStand.class, "wood_stand"); super("wood_stand", TileEntityWoodStand.class, "wood_stand", ModBlocks.prop(Material.WOOD).hardnessAndResistance(1.5F).sound(SoundType.WOOD).harvestLevel(0).harvestTool(ToolType.AXE));
this.setHardness(1.5F);
this.setSoundType(SoundType.WOOD);
this.setHarvestLevel("axe", 0);
MinecraftForge.TERRAIN_GEN_BUS.register(this); MinecraftForge.TERRAIN_GEN_BUS.register(this);
} }

View file

@ -1,61 +1,125 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.ModConfig; import de.ellpeck.naturesaura.NaturesAura;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.world.dimension.DimensionType; import net.minecraft.block.material.MaterialColor;
import net.minecraftforge.registries.ObjectHolder;
public final class ModBlocks { public class ModBlocks {
@ObjectHolder(NaturesAura.MOD_ID + ":ancient_log")
public static Block ANCIENT_LOG;
@ObjectHolder(NaturesAura.MOD_ID + ":ancient_bark")
public static Block ANCIENT_BARK;
@ObjectHolder(NaturesAura.MOD_ID + ":ancient_planks")
public static Block ANCIENT_PLANKS;
@ObjectHolder(NaturesAura.MOD_ID + ":ancient_stairs")
public static Block ANCIENT_STAIRS;
@ObjectHolder(NaturesAura.MOD_ID + ":ancient_slab")
public static Block ANCIENT_SLAB;
@ObjectHolder(NaturesAura.MOD_ID + ":ancient_leaves")
public static Block ANCIENT_LEAVES;
@ObjectHolder(NaturesAura.MOD_ID + ":ancient_sapling")
public static Block ANCIENT_SAPLING;
@ObjectHolder(NaturesAura.MOD_ID + ":nature_altar")
public static Block NATURE_ALTAR;
@ObjectHolder(NaturesAura.MOD_ID + ":decayed_leaves")
public static Block DECAYED_LEAVES;
@ObjectHolder(NaturesAura.MOD_ID + ":golden_leaves")
public static Block GOLDEN_LEAVES;
@ObjectHolder(NaturesAura.MOD_ID + ":gold_powder")
public static Block GOLD_POWDER;
@ObjectHolder(NaturesAura.MOD_ID + ":wood_stand")
public static Block WOOD_STAND;
@ObjectHolder(NaturesAura.MOD_ID + ":infused_stone")
public static Block INFUSED_STONE;
@ObjectHolder(NaturesAura.MOD_ID + ":infused_stairs")
public static Block INFUSED_STAIRS;
@ObjectHolder(NaturesAura.MOD_ID + ":infused_slab")
public static Block INFUSED_SLAB;
@ObjectHolder(NaturesAura.MOD_ID + ":infused_brick")
public static Block INFUSED_BRICK;
@ObjectHolder(NaturesAura.MOD_ID + ":infused_brick_stairs")
public static Block INFUSED_BRICK_STAIRS;
@ObjectHolder(NaturesAura.MOD_ID + ":infused_brick_slab")
public static Block INFUSED_BRICK_SLAB;
@ObjectHolder(NaturesAura.MOD_ID + ":furnace_heater")
public static Block FURNACE_HEATER;
@ObjectHolder(NaturesAura.MOD_ID + ":potion_generator")
public static Block POTION_GENERATOR;
@ObjectHolder(NaturesAura.MOD_ID + ":aura_detector")
public static Block AURA_DETECTOR;
@ObjectHolder(NaturesAura.MOD_ID + ":conversion_catalyst")
public static Block CONVERSION_CATALYST;
@ObjectHolder(NaturesAura.MOD_ID + ":crushing_catalyst")
public static Block CRUSHING_CATALYST;
@ObjectHolder(NaturesAura.MOD_ID + ":flower_generator")
public static Block FLOWER_GENERATOR;
@ObjectHolder(NaturesAura.MOD_ID + ":placer")
public static Block PLACER;
@ObjectHolder(NaturesAura.MOD_ID + ":hopper_upgrade")
public static Block HOPPER_UPGRADE;
@ObjectHolder(NaturesAura.MOD_ID + ":field_creator")
public static Block FIELD_CREATOR;
@ObjectHolder(NaturesAura.MOD_ID + ":oak_generator")
public static Block OAK_GENERATOR;
@ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_block")
public static Block INFUSED_IRON;
@ObjectHolder(NaturesAura.MOD_ID + ":offering_table")
public static Block OFFERING_TABLE;
@ObjectHolder(NaturesAura.MOD_ID + ":pickup_stopper")
public static Block PICKUP_STOPPER;
@ObjectHolder(NaturesAura.MOD_ID + ":spawn_lamp")
public static Block SPAWN_LAMP;
@ObjectHolder(NaturesAura.MOD_ID + ":animal_generator")
public static Block ANIMAL_GENERATOR;
@ObjectHolder(NaturesAura.MOD_ID + ":end_flower")
public static Block END_FLOWER;
@ObjectHolder(NaturesAura.MOD_ID + ":grated_chute")
public static Block GRATED_CHUTE;
@ObjectHolder(NaturesAura.MOD_ID + ":animal_spawner")
public static Block ANIMAL_SPAWNER;
@ObjectHolder(NaturesAura.MOD_ID + ":auto_crafter")
public static Block AUTO_CRAFTER;
@ObjectHolder(NaturesAura.MOD_ID + ":gold_brick")
public static Block GOLD_BRICK;
@ObjectHolder(NaturesAura.MOD_ID + ":rf_converter")
public static Block RF_CONVERTER;
@ObjectHolder(NaturesAura.MOD_ID + ":moss_generator")
public static Block MOSS_GENERATOR;
@ObjectHolder(NaturesAura.MOD_ID + ":time_changer")
public static Block TIME_CHANGER;
@ObjectHolder(NaturesAura.MOD_ID + ":generator_limit_remover")
public static Block GENERATOR_LIMIT_REMOVER;
@ObjectHolder(NaturesAura.MOD_ID + ":ender_crate")
public static Block ENDER_CRATE;
@ObjectHolder(NaturesAura.MOD_ID + ":powder_placer")
public static Block POWDER_PLACER;
@ObjectHolder(NaturesAura.MOD_ID + ":firework_generator")
public static Block FIREWORK_GENERATOR;
@ObjectHolder(NaturesAura.MOD_ID + ":projectile_generator")
public static Block PROJECTILE_GENERATOR;
@ObjectHolder(NaturesAura.MOD_ID + ":chunk_loader")
public static Block CHUNK_LOADER;
@ObjectHolder(NaturesAura.MOD_ID + ":dimentional_rail_overworld")
public static Block DIMENSION_RAIL_OVERWORLD;
@ObjectHolder(NaturesAura.MOD_ID + ":dimentional_rail_nether")
public static Block DIMENSION_RAIL_NETHER;
@ObjectHolder(NaturesAura.MOD_ID + ":dimentional_rail_end")
public static Block DIMENSION_RAIL_END;
public static Block.Properties prop(Material material, MaterialColor color) {
return Block.Properties.create(material, color);
}
public static Block.Properties prop(Material material) {
return Block.Properties.create(material);
}
public static Block.Properties prop(Block block) {
return Block.Properties.from(block);
}
public static final Block ANCIENT_LOG = new BlockAncientLog("ancient_log");
public static final Block ANCIENT_BARK = new BlockAncientLog("ancient_bark");
public static final Block ANCIENT_PLANKS = new BlockImpl("ancient_planks", Material.WOOD).setSoundType(SoundType.WOOD).setHardness(2F);
public static final Block ANCIENT_STAIRS = new BlockStairsNA("ancient_stairs", ANCIENT_PLANKS.getDefaultState());
public static final Block ANCIENT_SLAB = BlockSlabsNA.makeSlab("ancient_slab", Material.WOOD, SoundType.WOOD, 1.5F);
public static final Block ANCIENT_LEAVES = new BlockAncientLeaves();
public static final Block ANCIENT_SAPLING = new BlockAncientSapling();
public static final Block NATURE_ALTAR = new BlockNatureAltar();
public static final Block DECAYED_LEAVES = new BlockDecayedLeaves();
public static final Block GOLDEN_LEAVES = new BlockGoldenLeaves();
public static final Block GOLD_POWDER = new BlockGoldPowder();
public static final Block WOOD_STAND = new BlockWoodStand();
public static final Block INFUSED_STONE = new BlockImpl("infused_stone", Material.ROCK).setSoundType(SoundType.STONE).setHardness(1.75F);
public static final Block INFUSED_STAIRS = new BlockStairsNA("infused_stairs", INFUSED_STONE.getDefaultState());
public static final Block INFUSED_SLAB = BlockSlabsNA.makeSlab("infused_slab", Material.ROCK, SoundType.STONE, 1.25F);
public static final Block INFUSED_BRICK = new BlockImpl("infused_brick", Material.ROCK).setSoundType(SoundType.STONE).setHardness(1.5F);
public static final Block INFUSED_BRICK_STAIRS = new BlockStairsNA("infused_brick_stairs", INFUSED_BRICK.getDefaultState());
public static final Block INFUSED_BRICK_SLAB = BlockSlabsNA.makeSlab("infused_brick_slab", Material.ROCK, SoundType.STONE, 1.25F);
public static final Block FURNACE_HEATER = new BlockFurnaceHeater();
public static final Block POTION_GENERATOR = new BlockPotionGenerator();
public static final Block AURA_DETECTOR = new BlockAuraDetector();
public static final Block CONVERSION_CATALYST = new BlockImpl("conversion_catalyst", Material.ROCK).setSoundType(SoundType.STONE).setHardness(2.5F);
public static final Block CRUSHING_CATALYST = new BlockImpl("crushing_catalyst", Material.ROCK).setSoundType(SoundType.STONE).setHardness(2.5F);
public static final Block FLOWER_GENERATOR = new BlockFlowerGenerator();
public static final Block PLACER = new BlockPlacer();
public static final Block HOPPER_UPGRADE = new BlockHopperUpgrade();
public static final Block FIELD_CREATOR = new BlockFieldCreator();
public static final Block OAK_GENERATOR = new BlockOakGenerator();
public static final Block INFUSED_IRON = new BlockImpl("infused_iron_block", Material.IRON).setSoundType(SoundType.METAL).setHardness(3F);
public static final Block OFFERING_TABLE = new BlockOfferingTable();
public static final Block PICKUP_STOPPER = new BlockPickupStopper();
public static final Block SPAWN_LAMP = new BlockSpawnLamp();
public static final Block ANIMAL_GENERATOR = new BlockAnimalGenerator();
public static final Block END_FLOWER = new BlockEndFlower();
public static final Block GRATED_CHUTE = new BlockGratedChute();
public static final Block ANIMAL_SPAWNER = new BlockAnimalSpawner();
public static final Block AUTO_CRAFTER = new BlockAutoCrafter();
public static final Block GOLD_BRICK = new BlockImpl("gold_brick", Material.ROCK).setSoundType(SoundType.STONE).setHardness(2F);
public static final Block RF_CONVERTER = ModConfig.enabledFeatures.rfConverter ? new BlockRFConverter() : null;
public static final Block MOSS_GENERATOR = new BlockMossGenerator();
public static final Block TIME_CHANGER = new BlockTimeChanger();
public static final Block GENERATOR_LIMIT_REMOVER = new BlockGeneratorLimitRemover();
public static final Block ENDER_CRATE = new BlockEnderCrate();
public static final Block POWDER_PLACER = new BlockPowderPlacer();
public static final Block FIREWORK_GENERATOR = new BlockFireworkGenerator();
public static final Block PROJECTILE_GENERATOR = new BlockProjectileGenerator();
public static final Block CHUNK_LOADER = ModConfig.enabledFeatures.chunkLoader ? new BlockChunkLoader() : null;
public static final Block DIMENSION_RAIL_OVERWORLD = new BlockDimensionRail("overworld", DimensionType.OVERWORLD, DimensionType.NETHER, DimensionType.THE_END);
public static final Block DIMENSION_RAIL_NETHER = new BlockDimensionRail("nether", DimensionType.NETHER, DimensionType.OVERWORLD);
public static final Block DIMENSION_RAIL_END = new BlockDimensionRail("end", DimensionType.THE_END, DimensionType.OVERWORLD);
} }

View file

@ -0,0 +1,20 @@
package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider;
import net.minecraft.block.SlabBlock;
public class Slab extends SlabBlock implements IModItem, IModelProvider {
private final String baseName;
public Slab(String baseName, Properties properties) {
super(properties);
this.baseName = baseName;
}
@Override
public String getBaseName() {
return this.baseName;
}
}

View file

@ -6,7 +6,7 @@ import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.misc.IWorldData; import de.ellpeck.naturesaura.api.misc.IWorldData;
import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.api.render.IVisualizable;
import de.ellpeck.naturesaura.items.ItemEffectPowder; import de.ellpeck.naturesaura.items.EffectPowder;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.misc.WorldData; import de.ellpeck.naturesaura.misc.WorldData;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
@ -42,7 +42,7 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
} }
public static void place(World world, ItemStack stack, double posX, double posY, double posZ) { public static void place(World world, ItemStack stack, double posX, double posY, double posZ) {
ResourceLocation effect = ItemEffectPowder.getEffect(stack); ResourceLocation effect = EffectPowder.getEffect(stack);
EntityEffectInhibitor entity = new EntityEffectInhibitor(world); EntityEffectInhibitor entity = new EntityEffectInhibitor(world);
entity.setInhibitedEffect(effect); entity.setInhibitedEffect(effect);
entity.setColor(NaturesAuraAPI.EFFECT_POWDERS.get(effect)); entity.setColor(NaturesAuraAPI.EFFECT_POWDERS.get(effect));
@ -152,7 +152,7 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
} }
public ItemStack getDrop() { public ItemStack getDrop() {
return ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, this.getAmount()), this.getInhibitedEffect()); return EffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, this.getAmount()), this.getInhibitedEffect());
} }
public void setInhibitedEffect(ResourceLocation effect) { public void setInhibitedEffect(ResourceLocation effect) {

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.entities.render;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.entities.EntityEffectInhibitor; import de.ellpeck.naturesaura.entities.EntityEffectInhibitor;
import de.ellpeck.naturesaura.items.ItemEffectPowder; import de.ellpeck.naturesaura.items.EffectPowder;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRenderer;
@ -42,7 +42,7 @@ public class RenderEffectInhibitor extends EntityRenderer<EntityEffectInhibitor>
GlStateManager.scale(0.5F, 0.5F, 0.5F); GlStateManager.scale(0.5F, 0.5F, 0.5F);
ResourceLocation effect = entity.getInhibitedEffect(); ResourceLocation effect = entity.getInhibitedEffect();
Helper.renderItemInWorld(this.items.computeIfAbsent(effect, Helper.renderItemInWorld(this.items.computeIfAbsent(effect,
res -> ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER), effect))); res -> EffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER), effect)));
GlStateManager.popMatrix(); GlStateManager.popMatrix();
} }
} }

View file

@ -9,14 +9,12 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer; import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.api.render.IVisualizable;
import de.ellpeck.naturesaura.blocks.BlockDimensionRail;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityGratedChute; import de.ellpeck.naturesaura.blocks.tiles.TileEntityGratedChute;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar; import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityRFConverter; import de.ellpeck.naturesaura.blocks.tiles.TileEntityRFConverter;
import de.ellpeck.naturesaura.compat.Compat; import de.ellpeck.naturesaura.compat.Compat;
import de.ellpeck.naturesaura.compat.patchouli.PatchouliCompat; import de.ellpeck.naturesaura.items.AuraCache;
import de.ellpeck.naturesaura.items.ItemAuraCache; import de.ellpeck.naturesaura.items.RangeVisualizer;
import de.ellpeck.naturesaura.items.ItemRangeVisualizer;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.particles.ParticleHandler; import de.ellpeck.naturesaura.particles.ParticleHandler;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -25,11 +23,9 @@ import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.AbstractGui; import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.screen.ChatScreen; import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.ScaledResolution;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.item.Items; import net.minecraft.item.Items;
@ -43,13 +39,11 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeColors; import net.minecraft.world.biome.BiomeColors;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.IPlantable;
import net.minecraftforge.energy.EnergyStorage; import net.minecraftforge.energy.EnergyStorage;
import net.minecraftforge.fml.client.config.GuiUtils;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
@ -121,7 +115,7 @@ public class ClientEvents {
Minecraft mc = Minecraft.getMinecraft(); Minecraft mc = Minecraft.getMinecraft();
if (mc.world == null) { if (mc.world == null) {
ParticleHandler.clearParticles(); ParticleHandler.clearParticles();
ItemRangeVisualizer.clear(); RangeVisualizer.clear();
} else if (!mc.isGamePaused()) { } else if (!mc.isGamePaused()) {
if (mc.world.getTotalWorldTime() % 20 == 0) { if (mc.world.getTotalWorldTime() % 20 == 0) {
mc.profiler.func_194340_a(() -> NaturesAura.MOD_ID + ":spawnExcessParticles"); mc.profiler.func_194340_a(() -> NaturesAura.MOD_ID + ":spawnExcessParticles");
@ -158,7 +152,7 @@ public class ClientEvents {
NaturesAuraAPI.IInternalHooks inst = NaturesAuraAPI.instance(); NaturesAuraAPI.IInternalHooks inst = NaturesAuraAPI.instance();
inst.setParticleSpawnRange(512); inst.setParticleSpawnRange(512);
inst.setParticleDepth(false); inst.setParticleDepth(false);
for (BlockPos pos : ItemRangeVisualizer.VISUALIZED_RAILS.get(mc.world.provider.getDimension())) { for (BlockPos pos : RangeVisualizer.VISUALIZED_RAILS.get(mc.world.provider.getDimension())) {
NaturesAuraAPI.instance().spawnMagicParticle( NaturesAuraAPI.instance().spawnMagicParticle(
pos.getX() + mc.world.rand.nextFloat(), pos.getX() + mc.world.rand.nextFloat(),
pos.getY() + mc.world.rand.nextFloat(), pos.getY() + mc.world.rand.nextFloat(),
@ -178,7 +172,7 @@ public class ClientEvents {
for (int i = 0; i < baubles.getSlots(); i++) { for (int i = 0; i < baubles.getSlots(); i++) {
ItemStack slot = baubles.getStackInSlot(i); ItemStack slot = baubles.getStackInSlot(i);
if (!slot.isEmpty()) { if (!slot.isEmpty()) {
if (slot.getItem() instanceof ItemAuraCache) if (slot.getItem() instanceof AuraCache)
heldCache = slot; heldCache = slot;
else if (slot.getItem() == ModItems.EYE) else if (slot.getItem() == ModItems.EYE)
heldEye = slot; heldEye = slot;
@ -191,7 +185,7 @@ public class ClientEvents {
for (int i = 0; i < mc.player.inventory.getSizeInventory(); i++) { for (int i = 0; i < mc.player.inventory.getSizeInventory(); i++) {
ItemStack slot = mc.player.inventory.getStackInSlot(i); ItemStack slot = mc.player.inventory.getStackInSlot(i);
if (!slot.isEmpty()) { if (!slot.isEmpty()) {
if (slot.getItem() instanceof ItemAuraCache) if (slot.getItem() instanceof AuraCache)
heldCache = slot; heldCache = slot;
else if (slot.getItem() == ModItems.EYE && i <= 8) else if (slot.getItem() == ModItems.EYE && i <= 8)
heldEye = slot; heldEye = slot;
@ -262,7 +256,7 @@ public class ClientEvents {
GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_BLEND);
GL11.glBegin(GL11.GL_QUADS); GL11.glBegin(GL11.GL_QUADS);
for (BlockPos pos : ItemRangeVisualizer.VISUALIZED_BLOCKS.get(dim)) { for (BlockPos pos : RangeVisualizer.VISUALIZED_BLOCKS.get(dim)) {
if (!mc.world.isBlockLoaded(pos)) if (!mc.world.isBlockLoaded(pos))
continue; continue;
BlockState state = mc.world.getBlockState(pos); BlockState state = mc.world.getBlockState(pos);
@ -271,7 +265,7 @@ public class ClientEvents {
continue; continue;
this.renderVisualize((IVisualizable) block, mc.world, pos); this.renderVisualize((IVisualizable) block, mc.world, pos);
} }
for (Entity entity : ItemRangeVisualizer.VISUALIZED_ENTITIES.get(dim)) { for (Entity entity : RangeVisualizer.VISUALIZED_ENTITIES.get(dim)) {
if (entity.isDead || !(entity instanceof IVisualizable)) if (entity.isDead || !(entity instanceof IVisualizable))
continue; continue;
this.renderVisualize((IVisualizable) entity, mc.world, entity.getPosition()); this.renderVisualize((IVisualizable) entity, mc.world, entity.getPosition());

View file

@ -1,5 +1,6 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.api.aura.type.IAuraType;
@ -8,19 +9,18 @@ import net.minecraft.block.DispenserBlock;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.dispenser.DefaultDispenseItemBehavior;
import net.minecraft.dispenser.IBlockSource;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.SoundEvents; import net.minecraft.util.SoundEvents;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.client.resources.I18n; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@ -28,25 +28,25 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem { import static net.minecraft.dispenser.DefaultDispenseItemBehavior.doDispense;
public ItemAuraBottle() { public class AuraBottle extends ItemImpl implements IColorProvidingItem {
super("aura_bottle");
public AuraBottle() {
super("aura_bottle", new Properties().group(NaturesAura.CREATIVE_TAB));
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
DispenserBlock.DISPENSE_BEHAVIOR_REGISTRY.putObject(ModItems.BOTTLE_TWO, new DefaultDispenseItemBehavior() { DispenserBlock.registerDispenseBehavior(ModItems.BOTTLE_TWO, (source, stack) -> {
@Override
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
World world = source.getWorld(); World world = source.getWorld();
BlockState state = source.getBlockState(); BlockState state = source.getBlockState();
Direction facing = state.getValue(DispenserBlock.FACING); Direction facing = state.get(DispenserBlock.FACING);
BlockPos offset = source.getBlockPos().offset(facing); BlockPos offset = source.getBlockPos().offset(facing);
BlockState offsetState = world.getBlockState(offset); BlockState offsetState = world.getBlockState(offset);
ItemStack dispense = stack.splitStack(1); ItemStack dispense = stack.split(1);
if (offsetState.getBlock().isAir(offsetState, world, offset)) { if (offsetState.getBlock().isAir(offsetState, world, offset)) {
if (IAuraChunk.getAuraInArea(world, offset, 30) >= 100000) { if (IAuraChunk.getAuraInArea(world, offset, 30) >= 100000) {
dispense = setType(new ItemStack(ItemAuraBottle.this), IAuraType.forWorld(world)); dispense = setType(new ItemStack(AuraBottle.this), IAuraType.forWorld(world));
BlockPos spot = IAuraChunk.getHighestSpot(world, offset, 30, offset); BlockPos spot = IAuraChunk.getHighestSpot(world, offset, 30, offset);
IAuraChunk.getAuraChunk(world, spot).drainAura(spot, 20000); IAuraChunk.getAuraChunk(world, spot).drainAura(spot, 20000);
@ -55,7 +55,6 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem {
doDispense(world, dispense, 6, facing, DispenserBlock.getDispensePosition(source)); doDispense(world, dispense, 6, facing, DispenserBlock.getDispensePosition(source));
return stack; return stack;
}
}); });
} }
@ -64,9 +63,9 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem {
ItemStack held = event.getItemStack(); ItemStack held = event.getItemStack();
if (held.isEmpty() || held.getItem() != ModItems.BOTTLE_TWO) if (held.isEmpty() || held.getItem() != ModItems.BOTTLE_TWO)
return; return;
PlayerEntity player = event.getEntityPlayer(); PlayerEntity player = event.getPlayer();
RayTraceResult ray = this.rayTrace(player.world, player, true); RayTraceResult ray = rayTrace(player.world, player, RayTraceContext.FluidMode.NONE);
if (ray != null && ray.typeOfHit == RayTraceResult.Type.BLOCK) if (ray.getType() == RayTraceResult.Type.BLOCK)
return; return;
BlockPos pos = player.getPosition(); BlockPos pos = player.getPosition();
if (IAuraChunk.getAuraInArea(player.world, pos, 30) < 100000) if (IAuraChunk.getAuraInArea(player.world, pos, 30) < 100000)
@ -88,8 +87,8 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem {
} }
@Override @Override
public void getSubItems(ItemGroup tab, NonNullList<ItemStack> items) { public void fillItemGroup(ItemGroup tab, NonNullList<ItemStack> items) {
if (this.isInCreativeTab(tab)) { if (this.isInGroup(tab)) {
for (IAuraType type : NaturesAuraAPI.AURA_TYPES.values()) { for (IAuraType type : NaturesAuraAPI.AURA_TYPES.values()) {
ItemStack stack = new ItemStack(this); ItemStack stack = new ItemStack(this);
setType(stack, type); setType(stack, type);
@ -99,23 +98,21 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem {
} }
@Override @Override
public String getItemStackDisplayName(ItemStack stack) { public ITextComponent getDisplayName(ItemStack stack) {
return I18n.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + "." + getType(stack).getName() + ".name").trim(); return new TranslationTextComponent(stack.getTranslationKey() + "." + getType(stack).getName() + ".name");
} }
public static IAuraType getType(ItemStack stack) { public static IAuraType getType(ItemStack stack) {
if (!stack.hasTagCompound()) if (!stack.hasTag())
return NaturesAuraAPI.TYPE_OTHER; return NaturesAuraAPI.TYPE_OTHER;
String type = stack.getTagCompound().getString("stored_type"); String type = stack.getTag().getString("stored_type");
if (type.isEmpty()) if (type.isEmpty())
return NaturesAuraAPI.TYPE_OTHER; return NaturesAuraAPI.TYPE_OTHER;
return NaturesAuraAPI.AURA_TYPES.get(new ResourceLocation(type)); return NaturesAuraAPI.AURA_TYPES.get(new ResourceLocation(type));
} }
public static ItemStack setType(ItemStack stack, IAuraType type) { public static ItemStack setType(ItemStack stack, IAuraType type) {
if (!stack.hasTagCompound()) stack.getOrCreateTag().putString("stored_type", type.getName().toString());
stack.setTagCompound(new CompoundNBT());
stack.getTagCompound().setString("stored_type", type.getName().toString());
return stack; return stack;
} }

View file

@ -1,6 +1,7 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer; import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
import de.ellpeck.naturesaura.api.aura.container.ItemAuraContainer; import de.ellpeck.naturesaura.api.aura.container.ItemAuraContainer;
@ -20,49 +21,52 @@ import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.util.LazyOptional;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class ItemAuraCache extends ItemImpl implements ITrinketItem { public class AuraCache extends ItemImpl implements ITrinketItem {
private final int capacity; private final int capacity;
public ItemAuraCache(String name, int capacity) { public AuraCache(String name, int capacity) {
super(name); super(name, new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB));
this.capacity = capacity; this.capacity = capacity;
this.setMaxStackSize(1);
} }
@Override @Override
public void onUpdate(ItemStack stackIn, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { public void inventoryTick(ItemStack stackIn, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (!worldIn.isRemote && entityIn instanceof PlayerEntity) { if (!worldIn.isRemote && entityIn instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) entityIn; PlayerEntity player = (PlayerEntity) entityIn;
if (player.isSneaking()) { if (player.isSneaking() && stackIn.getCapability(NaturesAuraAPI.capAuraContainer).isPresent()) {
IAuraContainer container = stackIn.getCapability(NaturesAuraAPI.capAuraContainer, null); IAuraContainer container = stackIn.getCapability(NaturesAuraAPI.capAuraContainer).orElse(null);
if (container.getStoredAura() <= 0) if (container.getStoredAura() <= 0) {
return; return;
}
for (int i = 0; i < player.inventory.getSizeInventory(); i++) { for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack stack = player.inventory.getStackInSlot(i); ItemStack stack = player.inventory.getStackInSlot(i);
if (stack.hasCapability(NaturesAuraAPI.capAuraRecharge, null)) { if (stack.getCapability(NaturesAuraAPI.capAuraRecharge).isPresent()) {
IAuraRecharge recharge = stack.getCapability(NaturesAuraAPI.capAuraRecharge, null); IAuraRecharge recharge = stack.getCapability(NaturesAuraAPI.capAuraRecharge).orElse(null);
if (recharge.rechargeFromContainer(container, itemSlot, i, player.inventory.currentItem == i)) if (recharge.rechargeFromContainer(container, itemSlot, i, player.inventory.currentItem == i)) {
break; break;
} }
} }
} }
} }
} }
}
@Override @Override
public void getSubItems(ItemGroup tab, NonNullList<ItemStack> items) { public void fillItemGroup(ItemGroup tab, NonNullList<ItemStack> items) {
if (this.isInCreativeTab(tab)) { if (this.isInGroup(tab)) {
items.add(new ItemStack(this)); items.add(new ItemStack(this));
ItemStack stack = new ItemStack(this); ItemStack stack = new ItemStack(this);
IAuraContainer container = stack.getCapability(NaturesAuraAPI.capAuraContainer, null); stack.getCapability(NaturesAuraAPI.capAuraContainer).ifPresent(container -> {
container.storeAura(container.getMaxAura(), false); container.storeAura(container.getMaxAura(), false);
items.add(stack); items.add(stack);
});
} }
} }
@ -73,32 +77,26 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
@Override @Override
public double getDurabilityForDisplay(ItemStack stack) { public double getDurabilityForDisplay(ItemStack stack) {
if (stack.hasCapability(NaturesAuraAPI.capAuraContainer, null)) { if (stack.getCapability(NaturesAuraAPI.capAuraContainer).isPresent()) {
IAuraContainer container = stack.getCapability(NaturesAuraAPI.capAuraContainer, null); IAuraContainer container = stack.getCapability(NaturesAuraAPI.capAuraContainer).orElse(null);
return 1 - container.getStoredAura() / (double) container.getMaxAura(); return 1 - container.getStoredAura() / (double) container.getMaxAura();
} else {
return 0;
} }
return 0;
} }
@Nullable @Nullable
@Override @Override
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) {
return new ICapabilityProvider() { return new ICapabilityProvider() {
private final ItemAuraContainer container = new ItemAuraContainer(stack, null, ItemAuraCache.this.capacity); private final ItemAuraContainer container = new ItemAuraContainer(stack, null, AuraCache.this.capacity);
@Nonnull
@Override @Override
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable Direction facing) { public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> capability, @Nullable Direction facing) {
return capability == NaturesAuraAPI.capAuraContainer;
}
@Nullable
@Override
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable Direction facing) {
if (capability == NaturesAuraAPI.capAuraContainer) { if (capability == NaturesAuraAPI.capAuraContainer) {
return (T) this.container; return LazyOptional.of(() -> (T) this.container);
} else { } else {
return null; return LazyOptional.empty();
} }
} }
}; };
@ -110,9 +108,9 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
if (type == RenderType.BODY && !isHolding) { if (type == RenderType.BODY && !isHolding) {
boolean chest = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty(); boolean chest = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty();
boolean legs = !player.inventory.armorInventory.get(EquipmentSlotType.LEGS.getIndex()).isEmpty(); boolean legs = !player.inventory.armorInventory.get(EquipmentSlotType.LEGS.getIndex()).isEmpty();
GlStateManager.translate(-0.15F, 0.65F, chest ? -0.195F : (legs ? -0.165F : -0.1475F)); GlStateManager.translatef(-0.15F, 0.65F, chest ? -0.195F : (legs ? -0.165F : -0.1475F));
GlStateManager.scale(0.25F, 0.25F, 0.25F); GlStateManager.scalef(0.25F, 0.25F, 0.25F);
GlStateManager.rotate(180F, 1F, 0F, 0F); GlStateManager.rotatef(180F, 1F, 0F, 0F);
Helper.renderItemInWorld(stack); Helper.renderItemInWorld(stack);
} }
} }

View file

@ -9,8 +9,8 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.BabyEntitySpawnEvent; import net.minecraftforge.event.entity.living.BabyEntitySpawnEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
public class ItemBirthSpirit extends ItemGlowing { public class BirthSpirit extends Glowing {
public ItemBirthSpirit() { public BirthSpirit() {
super("birth_spirit"); super("birth_spirit");
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
} }
@ -27,7 +27,7 @@ public class ItemBirthSpirit extends ItemGlowing {
int amount = parent.world.rand.nextInt(3) + 1; int amount = parent.world.rand.nextInt(3) + 1;
ItemEntity item = new ItemEntity(parent.world, parent.posX, parent.posY, parent.posZ, ItemEntity item = new ItemEntity(parent.world, parent.posX, parent.posY, parent.posZ,
new ItemStack(ModItems.BIRTH_SPIRIT, amount)); new ItemStack(ModItems.BIRTH_SPIRIT, amount));
parent.world.spawnEntity(item); parent.world.addEntity(item);
BlockPos spot = IAuraChunk.getHighestSpot(parent.world, pos, 30, pos); BlockPos spot = IAuraChunk.getHighestSpot(parent.world, pos, 30, pos);
IAuraChunk.getAuraChunk(parent.world, spot).drainAura(spot, 800 * amount); IAuraChunk.getAuraChunk(parent.world, spot).drainAura(spot, 800 * amount);

View file

@ -1,7 +1,9 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.EntitySpawnPlacementRegistry;
import net.minecraft.entity.MobEntity; import net.minecraft.entity.MobEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -12,10 +14,9 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.LightType; import net.minecraft.world.LightType;
import net.minecraft.world.World; import net.minecraft.world.World;
public class ItemCaveFinder extends ItemImpl { public class CaveFinder extends ItemImpl {
public ItemCaveFinder() { public CaveFinder() {
super("cave_finder"); super("cave_finder", new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB));
this.setMaxStackSize(1);
} }
@Override @Override
@ -34,12 +35,12 @@ public class ItemCaveFinder extends ItemImpl {
for (int z = -range; z <= range; z++) { for (int z = -range; z <= range; z++) {
BlockPos offset = pos.add(x, y, z); BlockPos offset = pos.add(x, y, z);
BlockState state = worldIn.getBlockState(offset); BlockState state = worldIn.getBlockState(offset);
if (!state.getBlock().canCreatureSpawn(state, worldIn, offset, MobEntity.SpawnPlacementType.ON_GROUND)) if (!state.getBlock().canCreatureSpawn(state, worldIn, offset, EntitySpawnPlacementRegistry.PlacementType.ON_GROUND, null))
continue; continue;
BlockPos offUp = offset.up(); BlockPos offUp = offset.up();
BlockState stateUp = worldIn.getBlockState(offUp); BlockState stateUp = worldIn.getBlockState(offUp);
if (stateUp.isBlockNormalCube() || stateUp.getMaterial().isLiquid()) if (stateUp.isNormalCube(worldIn, offUp) || stateUp.getMaterial().isLiquid())
continue; continue;
int sky = worldIn.getLightFor(LightType.SKY, offUp); int sky = worldIn.getLightFor(LightType.SKY, offUp);

View file

@ -1,28 +1,25 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.reg.IColorProvidingItem; import de.ellpeck.naturesaura.reg.IColorProvidingItem;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.SoundEvents;
import net.minecraft.item.DyeColor; import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.item.ItemUseContext;
import net.minecraft.state.IProperty;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
public class ItemColorChanger extends ItemImpl implements IColorProvidingItem { public class ColorChanger extends ItemImpl implements IColorProvidingItem {
public ItemColorChanger() { public ColorChanger() {
super("color_changer"); super("color_changer", new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB));
this.setMaxStackSize(1);
this.addPropertyOverride(new ResourceLocation(NaturesAura.MOD_ID, "fill_mode"), this.addPropertyOverride(new ResourceLocation(NaturesAura.MOD_ID, "fill_mode"),
(stack, worldIn, entityIn) -> isFillMode(stack) ? 1F : 0F); (stack, worldIn, entityIn) -> isFillMode(stack) ? 1F : 0F);
@ -31,20 +28,20 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem {
} }
@Override @Override
public EnumActionResult onItemUse(PlayerEntity player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { public ActionResultType onItemUse(ItemUseContext context) {
ItemStack stack = player.getHeldItem(hand); ItemStack stack = context.getPlayer().getHeldItem(context.getHand());
if (changeOrCopyColor(player, stack, worldIn, pos, null)) { if (changeOrCopyColor(context.getPlayer(), stack, context.getWorld(), context.getPos(), null)) {
return EnumActionResult.SUCCESS; return ActionResultType.SUCCESS;
} else { } else {
return EnumActionResult.PASS; return ActionResultType.PASS;
} }
} }
private static boolean changeOrCopyColor(PlayerEntity player, ItemStack stack, World world, BlockPos pos, DyeColor firstColor) { private static boolean changeOrCopyColor(PlayerEntity player, ItemStack stack, World world, BlockPos pos, DyeColor firstColor) {
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
for (IProperty prop : state.getProperties().keySet()) { for (IProperty prop : state.getProperties()) {
if (prop.getValueClass() == DyeColor.class) { if (prop.getValueClass() == DyeColor.class) {
DyeColor color = (DyeColor) state.getValue(prop); DyeColor color = (DyeColor) state.get(prop);
if (firstColor == null || color == firstColor) { if (firstColor == null || color == firstColor) {
DyeColor stored = getStoredColor(stack); DyeColor stored = getStoredColor(stack);
if (player.isSneaking()) { if (player.isSneaking()) {
@ -63,10 +60,10 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem {
SoundEvents.ITEM_BUCKET_EMPTY, SoundCategory.PLAYERS, 0.65F, 1F); SoundEvents.ITEM_BUCKET_EMPTY, SoundCategory.PLAYERS, 0.65F, 1F);
} }
if (!world.isRemote) { if (!world.isRemote) {
world.setBlockState(pos, state.withProperty(prop, stored)); world.setBlockState(pos, state.with(prop, stored));
if (isFillMode(stack)) { if (isFillMode(stack)) {
for (EnumFacing off : EnumFacing.VALUES) { for (Direction off : Direction.values()) {
changeOrCopyColor(player, stack, world, pos.offset(off), color); changeOrCopyColor(player, stack, world, pos.offset(off), color);
} }
} }
@ -82,49 +79,43 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem {
} }
@Override @Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, EnumHand handIn) { public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
ItemStack stack = playerIn.getHeldItem(handIn); ItemStack stack = playerIn.getHeldItem(handIn);
if (playerIn.isSneaking() && getStoredColor(stack) != null) { if (playerIn.isSneaking() && getStoredColor(stack) != null) {
worldIn.playSound(playerIn, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.PLAYERS, 0.65F, 1F); worldIn.playSound(playerIn, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.PLAYERS, 0.65F, 1F);
if (!worldIn.isRemote) { if (!worldIn.isRemote) {
setFillMode(stack, !isFillMode(stack)); setFillMode(stack, !isFillMode(stack));
} }
return new ActionResult<>(EnumActionResult.SUCCESS, stack); return new ActionResult<>(ActionResultType.SUCCESS, stack);
} else { } else {
return new ActionResult<>(EnumActionResult.PASS, stack); return new ActionResult<>(ActionResultType.PASS, stack);
} }
} }
private static DyeColor getStoredColor(ItemStack stack) { private static DyeColor getStoredColor(ItemStack stack) {
if (!stack.hasTagCompound()) { if (!stack.hasTag()) {
return null; return null;
} else { } else {
int color = stack.getTagCompound().getInteger("color"); int color = stack.getTag().getInt("color");
return DyeColor.byMetadata(color); return DyeColor.byId(color);
} }
} }
private static void storeColor(ItemStack stack, DyeColor color) { private static void storeColor(ItemStack stack, DyeColor color) {
if (!stack.hasTagCompound()) { stack.getOrCreateTag().putInt("color", color.getId());
stack.setTagCompound(new CompoundNBT());
}
stack.getTagCompound().setInteger("color", color.getMetadata());
} }
private static boolean isFillMode(ItemStack stack) { private static boolean isFillMode(ItemStack stack) {
if (!stack.hasTagCompound()) { if (!stack.hasTag()) {
return false; return false;
} else { } else {
return stack.getTagCompound().getBoolean("fill"); return stack.getTag().getBoolean("fill");
} }
} }
private static void setFillMode(ItemStack stack, boolean fill) { private static void setFillMode(ItemStack stack, boolean fill) {
if (!stack.hasTagCompound()) { stack.getOrCreateTag().putBoolean("fill", fill);
stack.setTagCompound(new CompoundNBT());
}
stack.getTagCompound().setBoolean("fill", fill);
} }
@Override @Override

View file

@ -0,0 +1,76 @@
package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.entities.EntityEffectInhibitor;
import de.ellpeck.naturesaura.reg.IColorProvidingItem;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class EffectPowder extends ItemImpl implements IColorProvidingItem {
public EffectPowder() {
super("effect_powder", new Properties().group(NaturesAura.CREATIVE_TAB));
}
@Override
public ActionResultType onItemUse(ItemUseContext context) {
World world = context.getWorld();
if (!world.isRemote) {
BlockPos pos = context.getPos();
Vec3d hit = context.getHitVec();
ItemStack stack = context.getPlayer().getHeldItem(context.getHand());
EntityEffectInhibitor.place(world, stack, pos.getX() + hit.x, pos.getY() + hit.y + 1, pos.getZ() + hit.z);
stack.setCount(0);
}
return ActionResultType.SUCCESS;
}
@Override
public void fillItemGroup(ItemGroup tab, NonNullList<ItemStack> items) {
if (this.isInGroup(tab)) {
for (ResourceLocation effect : NaturesAuraAPI.EFFECT_POWDERS.keySet()) {
ItemStack stack = new ItemStack(this);
setEffect(stack, effect);
items.add(stack);
}
}
}
@Override
public ITextComponent getDisplayName(ItemStack stack) {
return new TranslationTextComponent(this.getTranslationKey(stack) + "." + getEffect(stack) + ".name");
}
public static ResourceLocation getEffect(ItemStack stack) {
if (!stack.hasTag())
return null;
String effect = stack.getTag().getString("effect");
if (effect.isEmpty())
return null;
return new ResourceLocation(effect);
}
public static ItemStack setEffect(ItemStack stack, ResourceLocation effect) {
stack.getOrCreateTag().putString("effect", effect.toString());
return stack;
}
@Override
@OnlyIn(Dist.CLIENT)
public IItemColor getItemColor() {
return (stack, tintIndex) -> NaturesAuraAPI.EFFECT_POWDERS.getOrDefault(getEffect(stack), 0xFFFFFF);
}
}

View file

@ -10,6 +10,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType; import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -17,9 +18,9 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
public class ItemEnderAccess extends ItemImpl { public class EnderAccess extends ItemImpl {
public ItemEnderAccess() { public EnderAccess() {
super("ender_access"); super("ender_access", new Properties().group(NaturesAura.CREATIVE_TAB));
} }
@Override @Override
@ -29,15 +30,16 @@ public class ItemEnderAccess extends ItemImpl {
ItemStack stack = playerIn.getHeldItemMainhand(); ItemStack stack = playerIn.getHeldItemMainhand();
if (!Strings.isNullOrEmpty(BlockEnderCrate.getEnderName(stack))) { if (!Strings.isNullOrEmpty(BlockEnderCrate.getEnderName(stack))) {
if (!worldIn.isRemote && NaturesAuraAPI.instance().extractAuraFromPlayer(playerIn, 10000, false)) if (!worldIn.isRemote && NaturesAuraAPI.instance().extractAuraFromPlayer(playerIn, 10000, false))
playerIn.openGui(NaturesAura.MOD_ID, 1, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ); // TODO playerIn.openGui(NaturesAura.MOD_ID, 1, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ);
return new ActionResult<>(ActionResultType.SUCCESS, stack); return new ActionResult<>(ActionResultType.SUCCESS, stack);
} }
return new ActionResult<>(ActionResultType.FAIL, stack); return new ActionResult<>(ActionResultType.FAIL, stack);
} }
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
BlockEnderCrate.addEnderNameInfo(stack, tooltip); BlockEnderCrate.addEnderNameInfo(stack, tooltip);
} }
} }

View file

@ -1,6 +1,7 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.render.ITrinketItem; import de.ellpeck.naturesaura.api.render.ITrinketItem;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -9,11 +10,10 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
public class ItemEye extends ItemImpl implements ITrinketItem { public class Eye extends ItemImpl implements ITrinketItem {
public ItemEye(String name) { public Eye(String name) {
super(name); super(name, new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB));
this.setMaxStackSize(1);
} }
@Override @Override
@ -21,9 +21,9 @@ public class ItemEye extends ItemImpl implements ITrinketItem {
public void render(ItemStack stack, PlayerEntity player, RenderType type, boolean isHolding) { public void render(ItemStack stack, PlayerEntity player, RenderType type, boolean isHolding) {
if (type == RenderType.BODY && !isHolding) { if (type == RenderType.BODY && !isHolding) {
boolean armor = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty(); boolean armor = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty();
GlStateManager.translate(0.1F, 0.225F, armor ? -0.195F : -0.1475F); GlStateManager.translatef(0.1F, 0.225F, armor ? -0.195F : -0.1475F);
GlStateManager.scale(0.15F, 0.15F, 0.15F); GlStateManager.scalef(0.15F, 0.15F, 0.15F);
GlStateManager.rotate(180F, 1F, 0F, 0F); GlStateManager.rotatef(180F, 1F, 0F, 0F);
Helper.renderItemInWorld(stack); Helper.renderItemInWorld(stack);
} }
} }

View file

@ -1,12 +1,14 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.NaturesAura;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
public class ItemGlowing extends ItemImpl { // Name (Glowing) ambiguous?
public ItemGlowing(String baseName) { public class Glowing extends ItemImpl {
super(baseName); public Glowing(String baseName) {
super(baseName, new Properties().group(NaturesAura.CREATIVE_TAB));
} }
@Override @Override

View file

@ -1,20 +1,22 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.blocks.BlockGoldenLeaves; import de.ellpeck.naturesaura.blocks.BlockGoldenLeaves;
import de.ellpeck.naturesaura.reg.IColorProvidingItem; import de.ellpeck.naturesaura.reg.IColorProvidingItem;
import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.util.ActionResultType; import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class ItemGoldFiber extends ItemImpl implements IColorProvidingItem { public class GoldFiber extends ItemImpl implements IColorProvidingItem {
public ItemGoldFiber() { public GoldFiber() {
super("gold_fiber"); super("gold_fiber", new Properties().group(NaturesAura.CREATIVE_TAB));
} }
@Override @Override
@ -23,10 +25,10 @@ public class ItemGoldFiber extends ItemImpl implements IColorProvidingItem {
} }
@Override @Override
public ActionResultType onItemUse(PlayerEntity player, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { public ActionResultType onItemUse(ItemUseContext context) {
ItemStack stack = player.getHeldItem(hand); ItemStack stack = context.getPlayer().getHeldItem(context.getHand());
if (BlockGoldenLeaves.convert(worldIn, pos)) { if (BlockGoldenLeaves.convert(context.getWorld(), context.getPos())) {
if (!worldIn.isRemote) { if (!context.getWorld().isRemote) {
stack.shrink(1); stack.shrink(1);
} }
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;

View file

@ -1,71 +0,0 @@
package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.entities.EntityEffectInhibitor;
import de.ellpeck.naturesaura.reg.IColorProvidingItem;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.ItemGroup;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.client.resources.I18n;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class ItemEffectPowder extends ItemImpl implements IColorProvidingItem {
public ItemEffectPowder() {
super("effect_powder");
}
@Override
public EnumActionResult onItemUse(PlayerEntity player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!worldIn.isRemote) {
ItemStack stack = player.getHeldItem(hand);
EntityEffectInhibitor.place(worldIn, stack, pos.getX() + hitX, pos.getY() + hitY + 1, pos.getZ() + hitZ);
stack.setCount(0);
}
return EnumActionResult.SUCCESS;
}
@Override
public void getSubItems(ItemGroup tab, NonNullList<ItemStack> items) {
if (this.isInCreativeTab(tab)) {
for (ResourceLocation effect : NaturesAuraAPI.EFFECT_POWDERS.keySet()) {
ItemStack stack = new ItemStack(this);
setEffect(stack, effect);
items.add(stack);
}
}
}
@Override
public String getItemStackDisplayName(ItemStack stack) {
return I18n.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + "." + getEffect(stack) + ".name").trim();
}
public static ResourceLocation getEffect(ItemStack stack) {
if (!stack.hasTagCompound())
return null;
String effect = stack.getTagCompound().getString("effect");
if (effect.isEmpty())
return null;
return new ResourceLocation(effect);
}
public static ItemStack setEffect(ItemStack stack, ResourceLocation effect) {
if (!stack.hasTagCompound())
stack.setTagCompound(new CompoundNBT());
stack.getTagCompound().setString("effect", effect.toString());
return stack;
}
@Override
@OnlyIn(Dist.CLIENT)
public IItemColor getItemColor() {
return (stack, tintIndex) -> NaturesAuraAPI.EFFECT_POWDERS.getOrDefault(getEffect(stack), 0xFFFFFF);
}
}

View file

@ -1,37 +1,26 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.reg.ICreativeItem; import de.ellpeck.naturesaura.NaturesAura;
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 net.minecraft.item.Item; import net.minecraft.item.Item;
public class ItemImpl extends Item implements IModItem, ICreativeItem, IModelProvider { 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, new Properties().group(NaturesAura.CREATIVE_TAB));
}
public ItemImpl(String baseName, Item.Properties properties) {
super(properties);
this.baseName = baseName; this.baseName = baseName;
ModRegistry.add(this); this.setRegistryName(NaturesAura.createRes(this.getBaseName()));
} }
@Override @Override
public String getBaseName() { public String getBaseName() {
return this.baseName; return this.baseName;
} }
@Override
public void onPreInit(FMLPreInitializationEvent event) {
}
@Override
public void onInit(FMLInitializationEvent event) {
}
@Override
public void onPostInit(FMLPostInitializationEvent event) {
}
} }

View file

@ -1,79 +0,0 @@
package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.blocks.BlockSlabsNA;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.block.Block;
import net.minecraft.block.SlabBlock;
import net.minecraft.block.BlockSlab.EnumBlockHalf;
import net.minecraft.block.SoundType;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.function.Supplier;
public class ItemSlabNA extends BlockItem {
private final Supplier<BlockSlabsNA> singleSlab;
private final Supplier<BlockSlabsNA> doubleSlab;
public ItemSlabNA(Block block, Supplier<BlockSlabsNA> singleSlab, Supplier<BlockSlabsNA> doubleSlab) {
super(block);
this.singleSlab = singleSlab;
this.doubleSlab = doubleSlab;
}
@Override
public ActionResultType onItemUse(PlayerEntity player, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
if (!stack.isEmpty() && player.canPlayerEdit(pos.offset(facing), facing, stack)) {
BlockState state = worldIn.getBlockState(pos);
if (state.getBlock() == this.singleSlab.get()) {
EnumBlockHalf half = state.getValue(SlabBlock.HALF);
if (facing == Direction.UP && half == EnumBlockHalf.BOTTOM || facing == Direction.DOWN && half == EnumBlockHalf.TOP) {
BlockState newState = this.doubleSlab.get().getDefaultState();
AxisAlignedBB bound = newState.getCollisionBoundingBox(worldIn, pos);
if (bound != Block.NULL_AABB && worldIn.checkNoEntityCollision(bound.offset(pos)) && worldIn.setBlockState(pos, newState, 11)) {
SoundType sound = this.doubleSlab.get().getSoundType(newState, worldIn, pos, player);
worldIn.playSound(player, pos, sound.getPlaceSound(), SoundCategory.BLOCKS,
(sound.getVolume() + 1.0F) / 2.0F, sound.getPitch() * 0.8F);
stack.shrink(1);
if (player instanceof ServerPlayerEntity) {
CriteriaTriggers.PLACED_BLOCK.trigger((ServerPlayerEntity) player, pos, stack);
}
}
return ActionResultType.SUCCESS;
}
}
return super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ);
} else {
return ActionResultType.FAIL;
}
}
@Override
@OnlyIn(Dist.CLIENT)
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, Direction side, PlayerEntity player, ItemStack stack) {
BlockState state = worldIn.getBlockState(pos);
if (state.getBlock() == this.singleSlab.get())
if (state.getValue(SlabBlock.HALF) == EnumBlockHalf.TOP ? side == Direction.DOWN : side == Direction.UP)
return true;
BlockState other = worldIn.getBlockState(pos.offset(side));
return other.getBlock() == this.singleSlab.get() || super.canPlaceBlockOnSide(worldIn, pos, side, player, stack);
}
}

View file

@ -1,60 +1,88 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.items.tools.*;
import net.minecraft.util.SoundEvents;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial; import net.minecraftforge.registries.ObjectHolder;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraftforge.common.util.EnumHelper;
public final class ModItems { public class ModItems {
@ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_pickaxe")
public static final ToolMaterial TOOL_INFUSED = EnumHelper.addToolMaterial( public static Item INFUSED_PICKAXE;
NaturesAura.MOD_ID_UPPER + "_INFUSED_IRON", 3, 300, 6.25F, 2.25F, 16); @ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_axe")
public static final Item INFUSED_PICKAXE = new ItemPickaxeNA("infused_iron_pickaxe", TOOL_INFUSED); public static Item INFUSED_AXE;
public static final Item INFUSED_AXE = new ItemAxeNA("infused_iron_axe", TOOL_INFUSED, 8.25F, -3.2F); @ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_shovel")
public static final Item INFUSED_SHOVEL = new ItemShovelNA("infused_iron_shovel", TOOL_INFUSED); public static Item INFUSED_SHOVEL;
public static final Item INFUSED_HOE = new ItemHoeNA("infused_iron_hoe", TOOL_INFUSED); @ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_hoe")
public static final Item INFUSED_SWORD = new ItemSwordNA("infused_iron_sword", TOOL_INFUSED); public static Item INFUSED_HOE;
public static final ArmorMaterial ARMOR_INFUSED = EnumHelper.addArmorMaterial( @ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_sword")
NaturesAura.MOD_ID_UPPER + "INFUSED_IRON", NaturesAura.MOD_ID + ":infused_iron", public static Item INFUSED_SWORD;
19, new int[]{2, 5, 6, 2}, 16, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0F); @ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_helmet")
public static final Item INFUSED_HELMET = new ItemArmorNA("infused_iron_helmet", ARMOR_INFUSED, EquipmentSlotType.HEAD); public static Item INFUSED_HELMET;
public static final Item INFUSED_CHEST = new ItemArmorNA("infused_iron_chest", ARMOR_INFUSED, EquipmentSlotType.CHEST); @ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_chest")
public static final Item INFUSED_PANTS = new ItemArmorNA("infused_iron_pants", ARMOR_INFUSED, EquipmentSlotType.LEGS); public static Item INFUSED_CHEST;
public static final Item INFUSED_SHOES = new ItemArmorNA("infused_iron_shoes", ARMOR_INFUSED, EquipmentSlotType.FEET); @ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_pants")
public static Item INFUSED_PANTS;
public static final Item EYE = new ItemEye("eye"); @ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_shoes")
public static final Item EYE_IMPROVED = new ItemEye("eye_improved"); public static Item INFUSED_SHOES;
public static final Item GOLD_FIBER = new ItemGoldFiber(); @ObjectHolder(NaturesAura.MOD_ID + ":eye")
public static final Item GOLD_LEAF = new ItemImpl("gold_leaf"); public static Item EYE;
public static final Item INFUSED_IRON = new ItemImpl("infused_iron"); @ObjectHolder(NaturesAura.MOD_ID + ":eye_improved")
public static final Item ANCIENT_STICK = new ItemImpl("ancient_stick"); public static Item EYE_IMPROVED;
public static final Item COLOR_CHANGER = new ItemColorChanger(); @ObjectHolder(NaturesAura.MOD_ID + ":gold_fiber")
public static final Item AURA_CACHE = new ItemAuraCache("aura_cache", 400000); public static Item GOLD_FIBER;
public static final Item AURA_TROVE = new ItemAuraCache("aura_trove", 1200000); @ObjectHolder(NaturesAura.MOD_ID + ":gold_leaf")
public static final Item SHOCKWAVE_CREATOR = new ItemShockwaveCreator(); public static Item GOLD_LEAF;
public static final Item MULTIBLOCK_MAKER = new ItemMultiblockMaker(); @ObjectHolder(NaturesAura.MOD_ID + ":infused_iron")
public static final Item BOTTLE_TWO = new ItemImpl("bottle_two_the_rebottling"); public static Item INFUSED_IRON;
public static final Item AURA_BOTTLE = new ItemAuraBottle(); @ObjectHolder(NaturesAura.MOD_ID + ":ancient_stick")
public static final Item FARMING_STENCIL = new ItemImpl("farming_stencil"); public static Item ANCIENT_STICK;
public static final Item SKY_INGOT = new ItemImpl("sky_ingot"); @ObjectHolder(NaturesAura.MOD_ID + ":color_changer")
public static final Item CALLING_SPIRIT = new ItemGlowing("calling_spirit"); public static Item COLOR_CHANGER;
public static final Item EFFECT_POWDER = new ItemEffectPowder(); @ObjectHolder(NaturesAura.MOD_ID + ":aura_cache")
public static final Item BIRTH_SPIRIT = new ItemBirthSpirit(); public static Item AURA_CACHE;
public static final Item MOVER_MINECART = new ItemMoverMinecart(); @ObjectHolder(NaturesAura.MOD_ID + ":aura_trove")
public static final Item RANGE_VISUALIZER = new ItemRangeVisualizer(); public static Item AURA_TROVE;
public static final Item CLOCK_HAND = new ItemImpl("clock_hand"); @ObjectHolder(NaturesAura.MOD_ID + ":shockwave_creator")
public static final Item TOKEN_JOY = new ItemImpl("token_joy"); public static Item SHOCKWAVE_CREATOR;
public static final Item TOKEN_FEAR = new ItemImpl("token_fear"); @ObjectHolder(NaturesAura.MOD_ID + ":multiblock_maker")
public static final Item TOKEN_ANGER = new ItemImpl("token_anger"); public static Item MULTIBLOCK_MAKER;
public static final Item TOKEN_SORROW = new ItemImpl("token_sorrow"); @ObjectHolder(NaturesAura.MOD_ID + ":bottle_two_the_rebottling")
public static final Item TOKEN_EUPHORIA = new ItemImpl("token_euphoria"); public static Item BOTTLE_TWO;
public static final Item TOKEN_TERROR = new ItemImpl("token_terror"); @ObjectHolder(NaturesAura.MOD_ID + ":aura_bottle")
public static final Item TOKEN_RAGE = new ItemImpl("token_rage"); public static Item AURA_BOTTLE;
public static final Item TOKEN_GRIEF = new ItemImpl("token_grief"); @ObjectHolder(NaturesAura.MOD_ID + ":farming_stencil")
public static final Item ENDER_ACCESS = new ItemEnderAccess(); public static Item FARMING_STENCIL;
public static final Item CAVE_FINDER = new ItemCaveFinder(); @ObjectHolder(NaturesAura.MOD_ID + ":sky_ingot")
public static Item SKY_INGOT;
@ObjectHolder(NaturesAura.MOD_ID + ":calling_spirit")
public static Item CALLING_SPIRIT;
@ObjectHolder(NaturesAura.MOD_ID + ":effect_powder")
public static Item EFFECT_POWDER;
@ObjectHolder(NaturesAura.MOD_ID + ":birth_spirit")
public static Item BIRTH_SPIRIT;
@ObjectHolder(NaturesAura.MOD_ID + ":mover_cart")
public static Item MOVER_MINECART;
@ObjectHolder(NaturesAura.MOD_ID + ":range_visualizer")
public static Item RANGE_VISUALIZER;
@ObjectHolder(NaturesAura.MOD_ID + ":clock_hand")
public static Item CLOCK_HAND;
@ObjectHolder(NaturesAura.MOD_ID + ":token_joy")
public static Item TOKEN_JOY;
@ObjectHolder(NaturesAura.MOD_ID + ":token_fear")
public static Item TOKEN_FEAR;
@ObjectHolder(NaturesAura.MOD_ID + ":token_anger")
public static Item TOKEN_ANGER;
@ObjectHolder(NaturesAura.MOD_ID + ":token_sorrow")
public static Item TOKEN_SORROW;
@ObjectHolder(NaturesAura.MOD_ID + ":token_euphoria")
public static Item TOKEN_EUPHORIA;
@ObjectHolder(NaturesAura.MOD_ID + ":token_terror")
public static Item TOKEN_TERROR;
@ObjectHolder(NaturesAura.MOD_ID + ":token_rage")
public static Item TOKEN_RAGE;
@ObjectHolder(NaturesAura.MOD_ID + ":token_grief")
public static Item TOKEN_GRIEF;
@ObjectHolder(NaturesAura.MOD_ID + ":ender_access")
public static Item ENDER_ACCESS;
@ObjectHolder(NaturesAura.MOD_ID + ":cave_finder")
public static Item CAVE_FINDER;
} }

View file

@ -1,9 +1,11 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.entities.EntityMoverMinecart; import de.ellpeck.naturesaura.entities.EntityMoverMinecart;
import net.minecraft.block.AbstractRailBlock; import net.minecraft.block.AbstractRailBlock;
import net.minecraft.entity.item.minecart.AbstractMinecartEntity; import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemUseContext;
import net.minecraft.util.ActionResultType; import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
@ -12,22 +14,23 @@ import net.minecraft.world.World;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
public class ItemMoverMinecart extends ItemImpl { public class MoverMinecart extends ItemImpl {
public ItemMoverMinecart() { public MoverMinecart() {
super("mover_cart"); super("mover_cart", new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB));
this.setMaxStackSize(1);
} }
@Nonnull @Nonnull
@Override @Override
public ActionResultType onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ) { public ActionResultType onItemUse(ItemUseContext context) {
if (AbstractRailBlock.isRailBlock(world.getBlockState(pos))) { World world = context.getWorld();
BlockPos pos = context.getPos();
if (AbstractRailBlock.isRail(world.getBlockState(pos))) {
if (!world.isRemote) { if (!world.isRemote) {
AbstractMinecartEntity cart = new EntityMoverMinecart(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); AbstractMinecartEntity cart = new EntityMoverMinecart(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
world.spawnEntity(cart); world.addEntity(cart);
} }
player.getHeldItem(hand).shrink(1); context.getPlayer().getHeldItem(context.getHand()).shrink(1);
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
} }
return ActionResultType.PASS; return ActionResultType.PASS;

View file

@ -1,52 +1,53 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.multiblock.IMultiblock; import de.ellpeck.naturesaura.api.multiblock.IMultiblock;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType; import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class ItemMultiblockMaker extends ItemImpl { public class MultiblockMaker extends ItemImpl {
private static List<IMultiblock> multiblocks; private static List<IMultiblock> multiblocks;
public ItemMultiblockMaker() { public MultiblockMaker() {
super("multiblock_maker"); super("multiblock_maker", new Properties().group(NaturesAura.CREATIVE_TAB));
} }
@Override @Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
ItemStack stack = playerIn.getHeldItem(handIn); ItemStack stack = playerIn.getHeldItem(handIn);
if (!worldIn.isRemote && playerIn.capabilities.isCreativeMode) { if (!worldIn.isRemote && playerIn.isCreative()) {
int curr = getMultiblock(stack); int curr = getMultiblock(stack);
int next = (curr + 1) % multiblocks().size(); int next = (curr + 1) % multiblocks().size();
stack.getOrCreateTag().putInt("multiblock", next);
if (!stack.hasTagCompound())
stack.setTagCompound(new CompoundNBT());
stack.getTagCompound().setInteger("multiblock", next);
} }
return new ActionResult<>(ActionResultType.SUCCESS, stack); return new ActionResult<>(ActionResultType.SUCCESS, stack);
} }
@Override @Override
public ActionResultType onItemUse(PlayerEntity player, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { public ActionResultType onItemUse(ItemUseContext context) {
if (player.capabilities.isCreativeMode) { PlayerEntity player = context.getPlayer();
IMultiblock multi = multiblocks().get(getMultiblock(player.getHeldItem(hand))); if (player.isCreative()) {
IMultiblock multi = multiblocks().get(getMultiblock(player.getHeldItem(context.getHand())));
if (multi == null) if (multi == null)
return ActionResultType.PASS; return ActionResultType.PASS;
if (!worldIn.isRemote) if (!context.getWorld().isRemote)
multi.forEach(pos.up(), (char) 0, (blockPos, matcher) -> { multi.forEach(context.getPos().up(), (char) 0, (blockPos, matcher) -> {
worldIn.setBlockState(blockPos, matcher.getDefaultState()); context.getWorld().setBlockState(blockPos, matcher.getDefaultState());
return true; return true;
}); });
@ -56,16 +57,16 @@ public class ItemMultiblockMaker extends ItemImpl {
} }
@Override @Override
public String getItemStackDisplayName(ItemStack stack) { public ITextComponent getDisplayName(ItemStack stack) {
String name = super.getItemStackDisplayName(stack); ITextComponent name = super.getDisplayName(stack);
IMultiblock multi = multiblocks().get(getMultiblock(stack)); IMultiblock multi = multiblocks().get(getMultiblock(stack));
return multi == null ? name : name + " (" + multi.getName() + ")"; return multi == null ? name : name.appendText(" (" + multi.getName() + ")");
} }
private static int getMultiblock(ItemStack stack) { private static int getMultiblock(ItemStack stack) {
if (!stack.hasTagCompound()) if (!stack.hasTag())
return 0; return 0;
return stack.getTagCompound().getInteger("multiblock"); return stack.getTag().getInt("multiblock");
} }
private static List<IMultiblock> multiblocks() { private static List<IMultiblock> multiblocks() {

View file

@ -1,15 +0,0 @@
package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.blocks.ModBlocks;
import net.minecraftforge.oredict.OreDictionary;
public final class OreDict {
public static void init() {
OreDictionary.registerOre("logWood", ModBlocks.ANCIENT_LOG);
OreDictionary.registerOre("logWood", ModBlocks.ANCIENT_BARK);
OreDictionary.registerOre("plankWood", ModBlocks.ANCIENT_PLANKS);
OreDictionary.registerOre("treeLeaves", ModBlocks.ANCIENT_LEAVES);
OreDictionary.registerOre("stickWood", ModItems.ANCIENT_STICK);
}
}

View file

@ -9,6 +9,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType; import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
@ -20,16 +21,14 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
public class ItemRangeVisualizer extends ItemImpl { public class RangeVisualizer extends ItemImpl {
public static final ListMultimap<Integer, BlockPos> VISUALIZED_BLOCKS = ArrayListMultimap.create(); public static final ListMultimap<Integer, BlockPos> VISUALIZED_BLOCKS = ArrayListMultimap.create();
public static final ListMultimap<Integer, Entity> VISUALIZED_ENTITIES = ArrayListMultimap.create(); public static final ListMultimap<Integer, Entity> VISUALIZED_ENTITIES = ArrayListMultimap.create();
public static final ListMultimap<Integer, BlockPos> VISUALIZED_RAILS = ArrayListMultimap.create(); public static final ListMultimap<Integer, BlockPos> VISUALIZED_RAILS = ArrayListMultimap.create();
public ItemRangeVisualizer() { public RangeVisualizer() {
super("range_visualizer"); super("range_visualizer", new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB));
this.setMaxStackSize(1);
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
} }
@ -45,12 +44,14 @@ public class ItemRangeVisualizer extends ItemImpl {
} }
@Override @Override
public ActionResultType onItemUse(PlayerEntity player, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { public ActionResultType onItemUse(ItemUseContext context) {
BlockState state = worldIn.getBlockState(pos); World world = context.getWorld();
BlockPos pos = context.getPos();
BlockState state = world.getBlockState(pos);
Block block = state.getBlock(); Block block = state.getBlock();
if (block instanceof IVisualizable) { if (block instanceof IVisualizable) {
if (worldIn.isRemote) if (world.isRemote)
visualize(player, VISUALIZED_BLOCKS, worldIn.provider.getDimension(), pos); visualize(context.getPlayer(), VISUALIZED_BLOCKS, world.getDimension().getType().getId(), pos);
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
} }
return ActionResultType.PASS; return ActionResultType.PASS;
@ -83,10 +84,10 @@ public class ItemRangeVisualizer extends ItemImpl {
Entity entity = event.getTarget(); Entity entity = event.getTarget();
if (entity instanceof IVisualizable) { if (entity instanceof IVisualizable) {
if (entity.world.isRemote) { if (entity.world.isRemote) {
int dim = entity.world.provider.getDimension(); int dim = entity.world.getDimension().getType().getId();
visualize(event.getEntityPlayer(), VISUALIZED_ENTITIES, dim, entity); visualize(event.getPlayer(), VISUALIZED_ENTITIES, dim, entity);
} }
event.getEntityPlayer().swingArm(event.getHand()); event.getPlayer().swingArm(event.getHand());
event.setCancellationResult(ActionResultType.SUCCESS); event.setCancellationResult(ActionResultType.SUCCESS);
event.setCanceled(true); event.setCanceled(true);
} }

View file

@ -1,73 +1,67 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.render.ITrinketItem; import de.ellpeck.naturesaura.api.render.ITrinketItem;
import de.ellpeck.naturesaura.items.tools.ItemArmorNA; import de.ellpeck.naturesaura.items.tools.Armor;
import de.ellpeck.naturesaura.packet.PacketHandler; import net.minecraft.block.BlockState;
import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.AbstractGui; import net.minecraft.client.gui.screen.Screen;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.potion.Effects;
import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.potion.EffectInstance; import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
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.World; import net.minecraft.world.World;
import net.minecraft.world.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.List; import java.util.List;
public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem { public class ShockwaveCreator extends ItemImpl implements ITrinketItem {
private static final ResourceLocation RES_WORN = new ResourceLocation(NaturesAura.MOD_ID, "textures/items/shockwave_creator_player.png"); private static final ResourceLocation RES_WORN = new ResourceLocation(NaturesAura.MOD_ID, "textures/items/shockwave_creator_player.png");
public ItemShockwaveCreator() { public ShockwaveCreator() {
super("shockwave_creator"); super("shockwave_creator", new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB));
this.setMaxStackSize(1);
} }
@Override @Override
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (worldIn.isRemote || !(entityIn instanceof LivingEntity)) if (worldIn.isRemote || !(entityIn instanceof LivingEntity))
return; return;
LivingEntity living = (LivingEntity) entityIn; LivingEntity living = (LivingEntity) entityIn;
if (!living.onGround) { if (!living.onGround) {
if (!stack.hasTagCompound()) CompoundNBT compound = stack.getOrCreateTag();
stack.setTagCompound(new CompoundNBT());
CompoundNBT compound = stack.getTagCompound();
if (compound.getBoolean("air")) if (compound.getBoolean("air"))
return; return;
compound.setBoolean("air", true); compound.putBoolean("air", true);
compound.setDouble("x", living.posX); compound.putDouble("x", living.posX);
compound.setDouble("y", living.posY); compound.putDouble("y", living.posY);
compound.setDouble("z", living.posZ); compound.putDouble("z", living.posZ);
} else { } else {
if (!stack.hasTagCompound()) if (!stack.hasTag())
return; return;
CompoundNBT compound = stack.getTagCompound(); CompoundNBT compound = stack.getTag();
if (!compound.getBoolean("air")) if (!compound.getBoolean("air"))
return; return;
compound.setBoolean("air", false); compound.putBoolean("air", false);
if (!living.isSneaking()) if (!living.isSneaking())
return; return;
@ -81,14 +75,14 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem {
source = DamageSource.causePlayerDamage((PlayerEntity) living); source = DamageSource.causePlayerDamage((PlayerEntity) living);
else else
source = DamageSource.MAGIC; source = DamageSource.MAGIC;
boolean infusedSet = ItemArmorNA.isFullSetEquipped(living, 0); boolean infusedSet = Armor.isFullSetEquipped(living, 0);
int range = 5; int range = 5;
List<LivingEntity> mobs = worldIn.getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB( List<LivingEntity> mobs = worldIn.getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(
living.posX - range, living.posY - 0.5, living.posZ - range, living.posX - range, living.posY - 0.5, living.posZ - range,
living.posX + range, living.posY + 0.5, living.posZ + range)); living.posX + range, living.posY + 0.5, living.posZ + range));
for (LivingEntity mob : mobs) { for (LivingEntity mob : mobs) {
if (mob.isDead || mob == living) if (!mob.isAlive() || mob == living)
continue; continue;
if (living.getDistanceSq(mob) > range * range) if (living.getDistanceSq(mob) > range * range)
continue; continue;
@ -109,11 +103,9 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem {
worldIn.playSound(null, pos, type.getBreakSound(), SoundCategory.BLOCKS, type.getVolume() * 0.5F, type.getPitch() * 0.8F); worldIn.playSound(null, pos, type.getBreakSound(), SoundCategory.BLOCKS, type.getVolume() * 0.5F, type.getPitch() * 0.8F);
} }
if (worldIn instanceof ServerWorld) if (worldIn instanceof ServerWorld)
((ServerWorld) worldIn).spawnParticle(EnumParticleTypes.BLOCK_DUST, ((ServerWorld) worldIn).spawnParticle(ParticleTypes.POOF, living.posX, living.posY + 0.01F, living.posZ, 15, 0D, 0D, 0D, 0.15D);
living.posX, living.posY + 0.01F, living.posZ,
15, 0F, 0F, 0F, 0.15F, Block.getStateId(downState)); // TODO PacketHandler.sendToAllAround(worldIn, pos, 32, new PacketParticles((float) living.posX, (float) living.posY, (float) living.posZ, 11));
PacketHandler.sendToAllAround(worldIn, pos, 32,
new PacketParticles((float) living.posX, (float) living.posY, (float) living.posZ, 11));
} }
} }
@ -122,17 +114,19 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem {
public void render(ItemStack stack, PlayerEntity player, RenderType type, boolean isHolding) { public void render(ItemStack stack, PlayerEntity player, RenderType type, boolean isHolding) {
if (type == RenderType.BODY && !isHolding) { if (type == RenderType.BODY && !isHolding) {
boolean armor = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty(); boolean armor = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty();
GlStateManager.translate(-0.1675F, -0.05F, armor ? -0.195F : -0.1475F); GlStateManager.translatef(-0.1675F, -0.05F, armor ? -0.195F : -0.1475F);
GlStateManager.scale(0.021F, 0.021F, 0.021F); GlStateManager.scalef(0.021F, 0.021F, 0.021F);
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.disableLighting(); GlStateManager.disableLighting();
GlStateManager.pushAttrib(); GlStateManager.pushTextureAttributes();
GlStateManager.pushLightingAttributes();
RenderHelper.enableStandardItemLighting(); RenderHelper.enableStandardItemLighting();
Minecraft.getMinecraft().getTextureManager().bindTexture(RES_WORN); Minecraft.getInstance().getTextureManager().bindTexture(RES_WORN);
AbstractGui.drawModalRectWithCustomSizedTexture(0, 0, 0, 0, 16, 16, 16, 16); Screen.blit(0, 0, 0, 0, 16, 16, 16, 16);
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
GlStateManager.popAttrib(); GlStateManager.popAttributes();
GlStateManager.popAttributes();
GlStateManager.enableLighting(); GlStateManager.enableLighting();
GlStateManager.popMatrix(); GlStateManager.popMatrix();
} }

View file

@ -1,41 +1,37 @@
package de.ellpeck.naturesaura.items.tools; package de.ellpeck.naturesaura.items.tools;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.NaturesAura;
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 net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.potion.Effects;
import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.Item;
import net.minecraft.item.ArmorItem; import net.minecraft.item.ArmorItem;
import net.minecraft.item.IArmorMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.potion.EffectInstance; import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class ItemArmorNA extends ArmorItem implements IModItem, ICreativeItem, IModelProvider { public class Armor extends ArmorItem implements IModItem, IModelProvider {
private static List<Item[]> sets; private static List<Item[]> sets;
private final String baseName; private final String baseName;
public ItemArmorNA(String baseName, ArmorMaterial materialIn, EquipmentSlotType equipmentSlotIn) { public Armor(String baseName, IArmorMaterial materialIn, EquipmentSlotType equipmentSlotIn) {
super(materialIn, 0, equipmentSlotIn); super(materialIn, equipmentSlotIn, new Properties().group(NaturesAura.CREATIVE_TAB));
this.baseName = baseName; this.baseName = baseName;
ModRegistry.add(this);
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
} }
@ -57,21 +53,6 @@ public class ItemArmorNA extends ArmorItem implements IModItem, ICreativeItem, I
return this.baseName; return this.baseName;
} }
@Override
public void onPreInit(FMLPreInitializationEvent event) {
}
@Override
public void onInit(FMLInitializationEvent event) {
}
@Override
public void onPostInit(FMLPostInitializationEvent event) {
}
@Nullable @Nullable
@Override @Override
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) {

View file

@ -1,30 +1,26 @@
package de.ellpeck.naturesaura.items.tools; package de.ellpeck.naturesaura.items.tools;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.NaturesAura;
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 net.minecraft.block.material.Material;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.item.AxeItem; import net.minecraft.item.AxeItem;
import net.minecraft.item.IItemTier;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class ItemAxeNA extends AxeItem implements IModItem, ICreativeItem, IModelProvider { public class Axe extends AxeItem implements IModItem, IModelProvider {
private final String baseName; private final String baseName;
public ItemAxeNA(String baseName, ToolMaterial material, float damage, float speed) { public Axe(String baseName, IItemTier material, float damage, float speed) {
super(material, damage, speed); super(material, damage, speed, new Properties().group(NaturesAura.CREATIVE_TAB));
this.baseName = baseName; this.baseName = baseName;
ModRegistry.add(this);
} }
@Override @Override
@ -32,20 +28,6 @@ public class ItemAxeNA extends AxeItem implements IModItem, ICreativeItem, IMode
return this.baseName; return this.baseName;
} }
@Override
public void onPreInit(FMLPreInitializationEvent event) {
}
@Override
public void onInit(FMLInitializationEvent event) {
}
@Override
public void onPostInit(FMLPostInitializationEvent event) {
}
@Override @Override
public float getDestroySpeed(ItemStack stack, BlockState state) { public float getDestroySpeed(ItemStack stack, BlockState state) {
if (this == ModItems.INFUSED_AXE && state.getMaterial() == Material.LEAVES) { if (this == ModItems.INFUSED_AXE && state.getMaterial() == Material.LEAVES) {

View file

@ -0,0 +1,69 @@
package de.ellpeck.naturesaura.items.tools;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.*;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import javax.annotation.Nullable;
import java.util.Random;
public class Hoe extends HoeItem implements IModItem, IModelProvider {
private final String baseName;
public Hoe(String baseName, IItemTier material, float speed) {
super(material, speed, new Properties().group(NaturesAura.CREATIVE_TAB));
this.baseName = baseName;
}
@Override
public ActionResultType onItemUse(ItemUseContext context) {
World world = context.getWorld();
ActionResultType result = super.onItemUse(context);
if (!world.isRemote && result == ActionResultType.SUCCESS && this == ModItems.INFUSED_HOE) {
ItemStack seed = ItemStack.EMPTY;
Random random = world.getRandom();
BlockPos pos = context.getPos();
if (random.nextInt(5) == 0) {
seed = new ItemStack(Items.WHEAT_SEEDS); // TODO Change this to spawn random seed dropped by tall grass
} else if (random.nextInt(10) == 0) {
int rand = random.nextInt(3);
if (rand == 0) {
seed = new ItemStack(Items.MELON_SEEDS);
} else if (rand == 1) {
seed = new ItemStack(Items.PUMPKIN_SEEDS);
} else if (rand == 2) {
seed = new ItemStack(Items.BEETROOT_SEEDS);
}
}
if (!seed.isEmpty()) {
ItemEntity item = new ItemEntity(world, pos.getX() + random.nextFloat(), pos.getY() + 1F, pos.getZ() + random.nextFloat(), seed);
world.addEntity(item);
}
}
return result;
}
@Override
public String getBaseName() {
return this.baseName;
}
@Nullable
@Override
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) {
if (this == ModItems.INFUSED_HOE)
return Helper.makeRechargeProvider(stack, true);
else return null;
}
}

View file

@ -1,92 +0,0 @@
package de.ellpeck.naturesaura.items.tools;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.reg.ICreativeItem;
import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Items;
import net.minecraft.item.HoeItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import javax.annotation.Nullable;
public class ItemHoeNA extends HoeItem implements IModItem, ICreativeItem, IModelProvider {
private final String baseName;
public ItemHoeNA(String baseName, ToolMaterial material) {
super(material);
this.baseName = baseName;
ModRegistry.add(this);
}
@Override
public ActionResultType onItemUse(PlayerEntity player, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
ActionResultType result = super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ);
if (!worldIn.isRemote && result == ActionResultType.SUCCESS && this == ModItems.INFUSED_HOE) {
ItemStack seed = ItemStack.EMPTY;
if (worldIn.rand.nextInt(5) == 0) {
seed = ForgeHooks.getGrassSeed(worldIn.rand, 0);
} else if (worldIn.rand.nextInt(10) == 0) {
int rand = worldIn.rand.nextInt(3);
if (rand == 0) {
seed = new ItemStack(Items.MELON_SEEDS);
} else if (rand == 1) {
seed = new ItemStack(Items.PUMPKIN_SEEDS);
} else if (rand == 2) {
seed = new ItemStack(Items.BEETROOT_SEEDS);
}
}
if (!seed.isEmpty()) {
ItemEntity item = new ItemEntity(worldIn, pos.getX() + worldIn.rand.nextFloat(), pos.getY() + 1F, pos.getZ() + worldIn.rand.nextFloat(), seed);
worldIn.spawnEntity(item);
}
}
return result;
}
@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) {
}
@Nullable
@Override
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) {
if (this == ModItems.INFUSED_HOE)
return Helper.makeRechargeProvider(stack, true);
else return null;
}
}

View file

@ -1,82 +0,0 @@
package de.ellpeck.naturesaura.items.tools;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.reg.ICreativeItem;
import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.SoundEvents;
import net.minecraft.item.PickaxeItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import javax.annotation.Nullable;
public class ItemPickaxeNA extends PickaxeItem implements IModItem, ICreativeItem, IModelProvider {
private final String baseName;
public ItemPickaxeNA(String baseName, ToolMaterial material) {
super(material);
this.baseName = baseName;
ModRegistry.add(this);
}
@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) {
}
@Override
public ActionResultType onItemUse(PlayerEntity player, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
if (this == ModItems.INFUSED_PICKAXE) {
ItemStack stack = player.getHeldItem(hand);
BlockState state = worldIn.getBlockState(pos);
BlockState result = NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.get(state);
if (result != null) {
if (!worldIn.isRemote)
worldIn.setBlockState(pos, result);
worldIn.playSound(player, pos, SoundEvents.BLOCK_STONE_PLACE, SoundCategory.BLOCKS, 1.0F, 1.0F);
stack.damageItem(15, player);
return ActionResultType.SUCCESS;
}
}
return ActionResultType.PASS;
}
@Nullable
@Override
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) {
if (this == ModItems.INFUSED_PICKAXE)
return Helper.makeRechargeProvider(stack, true);
else return null;
}
}

View file

@ -0,0 +1,64 @@
package de.ellpeck.naturesaura.items.tools;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.IItemTier;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.item.PickaxeItem;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import javax.annotation.Nullable;
public class Pickaxe extends PickaxeItem implements IModItem, IModelProvider {
private final String baseName;
public Pickaxe(String baseName, IItemTier material, int damage, float speed) {
super(material, damage, speed, new Properties().group(NaturesAura.CREATIVE_TAB));
this.baseName = baseName;
}
@Override
public String getBaseName() {
return this.baseName;
}
@Override
public ActionResultType onItemUse(ItemUseContext context) {
if (this == ModItems.INFUSED_PICKAXE) {
PlayerEntity player = context.getPlayer();
World world = context.getWorld();
BlockPos pos = context.getPos();
ItemStack stack = player.getHeldItem(context.getHand());
BlockState state = world.getBlockState(pos);
BlockState result = NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.get(state);
if (result != null) {
if (!world.isRemote)
world.setBlockState(pos, result);
world.playSound(player, pos, SoundEvents.BLOCK_STONE_PLACE, SoundCategory.BLOCKS, 1.0F, 1.0F);
stack.damageItem(15, player, playerEntity -> {});
return ActionResultType.SUCCESS;
}
}
return ActionResultType.PASS;
}
@Nullable
@Override
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) {
if (this == ModItems.INFUSED_PICKAXE)
return Helper.makeRechargeProvider(stack, true);
else return null;
}
}

View file

@ -1,52 +1,49 @@
package de.ellpeck.naturesaura.items.tools; package de.ellpeck.naturesaura.items.tools;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.NaturesAura;
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 net.minecraft.block.BlockDirt;
import net.minecraft.block.material.Material;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.util.SoundEvents; import net.minecraft.block.material.Material;
import net.minecraft.item.ShovelItem; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.IItemTier;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.item.ShovelItem;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResultType; import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class ItemShovelNA extends ShovelItem implements IModItem, ICreativeItem, IModelProvider { public class Shovel extends ShovelItem implements IModItem, IModelProvider {
private final String baseName; private final String baseName;
public ItemShovelNA(String baseName, ToolMaterial material) { public Shovel(String baseName, IItemTier material, float damage, float speed) {
super(material); super(material, damage, speed, new Properties().group(NaturesAura.CREATIVE_TAB));
this.baseName = baseName; this.baseName = baseName;
ModRegistry.add(this);
} }
@Override @Override
public ActionResultType onItemUse(PlayerEntity player, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { public ActionResultType onItemUse(ItemUseContext context) {
if (this == ModItems.INFUSED_SHOVEL) { if (this == ModItems.INFUSED_SHOVEL) {
ItemStack stack = player.getHeldItem(hand); PlayerEntity player = context.getPlayer();
BlockState state = worldIn.getBlockState(pos); World world = context.getWorld();
BlockPos pos = context.getPos();
ItemStack stack = player.getHeldItem(context.getHand());
BlockState state = world.getBlockState(pos);
int damage = 0; int damage = 0;
if (state.getBlock() == Blocks.DIRT) {
if (state.getBlock() instanceof BlockDirt) { if (world.getBlockState(pos.up()).getMaterial() == Material.AIR) {
if (worldIn.getBlockState(pos.up()).getMaterial() == Material.AIR) { world.setBlockState(pos, Blocks.GRASS.getDefaultState());
worldIn.setBlockState(pos, Blocks.GRASS.getDefaultState());
damage = 5; damage = 5;
} }
} else { } else {
@ -54,12 +51,13 @@ public class ItemShovelNA extends ShovelItem implements IModItem, ICreativeItem,
for (int x = -range; x <= range; x++) { for (int x = -range; x <= range; x++) {
for (int y = -range; y <= range; y++) { for (int y = -range; y <= range; y++) {
BlockPos actualPos = pos.add(x, 0, y); BlockPos actualPos = pos.add(x, 0, y);
Direction facing = context.getFace();
if (player.canPlayerEdit(actualPos.offset(facing), facing, stack)) { if (player.canPlayerEdit(actualPos.offset(facing), facing, stack)) {
if (facing != Direction.DOWN if (facing != Direction.DOWN
&& worldIn.getBlockState(actualPos.up()).getMaterial() == Material.AIR && world.getBlockState(actualPos.up()).getMaterial() == Material.AIR
&& worldIn.getBlockState(actualPos).getBlock() == Blocks.GRASS) { && world.getBlockState(actualPos).getBlock() == Blocks.GRASS) {
if (!worldIn.isRemote) { if (!world.isRemote) {
worldIn.setBlockState(actualPos, Blocks.GRASS_PATH.getDefaultState(), 11); world.setBlockState(actualPos, Blocks.GRASS_PATH.getDefaultState(), 11);
} }
damage = 1; damage = 1;
} }
@ -69,8 +67,8 @@ public class ItemShovelNA extends ShovelItem implements IModItem, ICreativeItem,
} }
if (damage > 0) { if (damage > 0) {
worldIn.playSound(player, pos, SoundEvents.ITEM_SHOVEL_FLATTEN, SoundCategory.BLOCKS, 1.0F, 1.0F); world.playSound(player, pos, SoundEvents.ITEM_SHOVEL_FLATTEN, SoundCategory.BLOCKS, 1.0F, 1.0F);
stack.damageItem(damage, player); stack.damageItem(damage, player, playerEntity -> {});
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
} }
} }
@ -82,20 +80,6 @@ public class ItemShovelNA extends ShovelItem implements IModItem, ICreativeItem,
return this.baseName; return this.baseName;
} }
@Override
public void onPreInit(FMLPreInitializationEvent event) {
}
@Override
public void onInit(FMLInitializationEvent event) {
}
@Override
public void onPostInit(FMLPostInitializationEvent event) {
}
@Nullable @Nullable
@Override @Override
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) {

View file

@ -1,31 +1,27 @@
package de.ellpeck.naturesaura.items.tools; package de.ellpeck.naturesaura.items.tools;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.NaturesAura;
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 net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.potion.Effects; import net.minecraft.item.IItemTier;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.SwordItem; import net.minecraft.item.SwordItem;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.potion.EffectInstance; import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class ItemSwordNA extends SwordItem implements IModItem, ICreativeItem, IModelProvider { public class Sword extends SwordItem implements IModItem, IModelProvider {
private final String baseName; private final String baseName;
public ItemSwordNA(String baseName, ToolMaterial material) { public Sword(String baseName, IItemTier material, int damage, float speed) {
super(material); super(material, damage, speed, new Properties().group(NaturesAura.CREATIVE_TAB));
this.baseName = baseName; this.baseName = baseName;
ModRegistry.add(this);
} }
@Override @Override
@ -33,21 +29,6 @@ public class ItemSwordNA extends SwordItem implements IModItem, ICreativeItem, I
return this.baseName; return this.baseName;
} }
@Override
public void onPreInit(FMLPreInitializationEvent event) {
}
@Override
public void onInit(FMLInitializationEvent event) {
}
@Override
public void onPostInit(FMLPostInitializationEvent event) {
}
@Override @Override
public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker) { public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker) {
if (this == ModItems.INFUSED_SWORD) if (this == ModItems.INFUSED_SWORD)

View file

@ -1,7 +1,7 @@
package de.ellpeck.naturesaura.packet; package de.ellpeck.naturesaura.packet;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.items.ItemRangeVisualizer; import de.ellpeck.naturesaura.items.RangeVisualizer;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -53,7 +53,7 @@ public class PacketClient implements IMessage {
case 0: // dimension rail visualization case 0: // dimension rail visualization
int goalDim = message.data[0]; int goalDim = message.data[0];
BlockPos goalPos = new BlockPos(message.data[1], message.data[2], message.data[3]); BlockPos goalPos = new BlockPos(message.data[1], message.data[2], message.data[3]);
ItemRangeVisualizer.visualize(mc.player, ItemRangeVisualizer.VISUALIZED_RAILS, goalDim, goalPos); RangeVisualizer.visualize(mc.player, RangeVisualizer.VISUALIZED_RAILS, goalDim, goalPos);
} }
} }
}); });

View file

@ -26,10 +26,10 @@ public final class ParticleHandler {
private static final List<Particle> PARTICLES_NO_DEPTH = new ArrayList<>(); private static final List<Particle> PARTICLES_NO_DEPTH = new ArrayList<>();
public static void spawnParticle(Supplier<Particle> particle, double x, double y, double z) { public static void spawnParticle(Supplier<Particle> particle, double x, double y, double z) {
if (Minecraft.getMinecraft().player.getDistanceSq(x, y, z) <= range * range) { if (Minecraft.getInstance().player.getDistanceSq(x, y, z) <= range * range) {
Minecraft mc = Minecraft.getMinecraft(); Minecraft mc = Minecraft.getInstance();
if (ModConfig.client.respectVanillaParticleSettings) { if (ModConfig.client.respectVanillaParticleSettings) {
int setting = mc.gameSettings.particleSetting; int setting = mc.gameSettings.particles.func_216832_b();
if (setting != 0 && if (setting != 0 &&
(setting != 1 || mc.world.rand.nextInt(3) != 0) && (setting != 1 || mc.world.rand.nextInt(3) != 0) &&
(setting != 2 || mc.world.rand.nextInt(10) != 0)) (setting != 2 || mc.world.rand.nextInt(10) != 0))
@ -57,14 +57,14 @@ public final class ParticleHandler {
private static void updateList(List<Particle> particles) { private static void updateList(List<Particle> particles) {
for (int i = particles.size() - 1; i >= 0; i--) { for (int i = particles.size() - 1; i >= 0; i--) {
Particle particle = particles.get(i); Particle particle = particles.get(i);
particle.onUpdate(); particle.tick();
if (!particle.isAlive()) if (!particle.isAlive())
particles.remove(i); particles.remove(i);
} }
} }
public static void renderParticles(float partialTicks) { public static void renderParticles(float partialTicks) {
Minecraft mc = Minecraft.getMinecraft(); Minecraft mc = Minecraft.getInstance();
PlayerEntity player = mc.player; PlayerEntity player = mc.player;
if (player != null) { if (player != null) {
@ -77,7 +77,7 @@ public final class ParticleHandler {
Particle.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks; Particle.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks;
Particle.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks; Particle.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks;
Particle.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks; Particle.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks;
Particle.cameraViewDir = player.getLook(partialTicks); Particle.dir = player.getLook(partialTicks);
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();

View file

@ -11,10 +11,10 @@ import de.ellpeck.naturesaura.renderers.PlayerLayerTrinkets;
import de.ellpeck.naturesaura.renderers.SupporterFancyHandler; import de.ellpeck.naturesaura.renderers.SupporterFancyHandler;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.client.renderer.color.ItemColors; import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.client.renderer.entity.PlayerRenderer; import net.minecraft.client.renderer.entity.PlayerRenderer;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -25,9 +25,7 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.client.registry.IRenderFactory;
import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import java.util.Map; import java.util.Map;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -35,14 +33,14 @@ import java.util.function.Supplier;
public class ClientProxy implements IProxy { public class ClientProxy implements IProxy {
@Override @Override
public void preInit(FMLPreInitializationEvent event) { public void preInit(FMLCommonSetupEvent event) {
MinecraftForge.EVENT_BUS.register(new ClientEvents()); MinecraftForge.EVENT_BUS.register(new ClientEvents());
Compat.preInitClient(); Compat.preInitClient();
} }
@Override @Override
public void init(FMLInitializationEvent event) { public void init(FMLCommonSetupEvent event) {
Map<String, PlayerRenderer> skinMap = Minecraft.getMinecraft().getRenderManager().getSkinMap(); Map<String, PlayerRenderer> skinMap = Minecraft.getInstance().getRenderManager().getSkinMap();
for (PlayerRenderer render : new PlayerRenderer[]{skinMap.get("default"), skinMap.get("slim")}) { for (PlayerRenderer render : new PlayerRenderer[]{skinMap.get("default"), skinMap.get("slim")}) {
render.addLayer(new PlayerLayerTrinkets()); render.addLayer(new PlayerLayerTrinkets());
} }
@ -50,38 +48,38 @@ public class ClientProxy implements IProxy {
} }
@Override @Override
public void postInit(FMLPostInitializationEvent event) { public void postInit(FMLCommonSetupEvent event) {
} }
@Override @Override
public void registerRenderer(ItemStack stack, ModelResourceLocation location) { public void registerRenderer(ItemStack stack, ModelResourceLocation location) {
ModelLoader.setCustomModelResourceLocation(stack.getItem(), stack.getItemDamage(), location); //ModelLoader.setCustomModelResourceLocation(stack.getItem(), stack.getItemDamage(), location);
} }
@Override @Override
public void addColorProvidingItem(IColorProvidingItem item) { public void addColorProvidingItem(IColorProvidingItem item) {
ItemColors colors = Minecraft.getMinecraft().getItemColors(); ItemColors colors = Minecraft.getInstance().getItemColors();
IItemColor color = item.getItemColor(); IItemColor color = item.getItemColor();
if (item instanceof Item) { if (item instanceof Item) {
colors.registerItemColorHandler(color, (Item) item); colors.register(color, (Item) item);
} else if (item instanceof Block) { } else if (item instanceof Block) {
colors.registerItemColorHandler(color, (Block) item); colors.register(color, (Block) item);
} }
} }
@Override @Override
public void addColorProvidingBlock(IColorProvidingBlock block) { public void addColorProvidingBlock(IColorProvidingBlock block) {
if (block instanceof Block) { if (block instanceof Block) {
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(block.getBlockColor(), (Block) block); Minecraft.getInstance().getBlockColors().register(block.getBlockColor(), (Block) block);
} }
} }
@Override @Override
public void registerTESR(ITESRProvider provider) { public void registerTESR(ITESRProvider provider) {
Tuple<Class, TileEntityRenderer> tesr = provider.getTESR(); Tuple<Class, TileEntityRenderer> tesr = provider.getTESR();
ClientRegistry.bindTileEntitySpecialRenderer(tesr.getFirst(), tesr.getSecond()); ClientRegistry.bindTileEntitySpecialRenderer(tesr.getA(), tesr.getB());
} }
@Override @Override
@ -91,7 +89,7 @@ public class ClientProxy implements IProxy {
@Override @Override
public void spawnMagicParticle(double posX, double posY, double posZ, double motionX, double motionY, double motionZ, int color, float scale, int maxAge, float gravity, boolean collision, boolean fade) { public void spawnMagicParticle(double posX, double posY, double posZ, double motionX, double motionY, double motionZ, int color, float scale, int maxAge, float gravity, boolean collision, boolean fade) {
ParticleHandler.spawnParticle(() -> new ParticleMagic(Minecraft.getMinecraft().world, ParticleHandler.spawnParticle(() -> new ParticleMagic(Minecraft.getInstance().world,
posX, posY, posZ, posX, posY, posZ,
motionX, motionY, motionZ, motionX, motionY, motionZ,
color, scale, maxAge, gravity, collision, fade), posX, posY, posZ); color, scale, maxAge, gravity, collision, fade), posX, posY, posZ);
@ -109,6 +107,6 @@ public class ClientProxy implements IProxy {
@Override @Override
public void scheduleTask(Runnable runnable) { public void scheduleTask(Runnable runnable) {
Minecraft.getMinecraft().addScheduledTask(runnable); Minecraft.getInstance().runAsync(runnable);
} }
} }

View file

@ -7,18 +7,16 @@ import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.client.registry.IRenderFactory;
import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import java.util.function.Supplier; import java.util.function.Supplier;
public interface IProxy { public interface IProxy {
void preInit(FMLPreInitializationEvent event); void preInit(FMLCommonSetupEvent event);
void init(FMLInitializationEvent event); void init(FMLCommonSetupEvent event);
void postInit(FMLPostInitializationEvent event); void postInit(FMLCommonSetupEvent event);
void registerRenderer(ItemStack stack, ModelResourceLocation location); void registerRenderer(ItemStack stack, ModelResourceLocation location);

View file

@ -7,27 +7,25 @@ import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.client.registry.IRenderFactory;
import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.server.ServerLifecycleHooks;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import java.util.function.Supplier; import java.util.function.Supplier;
public class ServerProxy implements IProxy { public class ServerProxy implements IProxy {
@Override @Override
public void preInit(FMLPreInitializationEvent event) { public void preInit(FMLCommonSetupEvent event) {
} }
@Override @Override
public void init(FMLInitializationEvent event) { public void init(FMLCommonSetupEvent event) {
} }
@Override @Override
public void postInit(FMLPostInitializationEvent event) { public void postInit(FMLCommonSetupEvent event) {
} }
@ -73,6 +71,6 @@ public class ServerProxy implements IProxy {
@Override @Override
public void scheduleTask(Runnable runnable) { public void scheduleTask(Runnable runnable) {
FMLCommonHandler.instance().getMinecraftServerInstance().addScheduledTask(runnable); ServerLifecycleHooks.getCurrentServer().runAsync(runnable);
} }
} }

View file

@ -10,8 +10,8 @@ import de.ellpeck.naturesaura.chunk.effect.AnimalEffect;
import de.ellpeck.naturesaura.chunk.effect.CacheRechargeEffect; import de.ellpeck.naturesaura.chunk.effect.CacheRechargeEffect;
import de.ellpeck.naturesaura.chunk.effect.OreSpawnEffect; import de.ellpeck.naturesaura.chunk.effect.OreSpawnEffect;
import de.ellpeck.naturesaura.chunk.effect.PlantBoostEffect; import de.ellpeck.naturesaura.chunk.effect.PlantBoostEffect;
import de.ellpeck.naturesaura.items.ItemAuraBottle; import de.ellpeck.naturesaura.items.AuraBottle;
import de.ellpeck.naturesaura.items.ItemEffectPowder; import de.ellpeck.naturesaura.items.EffectPowder;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.FlowerBlock; import net.minecraft.block.FlowerBlock;
@ -24,7 +24,6 @@ import net.minecraft.item.Items;
import net.minecraft.potion.Potions; import net.minecraft.potion.Potions;
import net.minecraft.item.DyeColor; import net.minecraft.item.DyeColor;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.PotionItem;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
import net.minecraft.potion.PotionHelper; import net.minecraft.potion.PotionHelper;
@ -96,35 +95,35 @@ public final class ModRecipes {
ing(ModItems.TOKEN_ANGER)).register(); ing(ModItems.TOKEN_ANGER)).register();
new TreeRitualRecipe(res("plant_powder"), new TreeRitualRecipe(res("plant_powder"),
ing(new ItemStack(Blocks.SAPLING)), ing(new ItemStack(Blocks.SAPLING)),
ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, 24), PlantBoostEffect.NAME), 400, EffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, 24), PlantBoostEffect.NAME), 400,
ing(ModBlocks.GOLD_POWDER), ing(ModBlocks.GOLD_POWDER),
ing(ModBlocks.GOLD_POWDER), ing(ModBlocks.GOLD_POWDER),
ing(ModItems.SKY_INGOT), ing(ModItems.SKY_INGOT),
ing(Items.WHEAT)).register(); ing(Items.WHEAT)).register();
new TreeRitualRecipe(res("cache_powder"), new TreeRitualRecipe(res("cache_powder"),
ing(new ItemStack(Blocks.SAPLING)), ing(new ItemStack(Blocks.SAPLING)),
ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, 32), CacheRechargeEffect.NAME), 400, EffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, 32), CacheRechargeEffect.NAME), 400,
ing(ModBlocks.GOLD_POWDER), ing(ModBlocks.GOLD_POWDER),
ing(ModBlocks.GOLD_POWDER), ing(ModBlocks.GOLD_POWDER),
ing(ModItems.SKY_INGOT), ing(ModItems.SKY_INGOT),
ing(ModItems.AURA_CACHE)).register(); ing(ModItems.AURA_CACHE)).register();
new TreeRitualRecipe(res("animal_powder"), new TreeRitualRecipe(res("animal_powder"),
ing(new ItemStack(Blocks.SAPLING, 1, 3)), ing(new ItemStack(Blocks.SAPLING, 1, 3)),
ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, 8), AnimalEffect.NAME), 400, EffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, 8), AnimalEffect.NAME), 400,
ing(ModBlocks.GOLD_POWDER), ing(ModBlocks.GOLD_POWDER),
ing(ModBlocks.GOLD_POWDER), ing(ModBlocks.GOLD_POWDER),
ing(ModItems.SKY_INGOT), ing(ModItems.SKY_INGOT),
ing(Items.EGG)).register(); ing(Items.EGG)).register();
new TreeRitualRecipe(res("ore_spawn_powder"), new TreeRitualRecipe(res("ore_spawn_powder"),
ing(new ItemStack(Blocks.SAPLING)), ing(new ItemStack(Blocks.SAPLING)),
ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, 4), OreSpawnEffect.NAME), 400, EffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER, 4), OreSpawnEffect.NAME), 400,
ing(ModBlocks.GOLD_POWDER), ing(ModBlocks.GOLD_POWDER),
ing(ModBlocks.GOLD_POWDER), ing(ModBlocks.GOLD_POWDER),
ing(Blocks.DIAMOND_ORE), ing(Blocks.DIAMOND_ORE),
ing(Blocks.REDSTONE_ORE)).register(); ing(Blocks.REDSTONE_ORE)).register();
new TreeRitualRecipe(res("token_joy"), new TreeRitualRecipe(res("token_joy"),
ing(Blocks.SAPLING), new ItemStack(ModItems.TOKEN_JOY, 2), 200, ing(Blocks.SAPLING), new ItemStack(ModItems.TOKEN_JOY, 2), 200,
nbtIng(ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), NaturesAuraAPI.TYPE_OVERWORLD)), nbtIng(AuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), NaturesAuraAPI.TYPE_OVERWORLD)),
ing(ModItems.GOLD_LEAF), ing(ModItems.GOLD_LEAF),
ing(new ItemStack(Blocks.RED_FLOWER, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Blocks.YELLOW_FLOWER)), ing(new ItemStack(Blocks.RED_FLOWER, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Blocks.YELLOW_FLOWER)),
ing(Items.APPLE), ing(Items.APPLE),
@ -132,7 +131,7 @@ public final class ModRecipes {
ing(Items.IRON_INGOT)).register(); ing(Items.IRON_INGOT)).register();
new TreeRitualRecipe(res("token_anger"), new TreeRitualRecipe(res("token_anger"),
ing(Blocks.SAPLING), new ItemStack(ModItems.TOKEN_ANGER, 2), 200, ing(Blocks.SAPLING), new ItemStack(ModItems.TOKEN_ANGER, 2), 200,
nbtIng(ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), NaturesAuraAPI.TYPE_NETHER)), nbtIng(AuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), NaturesAuraAPI.TYPE_NETHER)),
ing(ModItems.GOLD_LEAF), ing(ModItems.GOLD_LEAF),
ing(Blocks.MAGMA), ing(Blocks.MAGMA),
ing(Items.BLAZE_POWDER), ing(Items.BLAZE_POWDER),
@ -140,7 +139,7 @@ public final class ModRecipes {
ing(Items.ENDER_PEARL)).register(); ing(Items.ENDER_PEARL)).register();
new TreeRitualRecipe(res("token_sorrow"), new TreeRitualRecipe(res("token_sorrow"),
ing(Blocks.SAPLING), new ItemStack(ModItems.TOKEN_SORROW, 2), 200, ing(Blocks.SAPLING), new ItemStack(ModItems.TOKEN_SORROW, 2), 200,
nbtIng(ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), NaturesAuraAPI.TYPE_OVERWORLD)), nbtIng(AuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), NaturesAuraAPI.TYPE_OVERWORLD)),
ing(ModItems.GOLD_LEAF), ing(ModItems.GOLD_LEAF),
ing(Items.GHAST_TEAR), ing(Items.GHAST_TEAR),
ing(Items.BEEF, Items.MUTTON, Items.CHICKEN, Items.PORKCHOP), ing(Items.BEEF, Items.MUTTON, Items.CHICKEN, Items.PORKCHOP),
@ -148,7 +147,7 @@ public final class ModRecipes {
ing(new ItemStack(Items.FISH, 1, OreDictionary.WILDCARD_VALUE))).register(); ing(new ItemStack(Items.FISH, 1, OreDictionary.WILDCARD_VALUE))).register();
new TreeRitualRecipe(res("token_fear"), new TreeRitualRecipe(res("token_fear"),
ing(Blocks.SAPLING), new ItemStack(ModItems.TOKEN_FEAR, 2), 200, ing(Blocks.SAPLING), new ItemStack(ModItems.TOKEN_FEAR, 2), 200,
nbtIng(ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), NaturesAuraAPI.TYPE_NETHER)), nbtIng(AuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), NaturesAuraAPI.TYPE_NETHER)),
ing(ModItems.GOLD_LEAF), ing(ModItems.GOLD_LEAF),
ing(Items.ROTTEN_FLESH), ing(Items.ROTTEN_FLESH),
ing(Items.FEATHER), ing(Items.FEATHER),
@ -166,7 +165,7 @@ public final class ModRecipes {
Ingredient.EMPTY, 7500, 40).register(); Ingredient.EMPTY, 7500, 40).register();
Ingredient conversion = ing(ModBlocks.CONVERSION_CATALYST); Ingredient conversion = ing(ModBlocks.CONVERSION_CATALYST);
new AltarRecipe(res("breath"), nbtIng(ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), NaturesAuraAPI.TYPE_END)), new ItemStack(Items.DRAGON_BREATH), conversion, 20000, 80).register(); new AltarRecipe(res("breath"), nbtIng(AuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), NaturesAuraAPI.TYPE_END)), new ItemStack(Items.DRAGON_BREATH), conversion, 20000, 80).register();
new AltarRecipe(res("leather"), ing(Items.ROTTEN_FLESH), new ItemStack(Items.LEATHER), conversion, 10000, 50).register(); new AltarRecipe(res("leather"), ing(Items.ROTTEN_FLESH), new ItemStack(Items.LEATHER), conversion, 10000, 50).register();
new AltarRecipe(res("soul_sand"), ing(Blocks.SAND), new ItemStack(Blocks.SOUL_SAND), conversion, 5000, 100).register(); new AltarRecipe(res("soul_sand"), ing(Blocks.SAND), new ItemStack(Blocks.SOUL_SAND), conversion, 5000, 100).register();
new AltarRecipe(res("nether_wart"), ing(Blocks.RED_MUSHROOM), new ItemStack(Items.NETHER_WART), conversion, 30000, 250).register(); new AltarRecipe(res("nether_wart"), ing(Blocks.RED_MUSHROOM), new ItemStack(Items.NETHER_WART), conversion, 30000, 250).register();

View file

@ -1,11 +0,0 @@
package de.ellpeck.naturesaura.reg;
import de.ellpeck.naturesaura.NaturesAura;
import net.minecraft.item.ItemGroup;
public interface ICreativeItem {
default ItemGroup getTabToAdd() {
return NaturesAura.CREATIVE_TAB;
}
}

View file

@ -1,16 +1,12 @@
package de.ellpeck.naturesaura.reg; package de.ellpeck.naturesaura.reg;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
public interface IModItem { public interface IModItem {
String getBaseName(); String getBaseName();
void onPreInit(FMLPreInitializationEvent event); //void onPreInit(FMLCommonSetupEvent event);
void onInit(FMLInitializationEvent event); //void onInit(FMLCommonSetupEvent event);
void onPostInit(FMLPostInitializationEvent event); //void onPostInit(FMLCommonSetupEvent event);
} }

View file

@ -1,22 +1,34 @@
package de.ellpeck.naturesaura.reg; package de.ellpeck.naturesaura.reg;
import de.ellpeck.naturesaura.ModConfig;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.blocks.*;
import de.ellpeck.naturesaura.items.*;
import de.ellpeck.naturesaura.items.tools.*;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.model.ModelResourceLocation; import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.item.ItemGroup; import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.Item;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.potion.Effect; import net.minecraft.potion.Effect;
import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.registry.ForgeRegistries; import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.registries.ForgeRegistries;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@Mod.EventBusSubscriber
public final class ModRegistry { public final class ModRegistry {
private static final List<IModItem> ALL_ITEMS = new ArrayList<>(); private static final List<IModItem> ALL_ITEMS = new ArrayList<>();
@ -25,6 +37,136 @@ public final class ModRegistry {
ALL_ITEMS.add(item); ALL_ITEMS.add(item);
} }
@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event) {
event.getRegistry().registerAll(
new BlockAncientLog("ancient_log"),
new BlockAncientLog("ancient_bark"),
new BlockImpl("ancient_planks", ModBlocks.prop(Material.WOOD).sound(SoundType.WOOD).hardnessAndResistance(2F)),
new BlockStairsNA("ancient_stairs", ModBlocks.ANCIENT_PLANKS::getDefaultState, ModBlocks.prop(ModBlocks.ANCIENT_PLANKS)),
new Slab("ancient_slab", ModBlocks.prop(ModBlocks.ANCIENT_PLANKS)),
new BlockAncientLeaves(),
new BlockAncientSapling(),
new BlockNatureAltar(),
new BlockDecayedLeaves(),
new BlockGoldenLeaves(),
new BlockGoldPowder(),
new BlockWoodStand(),
new BlockImpl("infused_stone", ModBlocks.prop(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(1.75F)),
new BlockStairsNA("infused_stairs", ModBlocks.INFUSED_STONE::getDefaultState, ModBlocks.prop(ModBlocks.INFUSED_STONE)),
new Slab("infused_slab", ModBlocks.prop(ModBlocks.INFUSED_STONE)),
new BlockImpl("infused_brick", ModBlocks.prop(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(1.5F)),
new BlockStairsNA("infused_brick_stairs", ModBlocks.INFUSED_BRICK::getDefaultState, ModBlocks.prop(ModBlocks.INFUSED_BRICK)),
new Slab("infused_brick_slab", ModBlocks.prop(ModBlocks.INFUSED_BRICK)),
new BlockFurnaceHeater(),
new BlockPotionGenerator(),
new BlockAuraDetector(),
new BlockImpl("conversion_catalyst", ModBlocks.prop(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(2.5F)),
new BlockImpl("crushing_catalyst", ModBlocks.prop(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(2.5F)),
new BlockFlowerGenerator(),
new BlockPlacer(),
new BlockHopperUpgrade(),
new BlockFieldCreator(),
new BlockOakGenerator(),
new BlockImpl("infused_iron_block", ModBlocks.prop(Material.IRON).sound(SoundType.METAL).hardnessAndResistance(3F)),
new BlockOfferingTable(),
new BlockPickupStopper(),
new BlockSpawnLamp(),
new BlockAnimalGenerator(),
new BlockEndFlower(),
new BlockGratedChute(),
new BlockAnimalSpawner(),
new BlockAutoCrafter(),
new BlockImpl("gold_brick", ModBlocks.prop(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(2F)),
new BlockMossGenerator(),
new BlockTimeChanger(),
new BlockGeneratorLimitRemover(),
new BlockEnderCrate(),
new BlockPowderPlacer(),
new BlockFireworkGenerator(),
new BlockProjectileGenerator(),
new BlockDimensionRail("overworld", DimensionType.OVERWORLD, DimensionType.THE_NETHER, DimensionType.THE_END),
new BlockDimensionRail("nether", DimensionType.THE_NETHER, DimensionType.OVERWORLD),
new BlockDimensionRail("end", DimensionType.THE_END, DimensionType.OVERWORLD)
);
if (ModConfig.enabledFeatures.rfConverter) {
event.getRegistry().register(new BlockRFConverter());
}
if (ModConfig.enabledFeatures.chunkLoader) {
event.getRegistry().register(new BlockChunkLoader());
}
}
@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event) {
for (IModItem item : ALL_ITEMS) {
if (item instanceof Block) {
if (item instanceof ICustomItemBlockProvider) {
event.getRegistry().register(((ICustomItemBlockProvider) item).getItemBlock());
} else {
event.getRegistry().register(new BlockItem((Block) item, new Item.Properties()));
}
}
}
event.getRegistry().registerAll(
new Pickaxe("infused_iron_pickaxe", NAItemTier.INFUSED, 8, 3.2F),
new Axe("infused_iron_axe", NAItemTier.INFUSED, 8.25F, 3.2F),
new Shovel("infused_iron_shovel", NAItemTier.INFUSED, 8.25F, 3.2F),
new Hoe("infused_iron_hoe", NAItemTier.INFUSED, 3.2F),
new Sword("infused_iron_sword", NAItemTier.INFUSED, 3, 3), // dmg and speed values need to be changed
new Armor("infused_iron_helmet", NAArmorMaterial.INFUSED, EquipmentSlotType.HEAD),
new Armor("infused_iron_chest", NAArmorMaterial.INFUSED, EquipmentSlotType.CHEST),
new Armor("infused_iron_pants", NAArmorMaterial.INFUSED, EquipmentSlotType.LEGS),
new Armor("infused_iron_shoes", NAArmorMaterial.INFUSED, EquipmentSlotType.FEET),
new Eye("eye"),
new Eye("eye_improved"),
new GoldFiber(),
new ItemImpl("gold_leaf"),
new ItemImpl("infused_iron"),
new ItemImpl("ancient_stick"),
new ColorChanger(),
new AuraCache("aura_cache", 400000),
new AuraCache("aura_trove", 1200000),
new ShockwaveCreator(),
new MultiblockMaker(),
new ItemImpl("bottle_two_the_rebottling"),
new AuraBottle(),
new ItemImpl("farming_stencil"),
new ItemImpl("sky_ingot"),
new Glowing("calling_spirit"),
new EffectPowder(),
new BirthSpirit(),
new MoverMinecart(),
new RangeVisualizer(),
new ItemImpl("clock_hand"),
new ItemImpl("token_joy"),
new ItemImpl("token_fear"),
new ItemImpl("token_anger"),
new ItemImpl("token_sorrow"),
new ItemImpl("token_euphoria"),
new ItemImpl("token_terror"),
new ItemImpl("token_rage"),
new ItemImpl("token_grief"),
new EnderAccess(),
new CaveFinder()
);
}
@SubscribeEvent
public static void registerTiles(RegistryEvent.Register<TileEntityType<?>> event) {
}
@SubscribeEvent
public static void registerPotions(RegistryEvent.Register<Effect> event) {
}
private static void registerPotion(Effect potion, String name) { private static void registerPotion(Effect potion, String name) {
potion.setPotionName("potion." + NaturesAura.MOD_ID + "." + name + ".name"); potion.setPotionName("potion." + NaturesAura.MOD_ID + "." + name + ".name");
@ -56,12 +198,13 @@ public final class ModRegistry {
} }
private static ItemGroup getTab(IModItem item) { private static ItemGroup getTab(IModItem item) {
if (item instanceof ICreativeItem) if (item instanceof ICreativeItem) {
return ((ICreativeItem) item).getTabToAdd(); return ((ICreativeItem) item).getGroupToAdd();
}
return null; return null;
} }
public static void preInit(FMLPreInitializationEvent event) { public static void preInit(FMLCommonSetupEvent event) {
for (IModItem item : ALL_ITEMS) { for (IModItem item : ALL_ITEMS) {
if (item instanceof Item) { if (item instanceof Item) {
registerItem((Item) item, item.getBaseName(), getTab(item)); registerItem((Item) item, item.getBaseName(), getTab(item));
@ -69,14 +212,16 @@ public final class ModRegistry {
Block block = (Block) item; Block block = (Block) item;
BlockItem itemBlock; BlockItem itemBlock;
if (item instanceof ICustomItemBlockProvider) if (item instanceof ICustomItemBlockProvider) {
itemBlock = ((ICustomItemBlockProvider) item).getItemBlock(); itemBlock = ((ICustomItemBlockProvider) item).getItemBlock();
else } else {
itemBlock = new BlockItem(block); itemBlock = new BlockItem(block);
}
registerBlock(block, item.getBaseName(), itemBlock, getTab(item)); registerBlock(block, item.getBaseName(), itemBlock, getTab(item));
} else if (item instanceof Effect) } else if (item instanceof Effect) {
registerPotion((Effect) item, item.getBaseName()); registerPotion((Effect) 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();
@ -88,22 +233,17 @@ public final class ModRegistry {
} }
} }
public static void init(FMLInitializationEvent event) { public static void init(FMLCommonSetupEvent event) {
for (IModItem item : ALL_ITEMS) { for (IModItem item : ALL_ITEMS) {
if (item instanceof IColorProvidingBlock) if (item instanceof IColorProvidingBlock) {
NaturesAura.proxy.addColorProvidingBlock((IColorProvidingBlock) item); NaturesAura.proxy.addColorProvidingBlock((IColorProvidingBlock) item);
if (item instanceof IColorProvidingItem) }
if (item instanceof IColorProvidingItem) {
NaturesAura.proxy.addColorProvidingItem((IColorProvidingItem) item); NaturesAura.proxy.addColorProvidingItem((IColorProvidingItem) item);
if (item instanceof ITESRProvider) }
if (item instanceof ITESRProvider) {
NaturesAura.proxy.registerTESR((ITESRProvider) item); NaturesAura.proxy.registerTESR((ITESRProvider) item);
item.onInit(event);
} }
} }
public static void postInit(FMLPostInitializationEvent event) {
for (IModItem item : ALL_ITEMS) {
item.onPostInit(event);
}
} }
} }

View file

@ -0,0 +1,67 @@
package de.ellpeck.naturesaura.reg;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.items.ModItems;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.IArmorMaterial;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.LazyLoadBase;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.SoundEvents;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.function.Supplier;
public enum NAArmorMaterial implements IArmorMaterial {
INFUSED(NaturesAura.MOD_ID + ":infused_iron", 19, new int[]{2, 5, 6, 2}, 16, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0F, () -> Ingredient.fromItems(ModItems.INFUSED_IRON));
private static final int[] MAX_DAMAGE_ARRAY = new int[]{13, 15, 16, 11};
private final String name;
private final int maxDamageFactor;
private final int[] damageReductionAmountArray;
private final int enchantability;
private final SoundEvent soundEvent;
private final float toughness;
private final LazyLoadBase<Ingredient> repairMaterial;
NAArmorMaterial(String nameIn, int maxDamageFactorIn, int[] damageReductionAmountsIn, int enchantabilityIn, SoundEvent equipSoundIn, float p_i48533_8_, Supplier<Ingredient> repairMaterialSupplier) {
this.name = nameIn;
this.maxDamageFactor = maxDamageFactorIn;
this.damageReductionAmountArray = damageReductionAmountsIn;
this.enchantability = enchantabilityIn;
this.soundEvent = equipSoundIn;
this.toughness = p_i48533_8_;
this.repairMaterial = new LazyLoadBase<>(repairMaterialSupplier);
}
public int getDurability(EquipmentSlotType slotIn) {
return MAX_DAMAGE_ARRAY[slotIn.getIndex()] * this.maxDamageFactor;
}
public int getDamageReductionAmount(EquipmentSlotType slotIn) {
return this.damageReductionAmountArray[slotIn.getIndex()];
}
public int getEnchantability() {
return this.enchantability;
}
public SoundEvent getSoundEvent() {
return this.soundEvent;
}
public Ingredient getRepairMaterial() {
return this.repairMaterial.getValue();
}
@OnlyIn(Dist.CLIENT)
public String getName() {
return this.name;
}
public float getToughness() {
return this.toughness;
}
}

View file

@ -0,0 +1,53 @@
package de.ellpeck.naturesaura.reg;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.items.ModItems;
import net.minecraft.item.IItemTier;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.LazyLoadBase;
import java.util.function.Supplier;
public enum NAItemTier implements IItemTier {
INFUSED(3, 300, 6.25F, 2.25F, 16, () -> Ingredient.fromItems(ModItems.INFUSED_IRON));
private final int harvestLevel;
private final int maxUses;
private final float efficiency;
private final float attackDamage;
private final int enchantability;
private final LazyLoadBase<Ingredient> repairMaterial;
NAItemTier(int harvestLevelIn, int maxUsesIn, float efficiencyIn, float attackDamageIn, int enchantabilityIn, Supplier<Ingredient> repairMaterialIn) {
this.harvestLevel = harvestLevelIn;
this.maxUses = maxUsesIn;
this.efficiency = efficiencyIn;
this.attackDamage = attackDamageIn;
this.enchantability = enchantabilityIn;
this.repairMaterial = new LazyLoadBase<>(repairMaterialIn);
}
public int getMaxUses() {
return this.maxUses;
}
public float getEfficiency() {
return this.efficiency;
}
public float getAttackDamage() {
return this.attackDamage;
}
public int getHarvestLevel() {
return this.harvestLevel;
}
public int getEnchantability() {
return this.enchantability;
}
public Ingredient getRepairMaterial() {
return this.repairMaterial.getValue();
}
}

View file

@ -0,0 +1,52 @@
# This is an example mods.toml file. It contains the data relating to the loading mods.
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
# The overall format is standard TOML format, v0.5.0.
# Note that there are a couple of TOML lists in this file.
# Find more information on toml format here: https://github.com/toml-lang/toml
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[28,)" #mandatory (28 is current forge version)
# A URL to refer people to when problems occur with this mod
issueTrackerURL="https://github.com/Quarris/NaturesAura" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId="naturesaura" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
version="r17" #mandatory
# A display name for the mod
displayName="Nature's Aura" #mandatory
# A URL to query for updates for this mod. See the JSON update specification <here>
#updateJSONURL="http://myurl.me/" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
#displayURL="http://example.com/" #optional
# A file name (in the root of the mod JAR) containing a logo for display
#logoFile="examplemod.png" #optional
# A text field displayed in the mod UI
#credits="" #optional
# A text field displayed in the mod UI
authors="Ellpeck" #optional
# The description text for the mod (multi line!) (#mandatory)
description='''
Nature's Aura is a Minecraft mod about collecting, using and replenishing the Aura naturally present in the world to create useful devices and unique mechanics.
'''
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.naturesaura]] #optional
# the modid of the dependency
modId="patchouli" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="[28,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
side="BOTH"
# Here's another dependency
#[[dependencies.naturesaura]]
# modId="minecraft"
# mandatory=true
# versionRange="[1.14.4]"
# ordering="NONE"
# side="BOTH"

View file

@ -0,0 +1,179 @@
{
"itemGroup.naturesaura": "Nature's Aura",
"tile.naturesaura.ancient_log.name": "Ancient Log",
"tile.naturesaura.ancient_bark.name": "Ancient Bark",
"tile.naturesaura.ancient_leaves.name": "Ancient Leaves",
"tile.naturesaura.ancient_sapling.name": "Ancient Sapling",
"tile.naturesaura.nature_altar.name": "Natural Altar",
"tile.naturesaura.decayed_leaves.name": "Decayed Leaves",
"tile.naturesaura.golden_leaves.name": "Golden Leaves",
"tile.naturesaura.gold_powder.name": "Gold Powder",
"tile.naturesaura.wood_stand.name": "Wooden Stand",
"tile.naturesaura.ancient_planks.name": "Ancient Planks",
"tile.naturesaura.infused_stone.name": "Infused Rock",
"tile.naturesaura.furnace_heater.name": "Extraneous Firestarter",
"tile.naturesaura.potion_generator.name": "Lingering Absorber",
"tile.naturesaura.aura_detector.name": "Aura Detector",
"tile.naturesaura.conversion_catalyst.name": "Transmutation Catalyst",
"tile.naturesaura.crushing_catalyst.name": "Crumbling Catalyst",
"tile.naturesaura.infused_stairs.name": "Infused Rock Stairs",
"tile.naturesaura.infused_slab.name": "Infused Rock Slab",
"tile.naturesaura.infused_slab_double.name": "Infused Rock Double Slab",
"tile.naturesaura.ancient_stairs.name": "Ancient Wood Stairs",
"tile.naturesaura.ancient_slab.name": "Ancient Wood Slab",
"tile.naturesaura.ancient_slab_double.name": "Ancient Wood Double Slab",
"tile.naturesaura.infused_brick.name": "Infused Brick",
"tile.naturesaura.infused_brick_stairs.name": "Infused Brick Stairs",
"tile.naturesaura.infused_brick_slab.name": "Infused Brick Slab",
"tile.naturesaura.infused_brick_slab_double.name": "Infused Brick Double Slab",
"tile.naturesaura.flower_generator.name": "Herbivorous Absorber",
"tile.naturesaura.placer.name": "Imperceptible Builder",
"tile.naturesaura.hopper_upgrade.name": "Hopper Enhancement",
"tile.naturesaura.field_creator.name": "Aura Field Creator",
"tile.naturesaura.oak_generator.name": "Canopy Diminisher",
"tile.naturesaura.infused_iron_block.name": "Infused Iron Block",
"tile.naturesaura.offering_table.name": "Offering Table",
"tile.naturesaura.pickup_stopper.name": "Item Grounder",
"tile.naturesaura.spawn_lamp.name": "Lamp of Sanctuary",
"tile.naturesaura.animal_generator.name": "Disentangler of Mortals",
"tile.naturesaura.end_flower.name": "Rose of Oblivion",
"tile.naturesaura.grated_chute.name": "Adept Hopper",
"tile.naturesaura.animal_spawner.name": "Altar of Birthing",
"tile.naturesaura.auto_crafter.name": "Automatic Constructor",
"tile.naturesaura.gold_brick.name": "Golden Stone Bricks",
"tile.naturesaura.rf_converter.name": "Energetic Aura Forge",
"tile.naturesaura.moss_generator.name": "Swamp Homi",
"tile.naturesaura.time_changer.name": "Shifting Sundial",
"tile.naturesaura.generator_limit_remover.name": "Creational Catalyst",
"tile.naturesaura.ender_crate.name": "Ender Crate",
"tile.naturesaura.powder_placer.name": "Powder Manipulator",
"tile.naturesaura.firework_generator.name": "Firecracker Gaze",
"tile.naturesaura.chunk_loader.name": "World Eye",
"tile.naturesaura.dimension_rail_overworld.name": "Rail of the Overworld",
"tile.naturesaura.dimension_rail_end.name": "Rail of the End",
"tile.naturesaura.dimension_rail_nether.name": "Rail of the Nether",
"tile.naturesaura.projectile_generator.name": "Shooting Mark",
"item.naturesaura.eye.name": "Environmental Eye",
"item.naturesaura.eye_improved.name": "Environmental Ocular",
"item.naturesaura.gold_fiber.name": "Brilliant Fiber",
"item.naturesaura.gold_leaf.name": "Gold Leaf",
"item.naturesaura.infused_iron.name": "Infused Iron",
"item.naturesaura.infused_iron_pickaxe.name": "Botanist's Pickaxe",
"item.naturesaura.infused_iron_axe.name": "Botanist's Handaxe",
"item.naturesaura.infused_iron_shovel.name": "Botanist's Shovel",
"item.naturesaura.infused_iron_sword.name": "Botanist's Blade",
"item.naturesaura.infused_iron_hoe.name": "Botanist's Hoe",
"item.naturesaura.ancient_stick.name": "Ancient Wood Rod",
"item.naturesaura.aura_cache.name": "Aura Cache",
"item.naturesaura.color_changer.name": "Bucket of Infinite Color",
"item.naturesaura.book.name": "Book of Natural Aura",
"item.naturesaura.shockwave_creator.name": "Amulet of Wrath",
"item.naturesaura.multiblock_maker.name": "Multiblock Maker",
"item.naturesaura.aura_bottle.naturesaura:overworld.name": "Bottled Sunlight",
"item.naturesaura.aura_bottle.naturesaura:nether.name": "Bottled Ghosts",
"item.naturesaura.aura_bottle.naturesaura:end.name": "Bottled Darkness",
"item.naturesaura.aura_bottle.naturesaura:other.name": "Bottled Substance",
"item.naturesaura.farming_stencil.name": "Farming Stencil",
"item.naturesaura.bottle_two_the_rebottling.name": "Bottle and Cork",
"item.naturesaura.sky_ingot.name": "Ingot of the Skies",
"item.naturesaura.calling_spirit.name": "Spirit of Calling",
"item.naturesaura.birth_spirit.name": "Spirit of Birthing",
"item.naturesaura.infused_iron_helmet.name": "Botanist's Headwear",
"item.naturesaura.infused_iron_chest.name": "Botanist's Chestplate",
"item.naturesaura.infused_iron_pants.name": "Botanist's Leggings",
"item.naturesaura.infused_iron_shoes.name": "Botanist's Shoes",
"item.naturesaura.effect_powder.naturesaura:plant_boost.name": "Powder of Steady Growth",
"item.naturesaura.effect_powder.naturesaura:cache_recharge.name": "Powder of no Storage",
"item.naturesaura.effect_powder.naturesaura:animal.name": "Powder of Fertility",
"item.naturesaura.effect_powder.naturesaura:ore_spawn.name": "Powder of the Bountiful Core",
"item.naturesaura.mover_cart.name": "Aura Attraction Cart",
"item.naturesaura.range_visualizer.name": "Mystical Magnifier",
"item.naturesaura.clock_hand.name": "Hand of Time",
"item.naturesaura.token_anger.name": "Token of Anger",
"item.naturesaura.token_euphoria.name": "Token of Euphoria",
"item.naturesaura.token_fear.name": "Token of Fear",
"item.naturesaura.token_grief.name": "Token of Grief",
"item.naturesaura.token_joy.name": "Token of Joy",
"item.naturesaura.token_rage.name": "Token of Rage",
"item.naturesaura.token_sorrow.name": "Token of Sorrow",
"item.naturesaura.token_terror.name": "Token of Terror",
"item.naturesaura.ender_access.name": "Ender Ocular",
"item.naturesaura.cave_finder.name": "Staff of Shadows",
"item.naturesaura.aura_trove.name": "Aura Trove",
"container.naturesaura.tree_ritual.name": "Ritual of the Forest",
"container.naturesaura.altar.name": "Natural Altar Infusion",
"container.naturesaura.offering.name": "Offering to the Gods",
"container.naturesaura.animal_spawner.name": "Altar of Birthing",
"info.naturesaura.aura_in_area": "Aura Around",
"info.naturesaura.book.landing": "$(aura) is a complicated matter, and creating, collecting and making use of it can be difficult.$(br)The $(item)Book of Natural Aura$() contains all the information one requires to do so.",
"info.naturesaura.book.subtitle": "The guide to Nature's Aura",
"info.naturesaura.stored_pos": "You jot down the position",
"info.naturesaura.connected": "You make a connection",
"info.naturesaura.same_position": "This seems to be the position from your notes...",
"info.naturesaura.too_far": "The distance seems too great...",
"info.naturesaura.stored_pos_gone": "Your notes seem out of date...",
"info.naturesaura.empty": "Empty",
"info.naturesaura.ender_crate": "Ender Crate: %s",
"info.naturesaura.ender_access": "Ender Ocular: %s",
"info.naturesaura.ender_name.missing": "No Ender Name",
"info.naturesaura.ender_name": "Ender Name: %s",
"info.naturesaura.range_visualizer.start": "You take note of the magnification...",
"info.naturesaura.range_visualizer.end": "You lose focus of the magnification...",
"info.naturesaura.range_visualizer.end_all": "You lose focus of all magnifications...",
"advancement.naturesaura.root": "Nature's Aura",
"advancement.naturesaura.root.desc": "Becoming a magical botanist",
"advancement.naturesaura.get_book": "Pages of Discovery",
"advancement.naturesaura.get_book.desc": "Create the Book of Natural Aura",
"advancement.naturesaura.gold_leaf": "Time = Brilliance",
"advancement.naturesaura.gold_leaf.desc": "Create and harvest a Brilliant Tree",
"advancement.naturesaura.wood_stand": "Powers of the Forest",
"advancement.naturesaura.wood_stand.desc": "Create a Wooden Stand for the Ritual of the Forest",
"advancement.naturesaura.altar": "Empowered",
"advancement.naturesaura.altar.desc": "Create a Natural Altar using the Ritual of the Forest",
"advancement.naturesaura.infused_materials": "Iron Factory",
"advancement.naturesaura.infused_materials.desc": "Use the Natural Altar to create Infused Iron",
"advancement.naturesaura.furnace_heater": "Cozy Warmth",
"advancement.naturesaura.furnace_heater.desc": "Create an Extraneous Firestarter to heat your furnace",
"advancement.naturesaura.placer": "Plop Plop Placement",
"advancement.naturesaura.placer.desc": "Create an Imperceptible Builder to place blocks for you",
"advancement.naturesaura.conversion_catalyst": "Not So Equivalent Exchange",
"advancement.naturesaura.conversion_catalyst.desc": "Create a Conversion Catalyst for easy material conversion",
"advancement.naturesaura.infused_tools": "Gear Up Intensifies",
"advancement.naturesaura.infused_tools.desc": "Create an Infused Iron Pickaxe and Blade",
"advancement.naturesaura.aura_bottle_overworld": "A Taste of Sunlight",
"advancement.naturesaura.aura_bottle_overworld.desc": "Collect Aura using a Bottle in the Overworld",
"advancement.naturesaura.aura_bottle_nether": "Spooky Scary Skeletons",
"advancement.naturesaura.aura_bottle_nether.desc": "Collect Aura using a Bottle in the Nether",
"advancement.naturesaura.aura_bottle_end": "Breathy Surroundings",
"advancement.naturesaura.aura_bottle_end.desc": "Collect Aura using a Bottle in the End",
"advancement.naturesaura.offering": "Yo God, Ya Want This?",
"advancement.naturesaura.offering.desc": "Create an Offering Table for the Offering to the Gods",
"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.aura_cache": "Ca-ching",
"advancement.naturesaura.aura_cache.desc": "Create an Aura Cache to store Aura in your inventory",
"advancement.naturesaura.positive_imbalance": "Luscious Surroundings",
"advancement.naturesaura.positive_imbalance.desc": "Create enough Aura to cause positive imbalance effects",
"advancement.naturesaura.negative_imbalance": "Deadly Day",
"advancement.naturesaura.negative_imbalance.desc": "Drain enough Aura to cause negative imbalance effects",
"advancement.naturesaura.end_flower": "Blue Lotus",
"advancement.naturesaura.end_flower.desc": "Kill the Ender Dragon to make a Rose of Oblivion grow",
"advancement.naturesaura.eye": "Suddenly I See",
"advancement.naturesaura.eye.desc": "Create an Environmental Eye to see the Aura in the area",
"advancement.naturesaura.eye_improved": "Suddenly I See a Lot Better",
"advancement.naturesaura.eye_improved.desc": "Create an Environmental Ocular to see Aura imbalance effects",
"advancement.naturesaura.range_visualizer": "I Spy With my Little Eye",
"advancement.naturesaura.range_visualizer.desc": "Create a Mystical Magnifier to see the range of your devices",
"command.naturesaura.aura.usage": "/naaura store|drain <amount> [range] OR /naaura reset <range>",
"potion.naturesaura.breathless.name": "Breathless",
"entity.naturesaura.effect_inhibitor.name": "Effect Powder",
"entity.naturesaura.mover_cart.name": "Aura Attraction Cart"
}

View file

@ -1,177 +0,0 @@
itemGroup.naturesaura=Nature's Aura
tile.naturesaura.ancient_log.name=Ancient Log
tile.naturesaura.ancient_bark.name=Ancient Bark
tile.naturesaura.ancient_leaves.name=Ancient Leaves
tile.naturesaura.ancient_sapling.name=Ancient Sapling
tile.naturesaura.nature_altar.name=Natural Altar
tile.naturesaura.decayed_leaves.name=Decayed Leaves
tile.naturesaura.golden_leaves.name=Golden Leaves
tile.naturesaura.gold_powder.name=Gold Powder
tile.naturesaura.wood_stand.name=Wooden Stand
tile.naturesaura.ancient_planks.name=Ancient Planks
tile.naturesaura.infused_stone.name=Infused Rock
tile.naturesaura.furnace_heater.name=Extraneous Firestarter
tile.naturesaura.potion_generator.name=Lingering Absorber
tile.naturesaura.aura_detector.name=Aura Detector
tile.naturesaura.conversion_catalyst.name=Transmutation Catalyst
tile.naturesaura.crushing_catalyst.name=Crumbling Catalyst
tile.naturesaura.infused_stairs.name=Infused Rock Stairs
tile.naturesaura.infused_slab.name=Infused Rock Slab
tile.naturesaura.infused_slab_double.name=Infused Rock Double Slab
tile.naturesaura.ancient_stairs.name=Ancient Wood Stairs
tile.naturesaura.ancient_slab.name=Ancient Wood Slab
tile.naturesaura.ancient_slab_double.name=Ancient Wood Double Slab
tile.naturesaura.infused_brick.name=Infused Brick
tile.naturesaura.infused_brick_stairs.name=Infused Brick Stairs
tile.naturesaura.infused_brick_slab.name=Infused Brick Slab
tile.naturesaura.infused_brick_slab_double.name=Infused Brick Double Slab
tile.naturesaura.flower_generator.name=Herbivorous Absorber
tile.naturesaura.placer.name=Imperceptible Builder
tile.naturesaura.hopper_upgrade.name=Hopper Enhancement
tile.naturesaura.field_creator.name=Aura Field Creator
tile.naturesaura.oak_generator.name=Canopy Diminisher
tile.naturesaura.infused_iron_block.name=Infused Iron Block
tile.naturesaura.offering_table.name=Offering Table
tile.naturesaura.pickup_stopper.name=Item Grounder
tile.naturesaura.spawn_lamp.name=Lamp of Sanctuary
tile.naturesaura.animal_generator.name=Disentangler of Mortals
tile.naturesaura.end_flower.name=Rose of Oblivion
tile.naturesaura.grated_chute.name=Adept Hopper
tile.naturesaura.animal_spawner.name=Altar of Birthing
tile.naturesaura.auto_crafter.name=Automatic Constructor
tile.naturesaura.gold_brick.name=Golden Stone Bricks
tile.naturesaura.rf_converter.name=Energetic Aura Forge
tile.naturesaura.moss_generator.name=Swamp Homi
tile.naturesaura.time_changer.name=Shifting Sundial
tile.naturesaura.generator_limit_remover.name=Creational Catalyst
tile.naturesaura.ender_crate.name=Ender Crate
tile.naturesaura.powder_placer.name=Powder Manipulator
tile.naturesaura.firework_generator.name=Firecracker Gaze
tile.naturesaura.chunk_loader.name=World Eye
tile.naturesaura.dimension_rail_overworld.name=Rail of the Overworld
tile.naturesaura.dimension_rail_end.name=Rail of the End
tile.naturesaura.dimension_rail_nether.name=Rail of the Nether
tile.naturesaura.projectile_generator.name=Shooting Mark
item.naturesaura.eye.name=Environmental Eye
item.naturesaura.eye_improved.name=Environmental Ocular
item.naturesaura.gold_fiber.name=Brilliant Fiber
item.naturesaura.gold_leaf.name=Gold Leaf
item.naturesaura.infused_iron.name=Infused Iron
item.naturesaura.infused_iron_pickaxe.name=Botanist's Pickaxe
item.naturesaura.infused_iron_axe.name=Botanist's Handaxe
item.naturesaura.infused_iron_shovel.name=Botanist's Shovel
item.naturesaura.infused_iron_sword.name=Botanist's Blade
item.naturesaura.infused_iron_hoe.name=Botanist's Hoe
item.naturesaura.ancient_stick.name=Ancient Wood Rod
item.naturesaura.aura_cache.name=Aura Cache
item.naturesaura.color_changer.name=Bucket of Infinite Color
item.naturesaura.book.name=Book of Natural Aura
item.naturesaura.shockwave_creator.name=Amulet of Wrath
item.naturesaura.multiblock_maker.name=Multiblock Maker
item.naturesaura.aura_bottle.naturesaura:overworld.name=Bottled Sunlight
item.naturesaura.aura_bottle.naturesaura:nether.name=Bottled Ghosts
item.naturesaura.aura_bottle.naturesaura:end.name=Bottled Darkness
item.naturesaura.aura_bottle.naturesaura:other.name=Bottled Substance
item.naturesaura.farming_stencil.name=Farming Stencil
item.naturesaura.bottle_two_the_rebottling.name=Bottle and Cork
item.naturesaura.sky_ingot.name=Ingot of the Skies
item.naturesaura.calling_spirit.name=Spirit of Calling
item.naturesaura.birth_spirit.name=Spirit of Birthing
item.naturesaura.infused_iron_helmet.name=Botanist's Headwear
item.naturesaura.infused_iron_chest.name=Botanist's Chestplate
item.naturesaura.infused_iron_pants.name=Botanist's Leggings
item.naturesaura.infused_iron_shoes.name=Botanist's Shoes
item.naturesaura.effect_powder.naturesaura:plant_boost.name=Powder of Steady Growth
item.naturesaura.effect_powder.naturesaura:cache_recharge.name=Powder of no Storage
item.naturesaura.effect_powder.naturesaura:animal.name=Powder of Fertility
item.naturesaura.effect_powder.naturesaura:ore_spawn.name=Powder of the Bountiful Core
item.naturesaura.mover_cart.name=Aura Attraction Cart
item.naturesaura.range_visualizer.name=Mystical Magnifier
item.naturesaura.clock_hand.name=Hand of Time
item.naturesaura.token_anger.name=Token of Anger
item.naturesaura.token_euphoria.name=Token of Euphoria
item.naturesaura.token_fear.name=Token of Fear
item.naturesaura.token_grief.name=Token of Grief
item.naturesaura.token_joy.name=Token of Joy
item.naturesaura.token_rage.name=Token of Rage
item.naturesaura.token_sorrow.name=Token of Sorrow
item.naturesaura.token_terror.name=Token of Terror
item.naturesaura.ender_access.name=Ender Ocular
item.naturesaura.cave_finder.name=Staff of Shadows
item.naturesaura.aura_trove.name=Aura Trove
container.naturesaura.tree_ritual.name=Ritual of the Forest
container.naturesaura.altar.name=Natural Altar Infusion
container.naturesaura.offering.name=Offering to the Gods
container.naturesaura.animal_spawner.name=Altar of Birthing
info.naturesaura.aura_in_area=Aura Around
info.naturesaura.book.landing=$(aura) is a complicated matter, and creating, collecting and making use of it can be difficult.$(br)The $(item)Book of Natural Aura$() contains all the information one requires to do so.
info.naturesaura.book.subtitle=The guide to Nature's Aura
info.naturesaura.stored_pos=You jot down the position
info.naturesaura.connected=You make a connection
info.naturesaura.same_position=This seems to be the position from your notes...
info.naturesaura.too_far=The distance seems too great...
info.naturesaura.stored_pos_gone=Your notes seem out of date...
info.naturesaura.empty=Empty
info.naturesaura.ender_crate=Ender Crate: %s
info.naturesaura.ender_access=Ender Ocular: %s
info.naturesaura.ender_name.missing=No Ender Name
info.naturesaura.ender_name=Ender Name: %s
info.naturesaura.range_visualizer.start=You take note of the magnification...
info.naturesaura.range_visualizer.end=You lose focus of the magnification...
info.naturesaura.range_visualizer.end_all=You lose focus of all magnifications...
advancement.naturesaura.root=Nature's Aura
advancement.naturesaura.root.desc=Becoming a magical botanist
advancement.naturesaura.get_book=Pages of Discovery
advancement.naturesaura.get_book.desc=Create the Book of Natural Aura
advancement.naturesaura.gold_leaf=Time = Brilliance
advancement.naturesaura.gold_leaf.desc=Create and harvest a Brilliant Tree
advancement.naturesaura.wood_stand=Powers of the Forest
advancement.naturesaura.wood_stand.desc=Create a Wooden Stand for the Ritual of the Forest
advancement.naturesaura.altar=Empowered
advancement.naturesaura.altar.desc=Create a Natural Altar using the Ritual of the Forest
advancement.naturesaura.infused_materials=Iron Factory
advancement.naturesaura.infused_materials.desc=Use the Natural Altar to create Infused Iron
advancement.naturesaura.furnace_heater=Cozy Warmth
advancement.naturesaura.furnace_heater.desc=Create an Extraneous Firestarter to heat your furnace
advancement.naturesaura.placer=Plop Plop Placement
advancement.naturesaura.placer.desc=Create an Imperceptible Builder to place blocks for you
advancement.naturesaura.conversion_catalyst=Not So Equivalent Exchange
advancement.naturesaura.conversion_catalyst.desc=Create a Conversion Catalyst for easy material conversion
advancement.naturesaura.infused_tools=Gear Up Intensifies
advancement.naturesaura.infused_tools.desc=Create an Infused Iron Pickaxe and Blade
advancement.naturesaura.aura_bottle_overworld=A Taste of Sunlight
advancement.naturesaura.aura_bottle_overworld.desc=Collect Aura using a Bottle in the Overworld
advancement.naturesaura.aura_bottle_nether=Spooky Scary Skeletons
advancement.naturesaura.aura_bottle_nether.desc=Collect Aura using a Bottle in the Nether
advancement.naturesaura.aura_bottle_end=Breathy Surroundings
advancement.naturesaura.aura_bottle_end.desc=Collect Aura using a Bottle in the End
advancement.naturesaura.offering=Yo God, Ya Want This?
advancement.naturesaura.offering.desc=Create an Offering Table for the Offering to the Gods
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.aura_cache=Ca-ching
advancement.naturesaura.aura_cache.desc=Create an Aura Cache to store Aura in your inventory
advancement.naturesaura.positive_imbalance=Luscious Surroundings
advancement.naturesaura.positive_imbalance.desc=Create enough Aura to cause positive imbalance effects
advancement.naturesaura.negative_imbalance=Deadly Day
advancement.naturesaura.negative_imbalance.desc=Drain enough Aura to cause negative imbalance effects
advancement.naturesaura.end_flower=Blue Lotus
advancement.naturesaura.end_flower.desc=Kill the Ender Dragon to make a Rose of Oblivion grow
advancement.naturesaura.eye=Suddenly I See
advancement.naturesaura.eye.desc=Create an Environmental Eye to see the Aura in the area
advancement.naturesaura.eye_improved=Suddenly I See a Lot Better
advancement.naturesaura.eye_improved.desc=Create an Environmental Ocular to see Aura imbalance effects
advancement.naturesaura.range_visualizer=I Spy With my Little Eye
advancement.naturesaura.range_visualizer.desc=Create a Mystical Magnifier to see the range of your devices
command.naturesaura.aura.usage=/naaura store|drain <amount> [range] OR /naaura reset <range>
potion.naturesaura.breathless.name=Breathless
entity.naturesaura.effect_inhibitor.name=Effect Powder
entity.naturesaura.mover_cart.name=Aura Attraction Cart

View file

@ -0,0 +1,171 @@
{
"itemGroup.naturesaura": "Nature's Aura",
"tile.naturesaura.ancient_log.name": "Древнее дерево",
"tile.naturesaura.ancient_bark.name": "Древняя кора",
"tile.naturesaura.ancient_leaves.name": "Древние листья",
"tile.naturesaura.ancient_sapling.name": "Древний cаженец",
"tile.naturesaura.nature_altar.name": "Природный алтарь",
"tile.naturesaura.decayed_leaves.name": "Гнилые листья",
"tile.naturesaura.golden_leaves.name": "Золотые листья",
"tile.naturesaura.gold_powder.name": "Золотой порошок",
"tile.naturesaura.wood_stand.name": "Деревянная подставка",
"tile.naturesaura.ancient_planks.name": "Древние доски",
"tile.naturesaura.infused_stone.name": "Инфузионный камень",
"tile.naturesaura.furnace_heater.name": "Внешний поджигатель",
"tile.naturesaura.potion_generator.name": "Затяжной поглотитель",
"tile.naturesaura.aura_detector.name": "Детектор ауры",
"tile.naturesaura.conversion_catalyst.name": "Трансмутационный катализатор",
"tile.naturesaura.crushing_catalyst.name": "Разрушающий катализатор",
"tile.naturesaura.infused_stairs.name": "Ступеньки из инфузионного камня",
"tile.naturesaura.infused_slab.name": "Плита из инфузионного камня",
"tile.naturesaura.infused_slab_double.name": "Двойная плита из инфузионного камня",
"tile.naturesaura.ancient_stairs.name": "Ступеньки из древнего дерева",
"tile.naturesaura.ancient_slab.name": "Плита из древнего дерева",
"tile.naturesaura.ancient_slab_double.name": "Двойная плита из древнего дерева",
"tile.naturesaura.infused_brick.name": "Инфузионный кирпич",
"tile.naturesaura.infused_brick_stairs.name": "Ступеньки из инфузионного кирпича",
"tile.naturesaura.infused_brick_slab.name": "Плита из инфузионного кирпича",
"tile.naturesaura.infused_brick_slab_double.name": "Двойная плита из инфузионного кирпича",
"tile.naturesaura.flower_generator.name": "Травоядный поглотитель",
"tile.naturesaura.placer.name": "Незаметный строитель",
"tile.naturesaura.hopper_upgrade.name": "Улучшенная воронка",
"tile.naturesaura.field_creator.name": "Создатель поля ауры",
"tile.naturesaura.oak_generator.name": "Уменьшитель купола",
"tile.naturesaura.infused_iron_block.name": "Инфузионный железный блок",
"tile.naturesaura.offering_table.name": "Стол подношения",
"tile.naturesaura.pickup_stopper.name": "Предметный заземлитель",
"tile.naturesaura.spawn_lamp.name": "Лампа святилища",
"tile.naturesaura.animal_generator.name": "Распутыватель смертных",
"tile.naturesaura.end_flower.name": "Роза забвения",
"tile.naturesaura.grated_chute.name": "Искусная воронка",
"tile.naturesaura.animal_spawner.name": "Алтарь рождения",
"tile.naturesaura.auto_crafter.name": "Автоматический конструктор",
"tile.naturesaura.gold_brick.name": "Золотые каменные кирпичи",
"tile.naturesaura.rf_converter.name": "Энергетическая аура кузницы",
"tile.naturesaura.moss_generator.name": "Болотный Хоми",
"tile.naturesaura.time_changer.name": "Изменяющиеся солнечные часы",
"tile.naturesaura.generator_limit_remover.name": "Творческий катализатор",
"tile.naturesaura.ender_crate.name": "Эндер ящик",
"tile.naturesaura.powder_placer.name": "Порошковый манипулятор",
"tile.naturesaura.firework_generator.name": "Взгляд фейерверка",
"tile.naturesaura.chunk_loader.name": "Мировой глаз",
"tile.naturesaura.dimension_rail_overworld.name": "Рельса верхнего мира",
"tile.naturesaura.dimension_rail_end.name": "Рельса эндера",
"tile.naturesaura.dimension_rail_nether.name": "Рельса нижнего мира",
"tile.naturesaura.projectile_generator.name": "Стрельбище в метку",
"item.naturesaura.eye.name": "Экологический глаз",
"item.naturesaura.eye_improved.name": "Экологический окуляр",
"item.naturesaura.gold_fiber.name": "Блестящее волокно",
"item.naturesaura.gold_leaf.name": "Золотой лист",
"item.naturesaura.infused_iron.name": "Инфузионное железо",
"item.naturesaura.infused_iron_pickaxe.name": "Кирка ботаника",
"item.naturesaura.infused_iron_axe.name": "Топор ботаника",
"item.naturesaura.infused_iron_shovel.name": "Лопата ботаника",
"item.naturesaura.infused_iron_sword.name": "Меч ботаника",
"item.naturesaura.infused_iron_hoe.name": "Мотыга ботаника",
"item.naturesaura.ancient_stick.name": "Палочка из древнего дерева",
"item.naturesaura.aura_cache.name": "Кэш ауры",
"item.naturesaura.color_changer.name": "Ведро бесконечного цвета",
"item.naturesaura.book.name": "Книга природной ауры",
"item.naturesaura.shockwave_creator.name": "Амулет гнева",
"item.naturesaura.multiblock_maker.name": "Многоблочный создатель",
"item.naturesaura.aura_bottle.naturesaura:overworld.name": "Бутилированный солнечный свет",
"item.naturesaura.aura_bottle.naturesaura:nether.name": "Бутилированные призраки",
"item.naturesaura.aura_bottle.naturesaura:end.name": "Бутилированная тьма",
"item.naturesaura.aura_bottle.naturesaura:other.name": "Бутилированное вещество",
"item.naturesaura.farming_stencil.name": "Фермерский трафарет",
"item.naturesaura.bottle_two_the_rebottling.name": "Бутылка и пробка",
"item.naturesaura.sky_ingot.name": "Слиток небес",
"item.naturesaura.calling_spirit.name": "Дух призыва",
"item.naturesaura.birth_spirit.name": "Дух рождения",
"item.naturesaura.infused_iron_helmet.name": "Шлем ботаника",
"item.naturesaura.infused_iron_chest.name": "Нагрудник ботаника",
"item.naturesaura.infused_iron_pants.name": "Поножи ботаника",
"item.naturesaura.infused_iron_shoes.name": "Ботинки ботаника",
"item.naturesaura.effect_powder.naturesaura:plant_boost.name": "Порошок устойчивого роста",
"item.naturesaura.effect_powder.naturesaura:cache_recharge.name": "Порошок без хранения",
"item.naturesaura.effect_powder.naturesaura:animal.name": "Порошок плодородия",
"item.naturesaura.effect_powder.naturesaura:ore_spawn.name": "Порошок обильного ядра",
"item.naturesaura.mover_cart.name": "Вагонетка притягивания ауры",
"item.naturesaura.range_visualizer.name": "Мистическая лупа",
"item.naturesaura.clock_hand.name": "Рука времени",
"item.naturesaura.token_anger.name": "Знак гнева",
"item.naturesaura.token_euphoria.name": "Знак эйфории",
"item.naturesaura.token_fear.name": "Знак страха",
"item.naturesaura.token_grief.name": "Знак горя",
"item.naturesaura.token_joy.name": "Знак радости",
"item.naturesaura.token_rage.name": "Знак ярости",
"item.naturesaura.token_sorrow.name": "Знак скорби",
"item.naturesaura.token_terror.name": "Знак террора",
"item.naturesaura.ender_access.name": "Эндер окуляр",
"item.naturesaura.cave_finder.name": "Посох Теней",
"item.naturesaura.aura_trove.name": "Аура сокровищница",
"container.naturesaura.tree_ritual.name": "Ритуал леса",
"container.naturesaura.altar.name": "Инфузия природного алтаря",
"container.naturesaura.offering.name": "Подношения богам",
"container.naturesaura.animal_spawner.name": "Алтарь рождения",
"info.naturesaura.aura_in_area": "Аура вокруг",
"info.naturesaura.book.landing": "$(aura) сложная материя, и создавать, собирать и использовать ее может быть трудно.$(br)$(item)Книга природной ауры$() содержит всю информацию, необходимую для этого.",
"info.naturesaura.book.subtitle": "Руководство по природной ауре",
"info.naturesaura.stored_pos": "Вы записываете позицию",
"info.naturesaura.connected": "Вы делаете соединение",
"info.naturesaura.same_position": "Это похоже на позицию из ваших заметок...",
"info.naturesaura.too_far": "Расстояние кажется слишком большим...",
"info.naturesaura.stored_pos_gone": "Ваши заметки кажутся устаревшими...",
"info.naturesaura.empty": "Пусто",
"info.naturesaura.ender_crate": "Эндер ящик: %s",
"info.naturesaura.ender_access": "Эндер окуляр: %s",
"info.naturesaura.ender_name.missing": "Нет эндер названия",
"info.naturesaura.ender_name": "Эндер название: %s",
"info.naturesaura.range_visualizer.start": "Вы принимаете во внимание усиление...",
"info.naturesaura.range_visualizer.end": "Вы теряете фокус увеличения...",
"info.naturesaura.range_visualizer.end_all": "Вы теряете фокус всех увеличений...",
"advancement.naturesaura.root": "Природная аура",
"advancement.naturesaura.root.desc": "Стать волшебным ботаником",
"advancement.naturesaura.get_book": "Страницы открытия",
"advancement.naturesaura.get_book.desc": "Создайте книгу природной ауры",
"advancement.naturesaura.gold_leaf": "Time = Блеск",
"advancement.naturesaura.gold_leaf.desc": "Создайте и соберите блестящее дерево",
"advancement.naturesaura.wood_stand": "Силы леса",
"advancement.naturesaura.wood_stand.desc": "Создайте деревянную подставку для ритуала леса",
"advancement.naturesaura.altar": "Наделенный силой",
"advancement.naturesaura.altar.desc": "Создайте природный алтарь, используя ритуал леса",
"advancement.naturesaura.infused_materials": "Железный завод",
"advancement.naturesaura.infused_materials.desc": "Используйте природный алтарь для создания инфузионного железа",
"advancement.naturesaura.furnace_heater": "Уютное тепло",
"advancement.naturesaura.furnace_heater.desc": "Создайте внешний поджигатель, чтобы нагреть вашу печь",
"advancement.naturesaura.placer": "Хлоп-хлоп размещение",
"advancement.naturesaura.placer.desc": "Создайте незаметный строитель, чтобы разместить блоки для вас",
"advancement.naturesaura.conversion_catalyst": "Не такой эквивалентный обмен",
"advancement.naturesaura.conversion_catalyst.desc": "Создайте конверсионный катализатор для легкой конверсии материала",
"advancement.naturesaura.infused_tools": "Готовьтесь усиливается",
"advancement.naturesaura.infused_tools.desc": "Создайте инфузионную железную кирку и меч",
"advancement.naturesaura.aura_bottle_overworld": "Вкус солнечного света",
"advancement.naturesaura.aura_bottle_overworld.desc": "Соберите ауру, используя бутылку в верхнем мире",
"advancement.naturesaura.aura_bottle_nether": "Жуткие страшные скелеты",
"advancement.naturesaura.aura_bottle_nether.desc": "Соберите ауру, используя бутылку в нижнем мире",
"advancement.naturesaura.aura_bottle_end": "Дыхание окрестности",
"advancement.naturesaura.aura_bottle_end.desc": "Соберите ауру, используя бутылку в энде",
"advancement.naturesaura.offering": "Эй Боже, ты хочешь это?",
"advancement.naturesaura.offering.desc": "Создать стол подношений для подношения богам",
"advancement.naturesaura.sky_ingot": "Крепкий и легкий",
"advancement.naturesaura.sky_ingot.desc": "Создайте слиток небес, используя подношение богам",
"advancement.naturesaura.aura_cache": "Кэширование",
"advancement.naturesaura.aura_cache.desc": "Создайте кэш ауры для хранения ауры в вашем инвентаре",
"advancement.naturesaura.positive_imbalance": "Сочные окрестности",
"advancement.naturesaura.positive_imbalance.desc": "Создайте достаточно ауры, чтобы вызвать положительный эффект дисбаланса",
"advancement.naturesaura.negative_imbalance": "Смертельный день",
"advancement.naturesaura.negative_imbalance.desc": "Слейте достаточно ауры, чтобы вызвать негативные последствия дисбаланса",
"advancement.naturesaura.end_flower": "Синий лотос",
"advancement.naturesaura.end_flower.desc": "Убейте дракона края, чтобы вырастить розу забвения",
"advancement.naturesaura.eye": "Внезапно я вижу",
"advancement.naturesaura.eye.desc": "Создайте экологический глаз, чтобы увидеть ауру в области",
"advancement.naturesaura.eye_improved": "Внезапно я вижу намного лучше",
"advancement.naturesaura.eye_improved.desc": "Создайте экологический окуляр, чтобы увидеть эффекты дисбаланса ауры",
"advancement.naturesaura.range_visualizer": "Я шпионю своим маленьким глазом",
"advancement.naturesaura.range_visualizer.desc": "Создайте мистическую лупу, чтобы увидеть диапазон ваших устройств",
"command.naturesaura.aura.usage": "/naaura store|drain <amount> [range] ИЛИ /naaura reset <range>",
"potion.naturesaura.breathless.name": "Дыхание",
"entity.naturesaura.effect_inhibitor.name": "Эффектный порошок",
"entity.naturesaura.mover_cart.name": "Вагонетка притягивания ауры"
}

View file

@ -1,177 +0,0 @@
itemGroup.naturesaura=Nature's Aura
tile.naturesaura.ancient_log.name=Древнее дерево
tile.naturesaura.ancient_bark.name=Древняя кора
tile.naturesaura.ancient_leaves.name=Древние листья
tile.naturesaura.ancient_sapling.name=Древний cаженец
tile.naturesaura.nature_altar.name=Природный алтарь
tile.naturesaura.decayed_leaves.name=Гнилые листья
tile.naturesaura.golden_leaves.name=Золотые листья
tile.naturesaura.gold_powder.name=Золотой порошок
tile.naturesaura.wood_stand.name=Деревянная подставка
tile.naturesaura.ancient_planks.name=Древние доски
tile.naturesaura.infused_stone.name=Инфузионный камень
tile.naturesaura.furnace_heater.name=Внешний поджигатель
tile.naturesaura.potion_generator.name=Затяжной поглотитель
tile.naturesaura.aura_detector.name=Детектор ауры
tile.naturesaura.conversion_catalyst.name=Трансмутационный катализатор
tile.naturesaura.crushing_catalyst.name=Разрушающий катализатор
tile.naturesaura.infused_stairs.name=Ступеньки из инфузионного камня
tile.naturesaura.infused_slab.name=Плита из инфузионного камня
tile.naturesaura.infused_slab_double.name=Двойная плита из инфузионного камня
tile.naturesaura.ancient_stairs.name=Ступеньки из древнего дерева
tile.naturesaura.ancient_slab.name=Плита из древнего дерева
tile.naturesaura.ancient_slab_double.name=Двойная плита из древнего дерева
tile.naturesaura.infused_brick.name=Инфузионный кирпич
tile.naturesaura.infused_brick_stairs.name=Ступеньки из инфузионного кирпича
tile.naturesaura.infused_brick_slab.name=Плита из инфузионного кирпича
tile.naturesaura.infused_brick_slab_double.name=Двойная плита из инфузионного кирпича
tile.naturesaura.flower_generator.name=Травоядный поглотитель
tile.naturesaura.placer.name=Незаметный строитель
tile.naturesaura.hopper_upgrade.name=Улучшенная воронка
tile.naturesaura.field_creator.name=Создатель поля ауры
tile.naturesaura.oak_generator.name=Уменьшитель купола
tile.naturesaura.infused_iron_block.name=Инфузионный железный блок
tile.naturesaura.offering_table.name=Стол подношения
tile.naturesaura.pickup_stopper.name=Предметный заземлитель
tile.naturesaura.spawn_lamp.name=Лампа святилища
tile.naturesaura.animal_generator.name=Распутыватель смертных
tile.naturesaura.end_flower.name=Роза забвения
tile.naturesaura.grated_chute.name=Искусная воронка
tile.naturesaura.animal_spawner.name=Алтарь рождения
tile.naturesaura.auto_crafter.name=Автоматический конструктор
tile.naturesaura.gold_brick.name=Золотые каменные кирпичи
tile.naturesaura.rf_converter.name=Энергетическая аура кузницы
tile.naturesaura.moss_generator.name=Болотный Хоми
tile.naturesaura.time_changer.name=Изменяющиеся солнечные часы
tile.naturesaura.generator_limit_remover.name=Творческий катализатор
tile.naturesaura.ender_crate.name=Эндер ящик
tile.naturesaura.powder_placer.name=Порошковый манипулятор
tile.naturesaura.firework_generator.name=Взгляд фейерверка
tile.naturesaura.chunk_loader.name=Мировой глаз
tile.naturesaura.dimension_rail_overworld.name=Рельса верхнего мира
tile.naturesaura.dimension_rail_end.name=Рельса эндера
tile.naturesaura.dimension_rail_nether.name=Рельса нижнего мира
tile.naturesaura.projectile_generator.name=Стрельбище в метку
item.naturesaura.eye.name=Экологический глаз
item.naturesaura.eye_improved.name=Экологический окуляр
item.naturesaura.gold_fiber.name=Блестящее волокно
item.naturesaura.gold_leaf.name=Золотой лист
item.naturesaura.infused_iron.name=Инфузионное железо
item.naturesaura.infused_iron_pickaxe.name=Кирка ботаника
item.naturesaura.infused_iron_axe.name=Топор ботаника
item.naturesaura.infused_iron_shovel.name=Лопата ботаника
item.naturesaura.infused_iron_sword.name=Меч ботаника
item.naturesaura.infused_iron_hoe.name=Мотыга ботаника
item.naturesaura.ancient_stick.name=Палочка из древнего дерева
item.naturesaura.aura_cache.name=Кэш ауры
item.naturesaura.color_changer.name=Ведро бесконечного цвета
item.naturesaura.book.name=Книга природной ауры
item.naturesaura.shockwave_creator.name=Амулет гнева
item.naturesaura.multiblock_maker.name=Многоблочный создатель
item.naturesaura.aura_bottle.naturesaura:overworld.name=Бутилированный солнечный свет
item.naturesaura.aura_bottle.naturesaura:nether.name=Бутилированные призраки
item.naturesaura.aura_bottle.naturesaura:end.name=Бутилированная тьма
item.naturesaura.aura_bottle.naturesaura:other.name=Бутилированное вещество
item.naturesaura.farming_stencil.name=Фермерский трафарет
item.naturesaura.bottle_two_the_rebottling.name=Бутылка и пробка
item.naturesaura.sky_ingot.name=Слиток небес
item.naturesaura.calling_spirit.name=Дух призыва
item.naturesaura.birth_spirit.name=Дух рождения
item.naturesaura.infused_iron_helmet.name=Шлем ботаника
item.naturesaura.infused_iron_chest.name=Нагрудник ботаника
item.naturesaura.infused_iron_pants.name=Поножи ботаника
item.naturesaura.infused_iron_shoes.name=Ботинки ботаника
item.naturesaura.effect_powder.naturesaura:plant_boost.name=Порошок устойчивого роста
item.naturesaura.effect_powder.naturesaura:cache_recharge.name=Порошок без хранения
item.naturesaura.effect_powder.naturesaura:animal.name=Порошок плодородия
item.naturesaura.effect_powder.naturesaura:ore_spawn.name=Порошок обильного ядра
item.naturesaura.mover_cart.name=Вагонетка притягивания ауры
item.naturesaura.range_visualizer.name=Мистическая лупа
item.naturesaura.clock_hand.name=Рука времени
item.naturesaura.token_anger.name=Знак гнева
item.naturesaura.token_euphoria.name=Знак эйфории
item.naturesaura.token_fear.name=Знак страха
item.naturesaura.token_grief.name=Знак горя
item.naturesaura.token_joy.name=Знак радости
item.naturesaura.token_rage.name=Знак ярости
item.naturesaura.token_sorrow.name=Знак скорби
item.naturesaura.token_terror.name=Знак террора
item.naturesaura.ender_access.name=Эндер окуляр
item.naturesaura.cave_finder.name=Посох Теней
item.naturesaura.aura_trove.name=Аура сокровищница
container.naturesaura.tree_ritual.name=Ритуал леса
container.naturesaura.altar.name=Инфузия природного алтаря
container.naturesaura.offering.name=Подношения богам
container.naturesaura.animal_spawner.name=Алтарь рождения
info.naturesaura.aura_in_area=Аура вокруг
info.naturesaura.book.landing=$(aura) сложная материя, и создавать, собирать и использовать ее может быть трудно.$(br)$(item)Книга природной ауры$() содержит всю информацию, необходимую для этого.
info.naturesaura.book.subtitle=Руководство по природной ауре
info.naturesaura.stored_pos=Вы записываете позицию
info.naturesaura.connected=Вы делаете соединение
info.naturesaura.same_position=Это похоже на позицию из ваших заметок...
info.naturesaura.too_far=Расстояние кажется слишком большим...
info.naturesaura.stored_pos_gone=Ваши заметки кажутся устаревшими...
info.naturesaura.empty=Пусто
info.naturesaura.ender_crate=Эндер ящик: %s
info.naturesaura.ender_access=Эндер окуляр: %s
info.naturesaura.ender_name.missing=Нет эндер названия
info.naturesaura.ender_name=Эндер название: %s
info.naturesaura.range_visualizer.start=Вы принимаете во внимание усиление...
info.naturesaura.range_visualizer.end=Вы теряете фокус увеличения...
info.naturesaura.range_visualizer.end_all=Вы теряете фокус всех увеличений...
advancement.naturesaura.root=Природная аура
advancement.naturesaura.root.desc=Стать волшебным ботаником
advancement.naturesaura.get_book=Страницы открытия
advancement.naturesaura.get_book.desc=Создайте книгу природной ауры
advancement.naturesaura.gold_leaf=Time = Блеск
advancement.naturesaura.gold_leaf.desc=Создайте и соберите блестящее дерево
advancement.naturesaura.wood_stand=Силы леса
advancement.naturesaura.wood_stand.desc=Создайте деревянную подставку для ритуала леса
advancement.naturesaura.altar=Наделенный силой
advancement.naturesaura.altar.desc=Создайте природный алтарь, используя ритуал леса
advancement.naturesaura.infused_materials=Железный завод
advancement.naturesaura.infused_materials.desc=Используйте природный алтарь для создания инфузионного железа
advancement.naturesaura.furnace_heater=Уютное тепло
advancement.naturesaura.furnace_heater.desc=Создайте внешний поджигатель, чтобы нагреть вашу печь
advancement.naturesaura.placer=Хлоп-хлоп размещение
advancement.naturesaura.placer.desc=Создайте незаметный строитель, чтобы разместить блоки для вас
advancement.naturesaura.conversion_catalyst=Не такой эквивалентный обмен
advancement.naturesaura.conversion_catalyst.desc=Создайте конверсионный катализатор для легкой конверсии материала
advancement.naturesaura.infused_tools=Готовьтесь усиливается
advancement.naturesaura.infused_tools.desc=Создайте инфузионную железную кирку и меч
advancement.naturesaura.aura_bottle_overworld=Вкус солнечного света
advancement.naturesaura.aura_bottle_overworld.desc=Соберите ауру, используя бутылку в верхнем мире
advancement.naturesaura.aura_bottle_nether=Жуткие страшные скелеты
advancement.naturesaura.aura_bottle_nether.desc=Соберите ауру, используя бутылку в нижнем мире
advancement.naturesaura.aura_bottle_end=Дыхание окрестности
advancement.naturesaura.aura_bottle_end.desc=Соберите ауру, используя бутылку в энде
advancement.naturesaura.offering=Эй Боже, ты хочешь это?
advancement.naturesaura.offering.desc=Создать стол подношений для подношения богам
advancement.naturesaura.sky_ingot=Крепкий и легкий
advancement.naturesaura.sky_ingot.desc=Создайте слиток небес, используя подношение богам
advancement.naturesaura.aura_cache=Кэширование
advancement.naturesaura.aura_cache.desc=Создайте кэш ауры для хранения ауры в вашем инвентаре
advancement.naturesaura.positive_imbalance=Сочные окрестности
advancement.naturesaura.positive_imbalance.desc=Создайте достаточно ауры, чтобы вызвать положительный эффект дисбаланса
advancement.naturesaura.negative_imbalance=Смертельный день
advancement.naturesaura.negative_imbalance.desc=Слейте достаточно ауры, чтобы вызвать негативные последствия дисбаланса
advancement.naturesaura.end_flower=Синий лотос
advancement.naturesaura.end_flower.desc=Убейте дракона края, чтобы вырастить розу забвения
advancement.naturesaura.eye=Внезапно я вижу
advancement.naturesaura.eye.desc=Создайте экологический глаз, чтобы увидеть ауру в области
advancement.naturesaura.eye_improved=Внезапно я вижу намного лучше
advancement.naturesaura.eye_improved.desc=Создайте экологический окуляр, чтобы увидеть эффекты дисбаланса ауры
advancement.naturesaura.range_visualizer=Я шпионю своим маленьким глазом
advancement.naturesaura.range_visualizer.desc=Создайте мистическую лупу, чтобы увидеть диапазон ваших устройств
command.naturesaura.aura.usage=/naaura store|drain <amount> [range] ИЛИ /naaura reset <range>
potion.naturesaura.breathless.name=Дыхание
entity.naturesaura.effect_inhibitor.name=Эффектный порошок
entity.naturesaura.mover_cart.name=Вагонетка притягивания ауры

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"naturesaura:ancient_stick"
]
}

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"naturesaura:ancient_leaves"
]
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"naturesaura:ancient_log",
"naturesaura:ancient_bark"
]
}

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"naturesaura:ancient_planks"
]
}

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"naturesaura:ancient_leaves"
]
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"naturesaura:ancient_log",
"naturesaura:ancient_bark"
]
}

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"naturesaura:ancient_planks"
]
}

Some files were not shown because too many files have changed in this diff Show more