tiny bit of work, I need to reconfigure intellij, it somehow doesn't understand how imports work anymore lol

This commit is contained in:
Ellpeck 2020-01-21 17:46:32 +01:00
parent acff6c2658
commit ab13ff9cee
5 changed files with 30 additions and 199 deletions

View file

@ -87,7 +87,6 @@ public final class NaturesAura {
Compat.preInit();
PacketHandler.init();
ModRegistry.preInit(event);
ModEntities.init();
new Multiblocks();
@ -107,7 +106,6 @@ public final class NaturesAura {
}
public void postInit(FMLCommonSetupEvent event) {
ModRegistry.postInit(event);
Compat.postInit();
proxy.postInit(event);

View file

@ -1,37 +1,33 @@
package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityGratedChute;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.HopperBlock;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
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.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.BlockRenderLayer;
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.BlockRayTraceResult;
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.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.items.IItemHandler;
import javax.annotation.Nullable;
import java.util.List;
public class BlockGratedChute extends BlockContainerImpl {
// TODO voxel shape stuff
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 SOUTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D);
@ -46,12 +42,6 @@ public class BlockGratedChute extends BlockContainerImpl {
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() {
super("grated_chute", TileEntityGratedChute.class, "grated_chute", ModBlocks.prop(Material.IRON).hardnessAndResistance(3.0F, 8.0F).sound(SoundType.METAL));
}
@ -72,51 +62,16 @@ public class BlockGratedChute extends BlockContainerImpl {
}
@Override
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
return FULL_BLOCK_AABB;
public BlockState getStateForPlacement(BlockState state, Direction facing, BlockState state2, IWorld world, BlockPos pos1, BlockPos pos2, Hand hand) {
Direction newFacing = facing.getOpposite();
if (newFacing == Direction.UP)
newFacing = Direction.DOWN;
return this.getDefaultState().with(FACING, newFacing);
}
@Override
public void addCollisionBoxToList(BlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean isActualState) {
addCollisionBoxToList(pos, entityBox, collidingBoxes, BASE_AABB);
addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB);
addCollisionBoxToList(pos, entityBox, collidingBoxes, WEST_AABB);
addCollisionBoxToList(pos, entityBox, collidingBoxes, SOUTH_AABB);
addCollisionBoxToList(pos, entityBox, collidingBoxes, NORTH_AABB);
}
@Override
public BlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, LivingEntity placer) {
EnumFacing newFacing = facing.getOpposite();
if (newFacing == EnumFacing.UP)
newFacing = EnumFacing.DOWN;
return this.getDefaultState().withProperty(FACING, newFacing);
}
@Override
public boolean isTopSolid(BlockState state) {
return true;
}
@Override
public EnumBlockRenderType getRenderType(BlockState state) {
return EnumBlockRenderType.MODEL;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean isOpaqueCube(BlockState state) {
return false;
}
@Override
@OnlyIn(Dist.CLIENT)
public boolean shouldSideBeRendered(BlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
return true;
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
}
@Override
@ -144,32 +99,7 @@ public class BlockGratedChute extends BlockContainerImpl {
}
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta));
}
@Override
public int getMetaFromState(BlockState state) {
return state.getValue(FACING).getIndex();
}
@Override
public BlockState withRotation(BlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
}
@Override
public BlockState withMirror(BlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation(state.getValue(FACING)));
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, FACING);
}
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, EnumFacing face) {
return face == EnumFacing.UP ? BlockFaceShape.BOWL : BlockFaceShape.UNDEFINED;
protected void fillStateContainer(StateContainer.Builder<net.minecraft.block.Block, BlockState> builder) {
builder.add(FACING);
}
}

View file

