perromercenary00
Members-
Posts
849 -
Joined
-
Last visited
-
Days Won
5
Everything posted by perromercenary00
-
good days im redoing the hardened glass block from mi mod and i need the functions that trigger when the block is destroy or break been looking in the block class and only get this one // ########## ########## ########## ########## public void playerDestroy(World p_180657_1_, PlayerEntity p_180657_2_, BlockPos p_180657_3_, BlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) { p_180657_2_.awardStat(Stats.BLOCK_MINED.get(this)); p_180657_2_.causeFoodExhaustion(0.005F); System.out.println("this ones triggers when playerDestroy the block "); dropResources(p_180657_4_, p_180657_1_, p_180657_3_, p_180657_5_, p_180657_2_, p_180657_6_); } in the old version s i have // ###########################################################3 @Override public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn) { public void onBlockExploded(World world, BlockPos pos, Explosion explosion) @Override public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state) { @Override public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { where are the equivalent of the old functions ?
-
i just refactoring the question from the iron bars block i have create a basic full block of glass and an slab the issue is than this block is not transparent it loads glass texture but its dull gray you cannot see through as whit the vanilla glass block im creating the block using the tutorials from Kaupenjoe https://www.youtube.com/playlist?list=PLKGarocXCE1EMxeBvqsOWZVkYD_Vd_uwW public static final RegistryObject<Block> GLASS_BLOCK = registerBlock( "glass_block", () -> new Block( AbstractBlock.Properties.of(Material.GLASS).strength(0.3F).sound(SoundType.GLASS).noOcclusion())); the block is made using the vanilas block class in the old versions to make block transparent you have to add to the block code this function @Override public boolean isOpaqueCube(IBlockState state) { return false; } something like this is missing or the system has totally change someone says than ItemBlockRenderTypes.setRenderLayer(YOUR_BLOCK, RenderType.cutoutMipped()); but i dont have friking idea where that piece of code would go
-
bars fence_block not translucent
perromercenary00 replied to perromercenary00's topic in Modder Support
alredy try that <code> public static final RegistryObject<Block> MESH_BLOCK = registerBlock( "mesh_block", () -> new mesh_block( AbstractBlock.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(5.0F, 6.0F).sound(SoundType.METAL).noOcclusion() ));</code> in the minecraft blocks class iron bars and glass are like this <code> //public static final Block IRON_BARS = register("iron_bars", new PaneBlock(AbstractBlock.Properties.of(Material.METAL, MaterialColor.NONE).requiresCorrectToolForDrops().strength(5.0F, 6.0F).sound(SoundType.METAL).noOcclusion())); //public static final Block GLASS_PANE = register("glass_pane", new PaneBlock(AbstractBlock.Properties.of(Material.GLASS).strength(0.3F).sound(SoundType.GLASS).noOcclusion())); </code> this is the full class it has some garbage coze i been doing experiments on it <code> package baseMmod.block; import java.util.stream.IntStream; import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.HorizontalBlock; import net.minecraft.block.IWaterLoggable; import net.minecraft.block.PaneBlock; import net.minecraft.block.SlabBlock; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialColor; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.state.BooleanProperty; import net.minecraft.state.DirectionProperty; import net.minecraft.state.EnumProperty; import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.DoorHingeSide; import net.minecraft.state.properties.Half; import net.minecraft.state.properties.SlabType; import net.minecraft.state.properties.StairsShape; import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; 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.IBlockReader; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraft.item.BlockItemUseContext; //import net.minecraft.item.Item; //########## ########## ########## ########## public class mesh_block extends Block implements IWaterLoggable { // ########## ########## ########## ########## public mesh_block(Block.Properties properties) { super(properties); this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH)); } // ########## ########## ########## ########## public static final DirectionProperty FACING = HorizontalBlock.FACING; // ########## ########## ########## ########## @Override protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> builder) { builder.add(FACING, WATERLOGGED ); // builder.add(FACING, OPEN, HALF, POWERED, WATERLOGGED); } public boolean useShapeForLightOcclusion(BlockState p_220074_1_) { // return p_220074_1_.getValue(TYPE) != SlabType.DOUBLE; return true; } // ########## ########## ########## ########## // hitbox public static final EnumProperty<SlabType> TYPE = BlockStateProperties.SLAB_TYPE; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; // estos dos son los bordes para el blocke @OnlyIn(Dist.CLIENT) public static boolean shouldRenderFace(BlockState p_176225_0_, IBlockReader p_176225_1_, BlockPos p_176225_2_, Direction p_176225_3_) { return true; } /* A 3uNIDADES protected static final VoxelShape TOP_AABB = Block.box(0.0D, 8.0D, 0.0D, 16.0D, 16.0D, 16.0D); protected static final VoxelShape BOTTOM_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D); protected static final VoxelShape SOUTH_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 3.0D); protected static final VoxelShape NORTH_AABB = Block.box(0.0D, 0.0D, 13.0D, 16.0D, 16.0D, 16.0D); protected static final VoxelShape WEST_AABB = Block.box(13.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D); protected static final VoxelShape EAST_AABB = Block.box(0.0D, 0.0D, 0.0D, 3.0D, 16.0D, 16.0D); */ // a una unidad protected static final Double thickness = 1.5D; protected static final VoxelShape TOP_AABB = Block.box(0.0D, (16.0D - thickness), 0.0D, 16.0D, 16.0D, 16.0D); protected static final VoxelShape BOTTOM_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, thickness, 16.0D); protected static final VoxelShape SOUTH_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, thickness); protected static final VoxelShape NORTH_AABB = Block.box(0.0D, 0.0D, (16.0D - thickness), 16.0D, 16.0D, 16.0D); protected static final VoxelShape WEST_AABB = Block.box( (16.0D - thickness), 0.0D, 0.0D, 16.0D, 16.0D, 16.0D); protected static final VoxelShape EAST_AABB = Block.box(0.0D, 0.0D, 0.0D, thickness, 16.0D, 16.0D); protected static final VoxelShape ALL_SHAPES = VoxelShapes.or( VoxelShapes.or( NORTH_AABB, SOUTH_AABB ), VoxelShapes.or( EAST_AABB, WEST_AABB )); // aqui es donde se selecciona que bordes va a tener el pblocke basado en el // block state public VoxelShape getShape(BlockState blkstate, IBlockReader blockreader, BlockPos blockpos, ISelectionContext iselectioncontext) { Direction direction = blkstate.getValue(FACING); // boolean flag = !blkstate.getValue(OPEN); // boolean flag1 = blkstate.getValue(HINGE) == DoorHingeSide.RIGHT; return ALL_SHAPES; /* return ALL_SHAPES; switch (direction) { case EAST: default: return EAST_AABB; case SOUTH: return SOUTH_AABB; case WEST: return WEST_AABB; case NORTH: return NORTH_AABB; } */ } // ########## ########## ########## ########## @Override public BlockState getStateForPlacement(BlockItemUseContext context) { return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()); } // ########## ########## ########## ########## // Onright click @Override public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { ItemStack held = player.getItemInHand(hand); /* * if (!world.isClientSide() && held.getItem() == Items.GUNPOWDER){ * world.explode(player, pos.getX(), pos.getY(), pos.getZ(), 4.0F, true, * Explosion.Mode.DESTROY); held.shrink(1); return ActionResultType.CONSUME; } */ return super.use(state, world, pos, player, hand, hit); } // ########## ########## ########## ########## public static boolean isFaceFull(VoxelShape p_208061_0_, Direction p_208061_1_) { VoxelShape voxelshape = p_208061_0_.getFaceShape(p_208061_1_); return isShapeFullBlock(voxelshape); } public boolean hasDynamicShape() { return this.dynamicShape; } // ########## ########## ########## ########## } </code> I miss the times of 1.7 when you define all the properties recipes drops textures subblocks inside the same custome block class -
Hie i make this block bars block but i cannot see through even it is just 1.5D thick is just has this black background what and where flag i must set up to make this block traslucent ?
-
there was a time when the nbt system was broken and the nbt data in the server side was sinced no more to client side, they inplement a capabilities system and whith them you have to implement a package system to custome send only the data nesesary to the client side that was too shitty and too complicated soo make some animation on a item wass ridicolus i do this but end diching out minecraft modding as hobby https://studio.youtube.com/video/A_Hj05Yr2xs/edit if clasic nbttags are back doing something like this is cheape easy relatibely easy
-
well im doing something again after long time i see a post asking for examples of nbt for 1.15 and do in a test_item <code> CompoundTag nbtTagCompound = itemStack.getTag(); if (nbtTagCompound == null) { nbtTagCompound = new CompoundTag(); itemStack.setTag(nbtTagCompound); } if (nbtTagCompound != null ) { if( !world.isClient ) { nbtTagCompound.putInt("x", nbtTagCompound.getInt("x") + 1 ); } System.out.println( "nbtTag x =" + world.isClient + " => " + nbtTagCompound.getInt("x") ); } </code> the nbt is working and the data writed in the server side is being pased to client side are NBT reimplemented can i use them to control animations to items and do complicated stuf ? what happen to the capabilities system ¿ was discarted
-
goods i need to align an entity on a blockface but i need to work on nonfull size blocks like slabs or fences minecraft 1.16 has no more the EnumFacing attribute and for some reason they change raytrace name to raycast anyway i need to know to what face of the non-fullsize block where te raycast hit the block thanks for your time
-
goog days i have a trouble and a broken english im doing some code to make guns in minecraft but i have this trouble i have a basic gun is this moment i make it shoot for rounds every time i press rigthclick one bullet every 256 milliseconds the gun works the shoot animation runs but notice than most of the times there was no sound effect and the code is not execute and no damage is cause to the target entity // ########################################################### public boolean disparo(ItemStack stack, World world, Entity entity) { if (world.isRemote) { //entity.world.playSound(null, entity.getPosition(), sonidos.pistola75nf_disparo, SoundCategory.PLAYERS, 2.0F,1.0F); return true; } if (!world.isRemote) { if (this.ammunition > 0) { entity.world.playSound(null, entity.getPosition(), sonidos.pistola75nf_disparo, SoundCategory.PLAYERS,2.0F, 1.0F); // this class do all the math necessary to calculate the bullet trajectory and return the affected entities objetoobjetivo objetivo = new objetoobjetivo(world, entity, 20, 1); if (objetivo.getHayEntidades()) { //there is afected entities ? ArrayList<Entity> entidades = objetivo.getEntidades(); Entity targetEntity = entidades.get(0); boolean isheadshoot = false; float dice = rollsAd100dice(); //random float number from 0.0F to 100 boolean iscritico = (dice < this.critico) ? true : false; dice = rollsAd100dice(); boolean iselemental = (dice < this.echange) ? true : false; for (int e = 0; e < entidades.size(); e++) { if (targetEntity != null && targetEntity instanceof EntityLivingBase) { EntityLivingBase livingtarget = (EntityLivingBase) targetEntity; isheadshoot = objetivo.isheadshoot(livingtarget); float hp = livingtarget.getHealth(); float maxhp = livingtarget.getMaxHealth(); float pain = (iscritico) ? (this.damage * 1.5F) : this.damage; pain = (isheadshoot) ? (pain * 1.5F) : pain; hp -= pain; hp =(hp < 0.0F)? 0.0F : hp ; livingtarget.setHealth(hp); //shows mesage on the player screen chat.chatm(entity, "#" + this.getTic() + " headshoot=" + isheadshoot + " iscritico=" + iscritico + " hp=" + livingtarget.getHealth()+"/"+maxhp); } } } } this.ammunition--; this.ammunition = (this.ammunition < 1) ? 0 : this.ammunition; return true; } return false; } soo i disable the sound before the shoot code and now its runs perfect if (!world.isRemote) { if (this.ammunition > 0) { // entity.world.playSound(null, entity.getPosition(), sonidos.pistola75nf_disparo, SoundCategory.PLAYERS,2.0F, 1.0F); also notice than the sound dont'n works when i execute this client side entity.world.playSound(null, entity.getPosition(), sonidos.pistola75nf_disparo, SoundCategory.PLAYERS,2.0F, 1.0F); when i play the sound for the bullet shoot its most of the times fucks up server side is not like totally crashig the virtual server but it stalls and run no more code until next tic soo i must wrong using sounds is this the right way to play a sound ?? and why is not working client side entity.world.playSound(null, entity.getPosition(), sonidos.pistola75nf_disparo, SoundCategory.PLAYERS,2.0F, 1.0F);
-
[1.12.2] lets talk about animationApi for items
perromercenary00 replied to perromercenary00's topic in Modder Support
lets say i need just a guide or a functional code whit an item runing whit a b3d model just to use as example to fix mi code -
good days lets start whit this this is an animation i did in the complicated way i make 60 frames and set the speed to one frame every 100ms so it play slow and all the frames become visible normally it plays one frame every 25ms i can control the animation in this case i launch it whit right-click, the trouble i have with this is to make the animation of the magazine take out from the gun if could just offset the magazine texture i just simply could make another script to edit the json frames and move the magazine texture under the gun texture frame by frame well i just don't wanna create 20 png files to animate the magazine movement anyway someone tell mi about minecrafts animation api and point it here https://mcforge.readthedocs.io/en/latest/animation/intro/ well here is a very superficial explanation on the class there is no examples and leave mi whit some questions and i don't know where to start * first of all this works with b3d models or whit json, * this armatures and joins goes in json files but definitively are not the model per se * in the animation of the gun i made i launch the animation whenever i want i write and nbt tag accion = 2 in the server side and thats the signal for the client side to start the animation, soo the question is how i pases data to control animations ? * how do you declare than an item gonna use a b3d model or whatever * and more important what is a b3d model an how you create one i know i know this all are nubie questions but what we gonna do has someone already made a guide explaining all this but like for dummies ?? and Sorry for the broken english
-
i need to Mach two png files in texture for an item json all this to make a simple animation vanilla bow style lets say i got this json file in whitch i have two textures i need to fix the layer0 some pixels down normally it looks like this but i need to displace the magazine gradually to make it look like this i have this json { "parent": "modmercenario:item/prueba00/parental00", "textures": { "layer0": "modmercenario:items/armasdefuego/armas9mm/atss00", "layer1": "modmercenario:items/armasdefuego/armas9mm/atlassilver" } } but really what i want is somethin like this code "textures": { "layer0": { "texture":"modmercenario:items/armasdefuego/armas9mm/atss00", "translation":[-6,0,0] }, "layer1": { "texture":"modmercenario:items/armasdefuego/armas9mm/atlassilver", "translation":[0,0,0] } } is this posible ?? how can i declare the layer in the item json whit an offset ?? or is posible the get the "parent": "item/generated" json and customize it to make a plain item but whit more complex layers? Thanks fopr reading and sorry for the broken english
-
[1.12.2] intestack capability not sync to remote world
perromercenary00 replied to perromercenary00's topic in Modder Support
jummm interesting adding this two methods to the item class enable minecraft to read the nbt and sync it to remote world this also fix mi capabilitie issue the data is also reaching remote client // ############################################################################################3 /** * Override this method to decide what to do with the NBT data received from getNBTShareTag(). * * @param stack The stack that received NBT * @param nbt Received NBT, can be null */ @Override public void readNBTShareTag(ItemStack stack, @Nullable NBTTagCompound nbt) { stack.setTagCompound(nbt); } // ############################################################################################3 /** * Override this method to change the NBT data being sent to the client. * You should ONLY override this when you have no other choice, as this might change behavior * client side! * * Note that this will sometimes be applied multiple times, the following MUST be supported: * Item item = stack.getItem(); * NBTTagCompound nbtShare1 = item.getNBTShareTag(stack); * stack.setTagCompound(nbtShare1); * NBTTagCompound nbtShare2 = item.getNBTShareTag(stack); * assert nbtShare1.equals(nbtShare2); * * @param stack The stack to send the NBT tag for * @return The NBT tag */ @Nullable @Override public NBTTagCompound getNBTShareTag(ItemStack stack) { return stack.getTagCompound(); } inow tha is working i gona stick whit the capabilitie method Thanks for the help now i gona set the post as solved -
[1.12.2] intestack capability not sync to remote world
perromercenary00 replied to perromercenary00's topic in Modder Support
and how goes this share tag mechanics when i search it it just display old nbttags guides -
[1.12.2] intestack capability not sync to remote world
perromercenary00 replied to perromercenary00's topic in Modder Support
well originally in 1.8 i use nbttags to store data in the itemstack in the server side whit it i can control animations in the remote world this video was in 1.10 or 1.11 don't remember clearly and the code is missing somewhere in the time nbttags stop syncing between worlds anymore someone tell me i have to move into capabilities i do so move to capabilities hoping it gonna sync i do a lot of code then it result into not syncing after all capabilities are based on nbt public void deserializeNBT(NBTBase nbtIn) {} public NBTBase serializeNBT() {} packages sound promising but lets say what happens if server send data to an item when im storing it or doping it and is no more in main hand when the remote side gets the package an there is not the item in the player hand or this itemstack has change to to this other lets say i need to change an item in a entity inventory -
[1.12.2] intestack capability not sync to remote world
perromercenary00 replied to perromercenary00's topic in Modder Support
after calming down I was dusting off my old package manager thinking a way to send specific data to an specific item on a specific player world and well forge has already some kind of tool to do this or I must write it ? like in this case i need to serialize and send a long ,4 bytes and a Int -
[1.12.2] intestack capability not sync to remote world
perromercenary00 replied to perromercenary00's topic in Modder Support
public static final PropertyInteger LEVEL = PropertyInteger.create("level", 0, 3); is a remains of another test "Capabilities on items are not synced to the client by default" i don't like this part i need it to update the nbt values to the client so it could control animations to the item wait wait wait soo if the capability don't update to client then what capabilities are intended for?. if i have to create a custom package system just to manually sync simple values i could just keep using directly nbttags. this capability code i write is simple useless arfffffffff -
Goo days and sorry for the broken English im doing a custome capability to manage some weapons and tools actually still in develop stage when i was doing mi code i notice that the values i set in item stack in the server side are not reaching the client side so i made a test item to check it out, but still the values i change remain even after i close the world , lets explain it better i have a test item "prueba00" and a costume capability "animacionMercenaria" in the item left click: i set a value for the variable action only in the server in the item righ click: only display the value of action in both worlds // ############################################################################################3 //@Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { boolean sePudo = true; ItemStack stack = player.getHeldItem(hand); player.setActiveHand(hand); animacionMercenaria alm = getAlmacenamiento(stack); byte action = alm.getAccion(); chat.chatm((EntityPlayer)player, world.isRemote + "RIGHTCLICK, accion=" + alm.getAccion() ); if (stack.getMetadata() < 1) { player.setActiveHand(hand); return new ActionResult(EnumActionResult.SUCCESS, stack); } else { return new ActionResult(EnumActionResult.FAIL, stack); } } // ############################################################################################3 @Override public boolean onEntitySwing(EntityLivingBase player, ItemStack stack) { World world = player.world; animacionMercenaria alm = getAlmacenamiento(stack); if( !world.isRemote ) { byte action = alm.getAccion(); alm.setAccion(action + 1); chat.chatm((EntityPlayer)player, world.isRemote + "LEFTCLICK, accion=" + alm.getAccion() ); } return true; } // ############################################################################################3 this is the output //i press three times left click to set action to '4' [07:56:07] [Client thread/INFO] [minecraft/GuiNewChat]: [CHAT] falseLEFTCLICK, accion=2 [07:56:09] [Client thread/INFO] [minecraft/GuiNewChat]: [CHAT] falseLEFTCLICK, accion=3 [07:56:10] [Client thread/INFO] [minecraft/GuiNewChat]: [CHAT] falseLEFTCLICK, accion=4 //but it only change in the server side, the local side remains in 1 [07:56:14] [Client thread/INFO] [minecraft/GuiNewChat]: [CHAT] trueRIGHTCLICK, accion=1 [07:56:14] [Client thread/INFO] [minecraft/GuiNewChat]: [CHAT] falseRIGHTCLICK, accion=4 [07:56:20] [Client thread/INFO] [minecraft/GuiNewChat]: [CHAT] trueRIGHTCLICK, accion=1 [07:56:20] [Client thread/INFO] [minecraft/GuiNewChat]: [CHAT] falseRIGHTCLICK, accion=4 if i close minecraf and open again and just rightclick the item //the value was saved and is now set in bot worlds [08:03:55] [Client thread/INFO] [minecraft/GuiNewChat]: [CHAT] trueRIGHTCLICK, accion=4 [08:03:57] [Client thread/INFO] [minecraft/GuiNewChat]: [CHAT] falseRIGHTCLICK, accion=4 [08:04:02] [Client thread/INFO] [minecraft/GuiNewChat]: [CHAT] trueRIGHTCLICK, accion=4 [08:04:02] [Client thread/INFO] [minecraft/GuiNewChat]: [CHAT] falseRIGHTCLICK, accion=4 ################################################################# jummmmm what could be wrong here ?? Prueba00 package modmercenario.items.pruebas; import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Enchantments; import net.minecraft.init.Items; import net.minecraft.item.EnumAction; import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.CapabilityItemHandler; import modmercenario.modmercenario; import modmercenario.init.Mitems; import modmercenario.items.materiales.materialBasico; import modmercenario.poderes.animacionMercenaria; import modmercenario.poderes.cdalm; import modmercenario.utilidades.chat; import modmercenario.utilidades.objetoobjetivo; import modmercenario.utilidades.util; //############################################################################################3 public class prueba00 extends materialBasico { private static String name = "materialesSuspensionderedstone"; public static final PropertyInteger LEVEL = PropertyInteger.create("level", 0, 3); // ############################################################################################3 public prueba00(String name) { super(name); //setRegistryName("prueba00/" + name); this.setHasSubtypes(false); this.maxStackSize = 1; this.setCreativeTab(modmercenario.materiales); //estado this.addPropertyOverride(new ResourceLocation("est"), new IItemPropertyGetter() { @SideOnly(Side.CLIENT) public float apply(ItemStack stack, World worldIn, EntityLivingBase entityIn) { animacionMercenaria alm = getAlmacenamiento(stack); return alm.getAnimation(); } }); }// fin de contructor // ############################################################################################3 // ############################################################################################3 @Override public ICapabilityProvider initCapabilities(ItemStack item, NBTTagCompound nbt) { if (item.getItem() instanceof prueba00) { animacionMercenaria alm = new animacionMercenaria(item, nbt); return alm; } return null; } // ############################################################################################3 public animacionMercenaria getAlmacenamiento(ItemStack stackIn) { //animacionMercenaria alm = getAlmacenamiento(stack); animacionMercenaria alm = (animacionMercenaria) stackIn.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP); return alm; } // ############################################################################################3 @Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { boolean sePudo = true; ItemStack stack = player.getHeldItem(hand); player.setActiveHand(hand); animacionMercenaria alm = getAlmacenamiento(stack); byte action = alm.getAccion(); chat.chatm((EntityPlayer)player, world.isRemote + "RIGHTCLICK, accion=" + alm.getAccion() ); if (stack.getMetadata() < 1) { player.setActiveHand(hand); return new ActionResult(EnumActionResult.SUCCESS, stack); } else { return new ActionResult(EnumActionResult.FAIL, stack); } } // ############################################################################################3 @Override public boolean onEntitySwing(EntityLivingBase player, ItemStack stack) { World world = player.world; animacionMercenaria alm = getAlmacenamiento(stack); if( !world.isRemote ) { byte action = alm.getAccion(); alm.setAccion(action + 1); chat.chatm((EntityPlayer)player, world.isRemote + "LEFTCLICK, accion=" + alm.getAccion() ); } return true; } // ############################################################################################3 // #########################################################################3 @Override public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { return !ItemStack.areItemStacksEqual(oldStack, newStack); } // ############################################################################################3 }// fin de la classe capability animacionMercenaria package modmercenario.poderes; import modmercenario.utilidades.util; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.capabilities.ICapabilitySerializable; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.ItemStackHandler; public class animacionMercenaria implements ICapabilityProvider, ICapabilitySerializable { private boolean init = false; private boolean play = false; private boolean pause = false; private boolean stop = false; private boolean hand = true; private long time = 0; private long accionstart = 0; private long accionfinis = 0; private short modelo = 0; //desde donde comienza a contar la animacion max 32,767 private byte accion = 0;//hasta 256 // 100 private byte paso = 0;//hasta 256 // 1 private byte maxpaso = 0;//hasta 256 private byte pasos[] = {0}; private short municion = 0; private short maxmunicion = 0; private short altmunicion = 0; private short altmaxmunicion = 0; private int serial = 0; private long inicializaciontime = 0L;// fecha de la primera inicializacion private long ultrevisioninv = 0L;// ultima vez que se revizo el inventario private ItemStack stack = ItemStack.EMPTY; private NBTTagCompound nbt = new NBTTagCompound(); private NBTTagCompound nbtIn = null; // constructor public animacionMercenaria(ItemStack item, NBTTagCompound nbtIn) { // this.entidad = entidadIn; this.stack = item; this.nbtIn = nbtIn; } public void clearNbt() { nbt = new NBTTagCompound(); } // ########################################################### @Override public NBTBase serializeNBT() { // System.out.println("### >>> serializeNBT()"); nbt.setBoolean("init",init ); nbt.setBoolean("play", play); nbt.setBoolean("pause", pause); nbt.setBoolean("stop", stop); nbt.setBoolean("hand",hand ); nbt.setLong("time", time); nbt.setLong("accionstart",accionstart ); nbt.setLong("accionfinis",accionfinis ); nbt.setShort("modelo", modelo); nbt.setByte("accion", accion); nbt.setByte("paso",paso ); nbt.setByte("maxpaso",maxpaso ); nbt.setByteArray("pasos", pasos); nbt.setShort("municion", municion); nbt.setShort("maxmunicion", maxmunicion); nbt.setShort("altmunicion",altmunicion ); nbt.setShort("altmaxmunicion", altmaxmunicion); nbt.setInteger("serial",serial ); nbt.setLong("inicializaciontime",inicializaciontime ); nbt.setLong("ultrevisioninv", ultrevisioninv); // nbtIn = nbt; return nbt; } // ########################################################### @Override public void deserializeNBT(NBTBase nbtIn) { // System.out.println("### >>> deserializeNBT"); NBTTagCompound nbt = (NBTTagCompound) nbtIn; init = nbt.hasKey("init") ? nbt.getBoolean("init") : false; play = nbt.hasKey("play") ? nbt.getBoolean("play") : false; pause = nbt.hasKey("pause") ? nbt.getBoolean("pause") : false; stop = nbt.hasKey("stop") ? nbt.getBoolean("stop") : false; hand = nbt.hasKey("hand") ? nbt.getBoolean("hand") : false; time = nbt.hasKey("time") ? nbt.getLong("time") : 0L; accionstart = nbt.hasKey("accionstart") ? nbt.getLong("accionstart") : 0L; accionfinis = nbt.hasKey("accionfinis") ? nbt.getLong("accionfinis") : 0L; modelo = nbt.hasKey("modelo") ? nbt.getShort("modelo") : 0; accion = (nbt.hasKey("accion")) ? nbt.getByte("accion") : 0; paso = nbt.hasKey("paso") ? nbt.getByte("paso") : 0; maxpaso = nbt.hasKey("maxpaso") ? nbt.getByte("maxpaso") : 0; pasos = nbt.hasKey("pasos") ? nbt.getByteArray("pasos") : pasos; municion = nbt.hasKey("municion") ? nbt.getShort("municion") : 0; maxmunicion = nbt.hasKey("maxmunicion") ? nbt.getShort("maxmunicion") : 0; serial = (nbt.hasKey("serial")) ? nbt.getInteger("serial") : 0; altmunicion = nbt.hasKey("altmunicion") ? nbt.getShort("altmunicion") : 0; altmaxmunicion = nbt.hasKey("altmaxmunicion") ? nbt.getShort("altmaxmunicion") : 0; } // ########################################################### @Override public boolean hasCapability(Capability<?> capability, EnumFacing facing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return true; } return false; } // ########################################################### @Override public <T> T getCapability(Capability<T> capability, EnumFacing facing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return (T) this; // return (T) new ItemStackHandler(2/**the amount of slots you // want*/); // This is the default implementation by forge, but you'll likely // want to make your own by overriding. } return null; } // ########################################################### public static animacionMercenaria inicializar(ItemStack stackIn, animacionMercenaria xb) { xb.setInit(true); xb.setSerial(getSerialAlHazar()); xb.setStack(stackIn); return xb; } // ########################################################################3 public static int getSerialAlHazar() { int R = ((int) (Math.random() * 9)); R = R + (((int) (Math.random() * 9)) * 10); R = R + (((int) (Math.random() * 9)) * 100); R = R + (((int) (Math.random() * 9)) * 1000); R = R + (((int) (Math.random() * 9)) * 10000); R = R + (((int) (Math.random() * 9)) * 100000); R = R + (((int) (Math.random() * 9)) * 1000000); R = R + (((int) (Math.random() * 8)) * 10000000) + 1; return R; } // ########################################################### public int getAnimation() { if( this.isPlay() ) { long t = System.currentTimeMillis(); byte[] arr = this.getPasos(); int i = 0; i = (int)(( t - this.getAccionstart() ) / 50); i = ( i >= arr.length)? (arr.length - 1) : i; return (int)( arr[i] + this.getModelo() ); } return this.getModelo(); } // ########################################################### public void play(int accion) { this.setTime(System.currentTimeMillis()); long t = this.getTime(); this.setAccion(accion); this.setModelo(1); byte[] arr = {1,2,3,4,5,6,7,8,9,10}; this.setPasos(arr); arr = this.getPasos(); this.setAccionstart(t); this.setAccionfinis( this.getAccionstart() + ( arr.length * 50 )); this.setPlay(true); this.setStop(false); this.setPause(false); } // ########################################################### public boolean isInit() { return init; } public void setInit(boolean init) { this.init = init; } public boolean isPlay() { return play; } public void setPlay(boolean play) { this.play = play; } public boolean isPause() { return pause; } public void setPause(boolean pause) { this.pause = pause; } public boolean isStop() { return stop; } public void setStop(boolean stop) { this.stop = stop; } public boolean isHand() { return hand; } public void setHand(boolean hand) { this.hand = hand; } public long getTime() { return time; } public void setTime(long time) { this.time = time; } public long getAccionstart() { return accionstart; } public void setAccionstart(long accionstart) { this.accionstart = accionstart; } public long getAccionfinis() { return accionfinis; } public void setAccionfinis(long accionfinis) { this.accionfinis = accionfinis; } public short getModelo() { return modelo; } public void setModelo(int modelo) { this.modelo = (short)modelo; } public byte getAccion() { return accion; } public void setAccion(int accion) { this.accion = (byte)accion; } public byte getPaso() { return paso; } public void setPaso(byte paso) { this.paso = paso; } public byte getMaxpaso() { return maxpaso; } public void setMaxpaso(byte maxpaso) { this.maxpaso = maxpaso; } public byte[] getPasos() { return pasos; } public void setPasos(byte[] pasos) { this.pasos = pasos; } public short getMunicion() { return municion; } public void setMunicion(short municion) { this.municion = municion; } public short getMaxmunicion() { return maxmunicion; } public void setMaxmunicion(short maxmunicion) { this.maxmunicion = maxmunicion; } public short getAltmunicion() { return altmunicion; } public void setAltmunicion(short altmunicion) { this.altmunicion = altmunicion; } public short getAltmaxmunicion() { return altmaxmunicion; } public void setAltmaxmunicion(short altmaxmunicion) { this.altmaxmunicion = altmaxmunicion; } public int getSerial() { return serial; } public void setSerial(int serial) { this.serial = serial; } public long getInicializaciontime() { return inicializaciontime; } public void setInicializaciontime(long inicializaciontime) { this.inicializaciontime = inicializaciontime; } public long getUltrevisioninv() { return ultrevisioninv; } public void setUltrevisioninv(long ultrevisioninv) { this.ultrevisioninv = ultrevisioninv; } public ItemStack getStack() { return stack; } public void setStack(ItemStack stack) { this.stack = stack; } public NBTTagCompound getNbt() { return nbt; } public void setNbt(NBTTagCompound nbt) { this.nbt = nbt; } public NBTTagCompound getNbtIn() { return nbtIn; } public void setNbtIn(NBTTagCompound nbtIn) { this.nbtIn = nbtIn; } // ########################################################### }
-
[1.12.2] item whit sub items where i star ?(SOLVED)
perromercenary00 replied to perromercenary00's topic in Modder Support
ya i got it also the textures i have to change mi items class to declare the textures accordantly @Override public void getSubItems (CreativeTabs tab, NonNullList<ItemStack> subItems) { if (getCreativeTab() != tab) return; super.getSubItems(tab, subItems); //subItems.add(new ItemStack(this, 1, 0)); subItems.add(new ItemStack(this, 1, 1)); subItems.add(new ItemStack(this, 1, 2)); subItems.add(new ItemStack(this, 1, 3)); subItems.add(new ItemStack(this, 1, 4)); subItems.add(new ItemStack(this, 1, 5)); } and the textures ModelLoader.setCustomModelResourceLocation(materialessuspensionderedstone, 1, new ModelResourceLocation( "modmercenario:materiales/materialessuspensionderedstone", "inventory")); ModelLoader.setCustomModelResourceLocation(materialessuspensionderedstone, 2, new ModelResourceLocation( "modmercenario:materiales/materialessuspensionderedstone", "inventory")); ModelLoader.setCustomModelResourceLocation(materialessuspensionderedstone, 3, new ModelResourceLocation( "modmercenario:materiales/materialessuspensionderedstone", "inventory")); ModelLoader.setCustomModelResourceLocation(materialessuspensionderedstone, 4, new ModelResourceLocation( "modmercenario:materiales/materialessuspensionderedstone", "inventory")); ModelLoader.setCustomModelResourceLocation(materialessuspensionderedstone, 5, new ModelResourceLocation( "modmercenario:materiales/materialessuspensionderedstone", "inventory")); Thanks for guidance now i gonna mark this as solved and continue whit the next -
good days I'm searching for a guide on how to use animation api to make a good looking items well i think is called animation api i get little information after decompressing the over watch mod and wanna make items luck like this an animated where i get i good guide to create good loking items an animate them tanks for reading sorry for broken english
-
[1.12.2] item whit sub items where i star ?(SOLVED)
perromercenary00 replied to perromercenary00's topic in Modder Support
i alredy try something this must spaw the items in my materials tab but no luck // ############################################################################################3 //@SideOnly(Side.CLIENT) public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) { subItems.add(item1); subItems.add(item2); //subItems.add(new ItemStack(itemIn, 1, 0)); //subItems.add(new ItemStack(itemIn, 1, 1)); //subItems.add(new ItemStack(itemIn, 1, 2)); } @Override public void getSubItems (CreativeTabs tab, NonNullList<ItemStack> subItems) { if (getCreativeTab() != tab) return; super.getSubItems(tab, subItems); subItems.add(new ItemStack(this, 1, 0)); subItems.add(new ItemStack(this, 1, 1)); subItems.add(new ItemStack(this, 1, 2)); } -
Days good I'm updating mi mod to 1.12 more or less rebooting and redoing everything stuck a little here trying to make and item whit sub items in this case i need to make two sub items for a potion, Redstone dust in a bottle, Redstone suspension, and Redstone suspension activated in the old times of 1.8 you just ned to add this.setHasSubtypes(true); to constructor and a pair of functions to add the items to mi custome tabs thats not working any more can someone point me to a guide where they explain how to make sub items and item texture ? thanks for reading sorry for broken English //·································································································································· package modmercenario.items.materiales; //import modmercenario.Items.REDSTONE.suspensionderedstone; import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Enchantments; import net.minecraft.init.Items; import net.minecraft.item.EnumAction; import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import modmercenario.init.Mitems; import modmercenario.utilidades.chat; import modmercenario.utilidades.objetoobjetivo; import modmercenario.utilidades.util; //############################################################################################3 public class materialessuspensionderedstone extends materialBasico { private static String name = "materialesSuspensionderedstone"; public static final PropertyInteger LEVEL = PropertyInteger.create("level", 0, 3); public static ItemStack item1; public static ItemStack item2; // ############################################################################################3 public materialessuspensionderedstone(String name) { super(name); this.setCreativeTab(CreativeTabs.REDSTONE); this.setHasSubtypes(true); this.maxStackSize = 1; item1 = new ItemStack(this); item1.setItemDamage(0); item2 = new ItemStack(this); item2.setItemDamage(1); this.addPropertyOverride(new ResourceLocation("shake"), new IItemPropertyGetter() { @SideOnly(Side.CLIENT) public float apply(ItemStack stack, World worldIn, EntityLivingBase entityIn) { if ((entityIn != null) && (entityIn.isHandActive()) && (entityIn.getActiveItemStack() == stack)) { // System.out.println(" apply() Mundo="+worldIn.isRemote); return 1.0F; } else { return 0.0F; } } }); }// fin de contructor // ############################################################################################3 // ############################################################################################3 @Override public String getUnlocalizedName(ItemStack stack) { // String name="suspensionderedstone"; switch (stack.getMetadata()) { case 1: return name + "Activada"; default: return name; } } // ############################################################################################3 //@SideOnly(Side.CLIENT) public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) { //subItems.add(item1); //subItems.add(item2); subItems.add(new ItemStack(itemIn, 1, 0)); subItems.add(new ItemStack(itemIn, 1, 1)); subItems.add(new ItemStack(itemIn, 1, 2)); } @Override public void getSubItems (CreativeTabs tab, NonNullList<ItemStack> subItems) { if (getCreativeTab() != tab) return; super.getSubItems(tab, subItems); subItems.add(new ItemStack(this, 1, 0)); subItems.add(new ItemStack(this, 1, 1)); subItems.add(new ItemStack(this, 1, 2)); } // #########################################################################3 //@SideOnly(Side.CLIENT) public void addInformation(ItemStack suspencion, EntityPlayer playerIn, List list, boolean aBoolean) { String lore = ""; switch (suspencion.getMetadata()) { case 0: lore = "Hold RigthClick to shake"; break; case 1: lore = "Solucion Activada Ready to Use"; break; case 2: lore = "Add Watter and shake"; break; } list.add(lore); } // ############################################################################################3 // @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { boolean sePudo = true; ItemStack stack = playerIn.getHeldItem(handIn); playerIn.setActiveHand(handIn); // itemStackIn.setItemDamage(3); if (stack.getMetadata() == 2) { if (!worldIn.isRemote && playerIn instanceof EntityPlayer) { objetoobjetivo objetivo = new objetoobjetivo(worldIn, playerIn, 5, 1); if (objetivo.getHayBloque()) { BlockPos targetPos = objetivo.getBloqueObjetivo(); IBlockState targetSt = worldIn.getBlockState(targetPos); Block targetBlk = targetSt.getBlock(); if (targetBlk == Blocks.CAULDRON) { int level = ((Integer) targetSt.getValue(LEVEL)).intValue(); chat.chatm(playerIn, "target cauldron l=" + level); if (level > 0) { ItemStack replaceItemStack = new ItemStack(Mitems.materialessuspensionderedstoneactivada, 1, 0); // worldIn.playSoundAtEntity(playerIn, // "modmercenario:extingir", 1.0F, 1.0F ); Item comparationItem = Mitems.materialessuspensionderedstone; EnumHand ManoActiva = playerIn.getActiveHand(); ItemStack leftHand = playerIn.getHeldItem(EnumHand.OFF_HAND); ItemStack rightHand = playerIn.getHeldItem(EnumHand.MAIN_HAND); int handsl = playerIn.inventory.currentItem; ItemStack itemstack = null; itemstack = playerIn.inventory.getStackInSlot(handsl); if (ManoActiva != null && ManoActiva == EnumHand.MAIN_HAND && itemstack.getItem() == comparationItem) { // chat.chatm(playerIn, "replacing the Item in // MAIN_HAND"); rightHand.setItemDamage(0); } itemstack = playerIn.inventory.getStackInSlot(40); if (ManoActiva != null && ManoActiva == EnumHand.OFF_HAND && itemstack.getItem() == comparationItem) { // chat.chatm(playerIn, "replacing the Item in // OFF_HAND"); leftHand.setItemDamage(0); } } level--; if (level < 0) { level = 0; } worldIn.setBlockState(targetPos, targetSt.withProperty(LEVEL, Integer.valueOf(level))); } else // (meta == 2 && entityLiving instanceof EntityPlayer) { chat.chatm((EntityPlayer) playerIn, "This is Just dry dust"); chat.chatm((EntityPlayer) playerIn, "add watter and try again"); chat.chatm((EntityPlayer) playerIn, "Esto solo tiene polvo seco"); chat.chatm((EntityPlayer) playerIn, "Agreguele agua y vuelva a intentarlo"); } } } // playerIn.setActiveHand(hand); } if (stack.getMetadata() < 1) { playerIn.setActiveHand(handIn); return new ActionResult(EnumActionResult.SUCCESS, stack); } else { return new ActionResult(EnumActionResult.FAIL, stack); } } // ############################################################################################3 /** * Called each tick as long the item is on a player inventory. Uses by maps to * check if is on a player hand and update it's contents. */ @Override public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { if (isSelected && !worldIn.isRemote) { if (entityIn instanceof EntityLivingBase) { EntityLivingBase playerIn = (EntityLivingBase) entityIn; EnumHand ManoActiva = playerIn.getActiveHand(); } } } // ############################################################################################3 @Override public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack itemStackIn) { World worldIn = entityLiving.world; if (entityLiving instanceof EntityPlayer) { EntityPlayer playerIn = (EntityPlayer) entityLiving; EnumHand hand = playerIn.getActiveHand(); ItemStack offHand = playerIn.getHeldItem(EnumHand.OFF_HAND); ItemStack mainHand = playerIn.getHeldItem(EnumHand.MAIN_HAND); } return true; } // ############################################################################################3 @Override public void onUsingTick(ItemStack stack, EntityLivingBase player, int count) { // World worldIn = player.worldObj; } // ############################################################################################3 /** * Called when the player stops using an Item (stops holding the right mouse * button). */ @Override public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBase entityLiving, int timeLeft) { } // ############################################################################################3 @Override public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) { if (!worldIn.isRemote) { if (entityLiving instanceof EntityPlayer) { int meta = stack.getMetadata(); // suspension de redstone ajitandose if (meta == 0) { System.out.println("(meta == 0)"); ItemStack replaceItemStack = new ItemStack(Mitems.materialessuspensionderedstoneactivada, 1, 0); Item comparationItem = Mitems.materialessuspensionderedstone; EntityPlayer playerIn = (EntityPlayer) entityLiving; EnumHand ManoActiva = playerIn.getActiveHand(); ItemStack leftHand = playerIn.getHeldItem(EnumHand.OFF_HAND); ItemStack rightHand = playerIn.getHeldItem(EnumHand.MAIN_HAND); int hand = playerIn.inventory.currentItem; ItemStack itemstack = null; itemstack = playerIn.inventory.getStackInSlot(hand); if (ManoActiva != null && ManoActiva == EnumHand.MAIN_HAND && itemstack.getItem() == comparationItem) { // chat.chatm(playerIn, "replacing the Item in // MAIN_HAND"); rightHand.setItemDamage(1); // playerIn.inventory.markDirty(); } itemstack = playerIn.inventory.getStackInSlot(40); if (ManoActiva != null && ManoActiva == EnumHand.OFF_HAND && itemstack.getItem() == comparationItem) { // chat.chatm(playerIn, "replacing the Item in // OFF_HAND"); leftHand.setItemDamage(1); } int playerInvZise = playerIn.inventory.getSizeInventory(); for (int i = 0; i < playerInvZise; ++i) { itemstack = playerIn.inventory.getStackInSlot(i); if (itemstack != null) { System.out.println("SLOT[" + i + "]=" + itemstack.getUnlocalizedName()); } } } } } return stack; } // ############################################################################################3 @Override public int getMaxItemUseDuration(ItemStack stack) { return 60; } // ############################################################################################3 @Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.NONE; } // #########################################################################3 @Override public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { return !ItemStack.areItemStacksEqual(oldStack, newStack); } // ############################################################################################3 }// fin de la classe
-
good days some time ago i made the same question and the answer means to mess whith an event in the client side, But that method has its down side for why i end not using it now im thinking in create and item whith a transparent texture, give this item a capability of store an slot and giveit a timer afther what it will disapear from inventory and restore the original item to he slot let say i have the bow in the offhand slot the [40] and have the arrow in the main hand slot[2] so i made the code in the bow to wen it reach onitemUse() tick = 1; its call the transparent item, via capability the transparent item gonna store the mainhand stack from slot[2] and set itself in that slots[2] whith a timer of 20ticks afther that the transparent item set again the arrowstack in the slot[2] and delete ifself, if after 20ticks the bow is still thigtheng it repets the operations until shoot the arrow well this solution seem to me to complicated but its something ####################################3 ? its a better and easy way to hide the other hand item while using this other ¿
-
Good days in the previous 1.8 version i made a custom render gui class, to display the munition info and other stuff, was hard to get it whith all the info, this time idont wanna kill mi self so much soo i wanna tray find an alternative method i been notice than when i made an item the hotbar icon for the item is the same item texture an if i made an animation in the item the hotbar icon also change ################## soo i wanna know if its posible to have a diferent json file for the hotbar icon ? but whithout mess whith the firstview item texture it is posible?, is posible to changeit in the run? actually in mi mod i have a bow and 4 diferents kinds of arrow, plus vainilla arrow five arrow for all i wanna set this item bow hotbar icon to display the bow icon whith tootpick representing the current type of arrow and the amoung number of arrows remainig in the inventory of the selected kind but keeping the onhand animation as its now something like icono normal in the hot bar icono plus info from the arrow type and the amount of this kind of arrow in inventory this was mi bows in 1.8 Thanks for reading