Jump to content

goingcrowd9

Members
  • Posts

    9
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

goingcrowd9's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I tought onPlayerStoppedUsing was just for every Item when you release the key to use it. The package name was just something I used because of a tutorial. At least that works now. Now I just got to figure out how to make a model for the EntityMagicPearl, wich is now used instead of EntityEnderPearl (It works fine, it just doesn't use any model) But at least thanks for pointing out the Item doesn't "get used" like I tought
  2. package com.goingcrowd9.blazemod.items; import javax.annotation.Nullable; import com.goingcrowd9.blazemod.init.ModItems; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityEnderPearl; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.ItemEnderPearl; import net.minecraft.item.ItemStack; import net.minecraft.stats.StatList; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class ItemMagicPearl extends ItemEnderPearl { public ItemMagicPearl(String name){ this.setUnlocalizedName(name); this.setRegistryName(name); this.maxStackSize = 1; this.setMaxDamage(238); this.setCreativeTab(CreativeTabs.MISC); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn){ ItemStack itemstack = playerIn.getHeldItem(handIn); worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_ENDERPEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); //playerIn.getCooldownTracker().setCooldown(this, 20); if (!worldIn.isRemote){ EntityEnderPearl entityenderpearl = new EntityEnderPearl(worldIn, playerIn); entityenderpearl.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F); worldIn.spawnEntity(entityenderpearl); } playerIn.addStat(StatList.getObjectUseStats(this)); return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack); } @Override public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBase entityLiving, int timeLeft) { System.out.println("hello, I'm here !!!!!!!!!!!!!!!!!!!!!!!"); System.out.println("Is this Item damageable ?: " + this.isDamageable() ); EntityPlayer entityplayer = (EntityPlayer)entityLiving; stack.damageItem(1, entityplayer); } public int getMaxItemUseDuration(ItemStack stack) { return 7200; } } I'm trying to make an ender pearl-like Item that gets damaged after you throw it, but it doesn't work... The Item itself is working, but it seems it doesn't even reach onPlayerStoppedUsing since nothing gets printed on the console (println) Obviously I'm doing something wrong, but I don't know what.. Any help appreciated
  3. Did I really overlooked that ? pretty silly mistake... but at least it works now. thanks for noticing a quite easy to spot mistake, anyway.
  4. Console log ^ I'm trying to make a custom bow in minecraft but I can't looad the textures for my custom bow. The bow itself *seems* to work, I'm able to shoot arrows while holding a purple-black block that 'shakes' like a normal bow would, but it keeps giving an error saying it can't load a model variant. here is the models.item.blaze_bow.json file: here is the models.item.blaze_bow_pulling_x.json file: here is th ItemBlazeBow class:
  5. do I also have to specify wich models to use in the blockstate json file or is it also possible to drirectly refer to the textures themselves in the file ? like: { "multipart": [ { "apply": { "north": { "bm:normal_glass_middle" }, } } { "when": { "condition": "true" }, { "apply": { "north": { "texture": "modid:awsome_texture" }, "south": { "texture": "modid:another_awsome_texture" } } } ] }
  6. Hi, is there a way to specify wich textures to use without the use of json files ? personally writing tons of json files just don't makes any sense to me, if you could also put in in the [CustomBlock] method. I was more thinking in the form of: if( condition ){ /* use [this] texture on [this face]*/ } thanks in advance
  7. package com.goingcrowd9.blazemod.blocks; import java.util.Random; import com.goingcrowd9.blazemod.Main; import com.goingcrowd9.blazemod.init.ModItems; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class CustomGlass extends BlockBase { /** Whether this glass block connects with the block left of it */ public static final PropertyBool LEFT = PropertyBool.create("left"); /** Whether this glass block connects with the block right of it */ public static final PropertyBool RIGHT = PropertyBool.create("right"); /** Whether this glass block connects with the block above it */ public static final PropertyBool TOP = PropertyBool.create("top"); /** Whether this glass block connects with the block below it */ public static final PropertyBool BOTTOM = PropertyBool.create("bottom"); public CustomGlass(String name, Material material) { super(name, material); setLightOpacity(15); this.setDefaultState(this.blockState.getBaseState().withProperty(LEFT, Boolean.valueOf(false)).withProperty(RIGHT, Boolean.valueOf(false)).withProperty(TOP, Boolean.valueOf(false)).withProperty(BOTTOM, Boolean.valueOf(false))); } // without it the block directly 'behind' the glass doesn't get rendered @Override public boolean isOpaqueCube(IBlockState state){ return false; } // glass drops nothing public int quantityDropped(Random random){ return 0; } // prevents glass from being a black cube with the glass texture on top @SideOnly(Side.CLIENT) public BlockRenderLayer getBlockLayer(){ return BlockRenderLayer.CUTOUT; } // Determines if an entity can path through this block public boolean isPassable(IBlockAccess worldIn, BlockPos pos){ return false; } // glass is not a full block public boolean isFullCube(IBlockState state){ return false; } // glass can (only) drop itself when mined with a 'Silk Touch' tool protected boolean canSilkHarvest(){ return true; } // Convert the BlockState into the correct metadata value ?? not sure ? public int getMetaFromState(IBlockState state){ return 0; } // determines if current side can be connected to public boolean canConnectSide(String sideToCheck, boolean otherArguments) { boolean connect = false; if(otherArguments) { // just as placeholder !! connect = true; } return connect; } /* Get the actual Block state of this Block at the given position */ public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { return state.withProperty(LEFT, canConnectSide("left", true) ) .withProperty(RIGHT, canConnectSide("left", false) ) .withProperty(TOP, canConnectSide("left", true) ) .withProperty(BOTTOM, canConnectSide("left", false) ); } /* generates every unique combination and tells minecraft we want to use the variables */ @Override public BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] {LEFT, RIGHT, TOP, BOTTOM} ); } } My customGlass Class ^ { "forge_marker": 1, "multipart": [ { "apply": { "model": "bm:glass_middle" } }, { "when": { "left": "true" }, "apply": { "model": "bm:glass_left", "uvlock": true } }, { "when": { "right": "true" }, "apply": { "model": "bm:glass_right", "uvlock": true } }, { "when": { "top": "true" }, "apply": { "model": "bm:glass_top", "uvlock": true } }, { "when": { "bottom": "true" }, "apply": { "model": "bm:glass_bottom", "uvlock": true } } ] } assets > blockstates > custom_glass.json ^ { "parent": "block/cube_all", "textures": { "all": "bm:blocks/glass_VARIANT" } } assets > models > block / item > glass_VARIANT.json I get a lot of errors in this form (basically for all possible variants) : [15:15:01] [main/ERROR] [FML]: Exception loading model for variant bm:custom_glass#bottom=false,left=false,right=true,top=true for blockstate "bm:custom_glass[bottom=false,left=false,right=true,top=true]" I first tried to give this block multiple blockstates and to load in into the game, but it doesn't display any texture at all... My other custom block loads just fine but apparently it doesn't load or register all variants correctly ? does anyone knows what I'm doing wrong ? EDIT: by removing "forge_marker": 1 the custom glass block now displays a texture now I just try to get the blockstates of adjacent blockstates and make the method 'canConnectSide' working.
  8. Thanks for the reply, I will try to get the blockstate of the adjacent blocks when I can.
  9. I'm not new to java, but i am to minecraft modding... Is there a way to make all glass (or custom glass blocks) blocks check for adjacent glass block and load diffrent textures based on that info ? i.e "if there is only a glass block left of this glass block, load xyz, else if..." I realise there are already "connected textures mods" but I'm trying to make my own, I just have no clue where data of the minecraft world is stored or wich methods check for the JSON files in ored to decide wich texture to load for wich blocks. Any help would be appreciated
×
×
  • Create New...

Important Information

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