@ -7,107 +7,59 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraftforge.registries.ObjectHolder;
public class ModBlocks {
@SuppressWarnings("FieldNamingConvention")
@ObjectHolder(NaturesAura.MOD_ID)
public final 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) {

View file

@ -4,85 +4,47 @@ import de.ellpeck.naturesaura.NaturesAura;
import net.minecraft.item.Item;
import net.minecraftforge.registries.ObjectHolder;
public class ModItems {
@ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_pickaxe")
@SuppressWarnings("FieldNamingConvention")
@ObjectHolder(NaturesAura.MOD_ID)
public final class ModItems {
public static Item INFUSED_PICKAXE;
@ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_axe")
public static Item INFUSED_AXE;
@ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_shovel")
public static Item INFUSED_SHOVEL;
@ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_hoe")
public static Item INFUSED_HOE;
@ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_sword")
public static Item INFUSED_SWORD;
@ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_helmet")
public static Item INFUSED_HELMET;
@ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_chest")
public static Item INFUSED_CHEST;
@ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_pants")
public static Item INFUSED_PANTS;
@ObjectHolder(NaturesAura.MOD_ID + ":infused_iron_shoes")
public static Item INFUSED_SHOES;
@ObjectHolder(NaturesAura.MOD_ID + ":eye")
public static Item EYE;
@ObjectHolder(NaturesAura.MOD_ID + ":eye_improved")
public static Item EYE_IMPROVED;
@ObjectHolder(NaturesAura.MOD_ID + ":gold_fiber")
public static Item GOLD_FIBER;
@ObjectHolder(NaturesAura.MOD_ID + ":gold_leaf")
public static Item GOLD_LEAF;
@ObjectHolder(NaturesAura.MOD_ID + ":infused_iron")
public static Item INFUSED_IRON;
@ObjectHolder(NaturesAura.MOD_ID + ":ancient_stick")
public static Item ANCIENT_STICK;
@ObjectHolder(NaturesAura.MOD_ID + ":color_changer")
public static Item COLOR_CHANGER;
@ObjectHolder(NaturesAura.MOD_ID + ":aura_cache")
public static Item AURA_CACHE;
@ObjectHolder(NaturesAura.MOD_ID + ":aura_trove")
public static Item AURA_TROVE;
@ObjectHolder(NaturesAura.MOD_ID + ":shockwave_creator")
public static Item SHOCKWAVE_CREATOR;
@ObjectHolder(NaturesAura.MOD_ID + ":multiblock_maker")
public static Item MULTIBLOCK_MAKER;
@ObjectHolder(NaturesAura.MOD_ID + ":bottle_two_the_rebottling")
public static Item BOTTLE_TWO;
@ObjectHolder(NaturesAura.MOD_ID + ":aura_bottle")
public static Item AURA_BOTTLE;
@ObjectHolder(NaturesAura.MOD_ID + ":farming_stencil")
public static Item FARMING_STENCIL;
@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

@ -8,25 +8,19 @@ import de.ellpeck.naturesaura.items.tools.*;
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.inventory.EquipmentSlotType;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Effect;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.world.dimension.DimensionType;
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.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.registries.ForgeRegistries;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Mod.EventBusSubscriber
public final class ModRegistry {
@ -90,18 +84,14 @@ public final class ModRegistry {
new BlockDimensionRail("end", DimensionType.THE_END, DimensionType.OVERWORLD)
);
if (ModConfig.enabledFeatures.rfConverter) {
if (ModConfig.enabledFeatures.rfConverter)
event.getRegistry().register(new BlockRFConverter());
}
if (ModConfig.enabledFeatures.chunkLoader) {
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) {
@ -117,7 +107,7 @@ public final class ModRegistry {
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 Sword("infused_iron_sword", NAItemTier.INFUSED, 3, 3), // TODO 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),
@ -165,18 +155,16 @@ public final class ModRegistry {
public static void registerPotions(RegistryEvent.Register<Effect> event) {
}
/*
private static void registerPotion(Effect potion, String name) {
potion.setPotionName("potion." + NaturesAura.MOD_ID + "." + name + ".name");
potion.setRegistryName("potion." + NaturesAura.MOD_ID + "." + name + ".name");
potion.setRegistryName(NaturesAura.MOD_ID, name);
ForgeRegistries.POTIONS.register(potion);
}
private static void registerItem(Item item, String name, ItemGroup tab) {
item.setTranslationKey(NaturesAura.MOD_ID + "." + name);
item.setRegistryName(NaturesAura.MOD_ID, name);
ForgeRegistries.ITEMS.register(item);
@ -232,6 +220,7 @@ public final class ModRegistry {
item.onPreInit(event);
}
}
*/
public static void init(FMLCommonSetupEvent event) {
for (IModItem item : ALL_ITEMS) {