Jump to content

Herobone

Members
  • Posts

    17
  • Joined

  • Last visited

Everything posted by Herobone

  1. Hi! I'm wondering if it's possible to have two different mods in one file. (ModA.class + Stuff for ModA & ModB.class + Stuff for ModB ===> ModAB.jar) If it is possible would be nice if you could tell me how to do. Hope you understood my problem
  2. Works perfectly but if you have an item in the hand it doesn't work. Why that?
  3. HI Guys! I have a block but when I click it the message appears two times. Why? Here's the code: package com.herobone.allergy.blocks; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Random; import com.herobone.allergy.capability.AllergyProvider; import com.herobone.allergy.capability.IAllergy; import com.herobone.allergy.registry.BlockRegistry; import net.minecraft.block.Block; import net.minecraft.block.BlockHorizontal; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; public class Microscope extends Block { public static final PropertyDirection FACING = BlockHorizontal.FACING; public Microscope() { super(Material.ROCK); this.blockHardness = 2F; this.blockResistance = 5F; this.setSoundType(SoundType.METAL); this.setLightLevel(0.2F); this.setHarvestLevel("pickaxe", 1); } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(BlockRegistry.microscope); } @Override public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { this.setDefaultFacing(worldIn, pos, state); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { IAllergy allergy = player.getCapability(AllergyProvider.ALLERGY_CAP, null); String in = allergy.get(); if (in != null) { List<String> allergyList = new ArrayList<>(Arrays.asList(allergy.get().split(" "))); //Do the ArrayList from the StringBuilder-String StringBuilder allergies = new StringBuilder(); for(int i = 0; i < allergyList.size(); i++) { String s = allergyList.get(i); if(s != null) { allergies.append(s + " "); } } player.addChatComponentMessage(new TextComponentString("Your allergies are: " + allergies.toString())); //Directly from StringBuilder return true; } return false; } private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { IBlockState iblockstate = worldIn.getBlockState(pos.north()); IBlockState iblockstate1 = worldIn.getBlockState(pos.south()); IBlockState iblockstate2 = worldIn.getBlockState(pos.west()); IBlockState iblockstate3 = worldIn.getBlockState(pos.east()); EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); if (enumfacing == EnumFacing.NORTH && iblockstate.isFullBlock() && !iblockstate1.isFullBlock()) { enumfacing = EnumFacing.SOUTH; } else if (enumfacing == EnumFacing.SOUTH && iblockstate1.isFullBlock() && !iblockstate.isFullBlock()) { enumfacing = EnumFacing.NORTH; } else if (enumfacing == EnumFacing.WEST && iblockstate2.isFullBlock() && !iblockstate3.isFullBlock()) { enumfacing = EnumFacing.EAST; } else if (enumfacing == EnumFacing.EAST && iblockstate3.isFullBlock() && !iblockstate2.isFullBlock()) { enumfacing = EnumFacing.WEST; } worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2); } } public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.MODEL; } /** * Convert the given metadata into a BlockState for this Block */ public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getFront(meta); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(FACING, enumfacing); } /** * Convert the BlockState into the correct metadata value */ public int getMetaFromState(IBlockState state) { return ((EnumFacing)state.getValue(FACING)).getIndex(); } /** * Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed * blockstate. */ public IBlockState withRotation(IBlockState state, Rotation rot) { return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING))); } /** * Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed * blockstate. */ public IBlockState withMirror(IBlockState state, Mirror mirrorIn) { return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING))); } protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] {FACING}); } /** * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } /** * Called by ItemBlocks after a block is set in the world, to allow post-place logic */ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2); } } Thaaank's Herobone
  4. Do you reccomend doing this?
  5. Hi Guys! I'm wondering how it is possible to have one mod-file for several minecraft versions. For Example McJty's RFTools mod. There is only one file available for 1.10.2 AND 1.11.2. So how is it possible? What do I have to change? You can find the source of the mod here: GitHub Thanks in advance Herobone
  6. Thanks! Based on this I coded a function, that can look up materials in the first level. But what should I do for recipes of the second level? (For example with other mods) Detect wheat in a bread that was baked in the furnace? Or a bread that was used for crafting again? Any Ideas
  7. Maybe you could generate a specific Dimension of the wanted world (or all) into the new World. How this could be done, no Idea. But you could have a look at different world-generator Mod sources. This helps me often when I'm modding
  8. Hi Guys! I'm still working on the AllergyMod. Now i want that for example if you have an allergy against gluten, every food, that includes till the lowest crafting-step, for example wheat, should be recognized and the player gets an allergic reaction. (Doesn't sound nice but i want it for more realism in a Modpack I'm doing for a friend...) So just in case I formed the sentence bad: I want the get all ingredients of a crafting recipe. Is it possible an if yes how? Herobone
  9. Hey Guys! I want to do a mod in which you have allergies and so on. I'd like to save the players allergies, that are randomly generated, to the NBT, because I think this is the best method. Of there is a better metod please let me know. I tried to save it several times, but it didn't work and when I rejoined to the world (same Player!!!) I lost all my allergies. I also looked to the NBT data whit NBTExplorer, but the data was nowhere. Pleas help me. Thnak's Herobone
  10. Hi guys! I am looking for now 2 days for a solution with my problem but found nothing... )-: Here's my problem: I want to make an entity that uses an .obj file. I found somebody who has an open-source mod, that uses 3D-OBJ-Models. But, well it was very complicated and when I tried it the mod crashed... So do you have any ideas how to solve my problem? And it would be nice if you could explain it to me, because I'm not so familiar with mod-coding... Thank's Herobone
  11. Hi there! I want to render my own Texture on an arrow! I know that there are different methods and i tried them. But nothing worked like i wished! My cannon killed entities but it didn't displayed the flying Projectile. Here are the files. If you have to see the full mod, you can find it here on GitHub Main Mod-File: EntityRegister: ClientProxy: The Cannon that shoots the projectile (Plasma Cannon (i think it looks great)) (The Energy API is From CoFH and Mekanism) The Projectile (item): The Projectile (entity): The Projectile-Render: The Error: I know it's much code, but I hope u can help me! Thanks Herobone
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.