Jump to content

perromercenary00

Members
  • Posts

    813
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by perromercenary00

  1. yaa i found some trouble // ########## ########## ########## ########## @Override public void inventoryTick(ItemStack container, Level warudo, Entity en, int slot, boolean p_41408_) { //stufff //if(!warudo.isClientSide()) { System.out.println( "inventoryTick(slot[" + slot + "] " + warudo.isClientSide() + " )" ); if( !decrease_tick(container) ) { unhide_slot(en, slot, container); } } } this piece of code i setup a sytem out on it inventoryTick(slot[9] false ) inventoryTick(slot[9] false ) inventoryTick(slot[9] true ) inventoryTick(slot[9] true ) inventoryTick(slot[9] false ) but when im using the slot 40 the offhand the funtion slot returns zeroes inventoryTick(slot[0] true ) inventoryTick(slot[0] true ) inventoryTick(slot[0] true ) inventoryTick(slot[0] false ) inventoryTick(slot[0] false ) inventoryTick(slot[0] true ) i change the method to store the slot number in the itemstack an pass the full itemstack to the unhide method // ########## ########## ########## ########## ########## ########## public static boolean unhide_slot( Entity en, int slot, ItemStack container ){ //System.out.print("unhide_slot( en, " + slot + " )"); if( en instanceof Player ){ Player pe = (Player)en; ItemStack stack = ItemStack.EMPTY; if( container == ItemStack.EMPTY ){ return false; } CompoundTag nbt = get_nbt(container); if( container.getItem() instanceof item_hidder ){ stack = read_item_from( container ); slot = nbt.getInt("slot"); } pe.getInventory().setItem(slot, stack); } return true; }
  2. im retaken and old problem i need to remove or hide the offhand item when pulling a bow well so i make a custome item invisible texture (still purple back i gonna fix that later) to replace the offhand item storing it inside and after a time it deletes itself and return the original item to the offhand in this case the offhand has two sapplings the problem is the item_hidder stuck's and keeps stuck until i try to interact whit the offhand slot but if target any other slot it work as expected in this case afecthing the slot 1 whit the briefcase works as it must ···················································3 i think i need a command to force update player inventory way it reloads data client side event if the item change is only do it in the server side well thanks for your attention
  3. on_toss it is // #################### #################### #################### @SubscribeEvent public static void on_toss(ItemTossEvent event) { Entity entity = event.getEntity(); Level warudo = entity.level; if (entity instanceof ItemEntity) { ItemEntity item_e = (ItemEntity) entity; ItemStack itemstack = item_e.getItem(); System.out.println("\n ItemTossEvent " + itemstack.getDisplayName().getString() + "\n"); // #################### #################### if (itemstack.getItem() == ItemInit.INGOT_IRON_RED_HOT.get() && !warudo.isClientSide) { try { red_hot_iron_entity w_entity = new red_hot_iron_entity(EntityInit.RED_HOT_IRON_ENTITY.get(), warudo, item_e); w_entity.setPos(item_e.getX(), item_e.getY(), item_e.getZ()); warudo.addFreshEntity(w_entity); } catch (Exception e) { System.out.println("Something went wrong." + e.toString()); } } // #################### #################### if (itemstack.getItem() == Items.EGG && !warudo.isClientSide) { System.out.println("\n\n EGGGGGGG \n\n"); try { ItemStack itemdrop = new ItemStack(Items.FEATHER, 1); ItemEntity newdrop = new ItemEntity(warudo, (double) (entity.position().x), (double) (entity.position().y + 1.0F), (double) (entity.position().z), itemdrop); warudo.addFreshEntity(newdrop); } catch (Exception e) { System.out.println("Something went wrong." + e.toString()); } } } }
  4. this item store the offhand when left click and restore it on right clock the rest of the logic you must doo on inventory tick or your events
  5. just updathing kinda make it works but don't like the way it works if i manually create the tileentity and cast it into the world it don't works you have to create an structure block or you have to create an structure block then get the tile entity form it and set the values the other weird thing its you have to call two times sbe.loadStructure( ((ServerLevel)warudo) ); sbe.loadStructure( ((ServerLevel)warudo) ); other way it only highlights the area where the structure gonna appear for the other side looks like i can reuse the StructureBlockEntity manytimes now the other thing is how i get a list of the minecraft nbt structures included on minecraft ?? // ########## ########## ########## ########## @Override public InteractionResultHolder<ItemStack> use(Level warudo, Player pe, InteractionHand hand) { System.out.println("public InteractionResultHolder<ItemStack> use " + warudo.isClientSide() ); if (!warudo.isClientSide) { // && !warudo.isClientSide Target target = new Target(warudo, pe, 10); Postate rp = target.get_postate(); String Name = "tunel00"; // /home/usuario/workspace/1.19.4/mercblk-mdk/src/main/resources/data/mercblk/structures/test2.nbt //ResourceLocation structureName; if (rp != null) { BlockPos blockpos1 = rp.get_blockpos();//blockpos.offset(this.structurePos); rp.setBlockState( Blocks.STRUCTURE_BLOCK ); rp.setBlock(2); //warudo.setBlockEntity( new StructureBlockEntity(blockpos1, Blocks.STRUCTURE_BLOCK.defaultBlockState() ) ); BlockEntity be = warudo.getBlockEntity(blockpos1); StructureBlockEntity sbe = (StructureBlockEntity)be; //"structures/" + ResourceLocation structureName = new ResourceLocation(mercblk.MOD_ID, Name ); // /home/usuario/workspace/1.19.4/mercblk-mdk/src/main/resources/data/mercblk/structures/house00.nbt sbe.setStructureName(structureName); sbe.setIgnoreEntities(false); sbe.setStructurePos( new BlockPos(0, -4, 0) ); sbe.loadStructure( ((ServerLevel)warudo) ); sbe.loadStructure( ((ServerLevel)warudo) ); System.out.println( sbe.getStructurePos() ); System.out.println( sbe.getStructureName() ); warudo.removeBlockEntity(blockpos1); //structure_void //structure_block } } return InteractionResultHolder.pass(pe.getItemInHand(hand)); }
  6. check the deltas Vec3 vm = pe.getDeltaMovement(); if( (vm.x + vm.y + vm.z) > 0 ){ //stuff }
  7. currently trying this from a custome stick dont works but also dont return error // ########## ########## ########## ########## @Override public InteractionResultHolder<ItemStack> use(Level warudo, Player pe, InteractionHand hand) { System.out.println("public InteractionResultHolder<ItemStack> use " + warudo.isClientSide() ); if (!warudo.isClientSide) { // && !warudo.isClientSide Target target = new Target(warudo, pe, 10); Postate rp = target.get_postate(); String Name = "test2"; // /home/usuario/workspace/1.19.4/mercblk-mdk/src/main/resources/data/mercblk/structures/test2.nbt //ResourceLocation structureName; if (rp != null) { BlockPos blockpos1 = rp.get_blockpos();//blockpos.offset(this.structurePos); // /home/usuario/workspace/1.19.4/mercblk-mdk/src/main/resources/data/mercblk/structures/house00.nbt StructureBlockEntity sbe = (StructureBlockEntity)newBlockEntity(blockpos1, Blocks.STRUCTURE_BLOCK.defaultBlockState() ); sbe.setStructureName("mercblk:tunel01"); sbe.setIgnoreEntities(false); sbe.setStructurePos( blockpos1 ); sbe.loadStructure( ((ServerLevel)warudo) ); System.out.println( sbe.getStructurePos() ); System.out.println( sbe.getStructureName() ); } } }
  8. hi well i dont have idea of have to do it i was googling and cannot figure it out by myself i want this item to spawn a village whit an small wall adapting the shape to the terrain variables step one already have made code to fix the land to slabs and remove trees step two) made the paths and the sewers i have made this two nbt structures /home/usuario/workspace/1.19.4/mercblk-mdk/run/saves/Mundo Juego/generated/minecraft/structures/tunel00.nbt /home/usuario/workspace/1.19.4/mercblk-mdk/run/saves/Mundo Juego/generated/minecraft/structures/tunel01.nbt the plan is to loop spawn this two structures next each other until it forms a grass path whit a sewer tunnel below having in count the terrain heighs there must be a forge class already existing to spawn nbt structures in to the world something like : ForgeUtils.something.spawnStructureAt( "run/saves/Mundo Juego/generated/minecraft/structures/tunel00.nbt" , position, rotation ); but i dont know what it is and cannot figure it out form the structure block code for step tree i need to spawn some houses step four is the wall itself ######################################################## more exactly i need an example of how to spawn an structure in the world so i can use it whit a custome rod // ########## ########## ########## ########## @Override public InteractionResultHolder<ItemStack> use(Level warudo, Player pe, InteractionHand hand) { //System.out.println("public InteractionResultHolder<ItemStack> use "); //if (!warudo.isClientSide) { // && !warudo.isClientSide Target target = new Target(warudo, pe, 10); Postate rp = target.get_postate(); if (rp != null ) { lever_this_land ltl = new lever_this_land(warudo, rp.get_blockpos(), 32 ); High_Map hm = ltl.getHm(); hm.print(); Block_Map bm = ltl.getBm(); bm.setBlocks(); } } return InteractionResultHolder.pass(pe.getItemInHand(hand)); } thanks for your attention
  9. // ########## ########## ########## ########## ########## ########## public ArrayList<BlockState> getBuildingPalette(CompoundTag nbt) { ArrayList<BlockState> palette = new ArrayList<>(); // load in palette (list of unique blockstates) ListTag paletteNbt = nbt.getList("palette", 10); CompoundTag pblk; Block block = null; for (int i = 0; i < paletteNbt.size(); i++) pblk = paletteNbt.getCompound(i); String name = pblk.getString("Name"); block = ForgeRegistries.BLOCKS. .getValue(name); //palette.add(NbtUtils.readBlockState( paletteNbt.getCompound(i) ) ); return palette; }
  10. currently i im in the same predicament whit the same function the only i can thing of is to somehow get the block name and mod id from paletteNbt.getCompound(i) and used to get the block from the ForgeRegistries.BLOCKS list just to pass it here
  11. in the old version i have some issues animating mi guns i set some System.outs to figure out what was happends and from the class reading the value to chose what model to render was returning zeroes when it was a value on it ModItemModelProperties.make_bow_bow( ItemInit.BOW_CARBON.get() ); //###### ###### ###### ###### ###### ###### public static void make_bow_bow(Item item) { ItemProperties.register(item, new ResourceLocation("pull"), (helditem, warudo, le, p_174638_) -> { //ItemModelsProperties.register(item, new ResourceLocation("pull"), (helditem, warudo, le) -> { if (le == null) { return 0.0F; } else { CompoundTag tags = helditem.getTag(); int anim = tags.getInt("anim"); System.out.println("anim=" + anim); return anim; } }); } anim was return zeroes most of the time this code fires in average 3 times per tick so it must be like 000 111 222 333 but was more like 000 010 000 033
  12. the bandage model change must be done the same way the shield change models and it has to be done whit a capability for some reason nbt fails to read part of the times from the client side
  13. there's no circles that's forbidden geometry the closes is to create 16 cuboids and rotate them to fill the form the wide of every cuboids must be manually calculated to fit https://rechneronline.de/pi/hexadecagon.php
  14. im updating the manhole block to 19.4 im looking for a way to make the cover animation smooth FallingBlockEntity fallingBlock = FallingBlockEntity.fall(level, pos.north().above(2), BlockInit.MANHOLE_COVER_PANEL.get().defaultBlockState().setValue(BlockStateProperties.FACING, Direction.DOWN)); level.addFreshEntity(fallingBlock); the basic code for the falling block just create an entity whit the block model and let it fall from the starting position i need to move horizontally so i set a delta FallingBlockEntity fallingBlock = FallingBlockEntity.fall(level, pos.north().above(2), BlockInit.MANHOLE_COVER_PANEL.get().defaultBlockState().setValue(BlockStateProperties.FACING, Direction.DOWN)); //fallingBlock.set(fallingBlock.DATA_NO_GRAVITY, true); fallingBlock.setDeltaMovement(0.1D, 0.4D, 0.0D); level.addFreshEntity(fallingBlock); soo it posible to set the FallingBlockEntity to move other way besides down ?? the other thing i was thinking was to make a custom FloathingBlockEntity but the old problem affect me like wheres the FallingBlockEntity renderer and model classes to extend the call and use the same renderer not having to manually create a model of the already existing manhole_cover_panel block Thanks for your time
  15. no no no get the idea where that `stacksTo` item properti is
  16. is like many people has been this issue/idea but never see a vainilla/forge way to do it (the same way the bow hiddes the offhand item) to do this i create a invisible item "hidder_item" whit an inventory from the custome bow create this "hidder_item" store the actual item in the offhand and put the "hidder_item" in the offhand slot this "hidder_item" must have a ticker function than after sole time or some condition meet it takes out the stored item delete itself and put the item back in offhand
  17. no this is in the item class or in the block class in old version you set the limit of the stack size in the constructor
  18. //@Override // Use ItemStack sensitive version. public static int getMaxStackSize() { return 1; } //Error display by intellij //getMaxStackSize()' cannot override 'getMaxStackSize()' in 'net.minecraft.world.item.Item'; overridden method is final
  19. im updating mi briefcase item to 19.4 i t has two parts an item whit a menu and a block whit a menu that spawn when shift right click on the floor i wanna limit this to only one for slot that's max stack size = one seems to have not this value and items says its deprecated use another thing @Deprecated // Use ItemStack sensitive version. public final int getMaxStackSize() { return this.maxStackSize; } how do i set stack limits now
  20. Nice question you can use directly nbt or create a capability whats the deal NBT is data stored inside an internal database every time you recall data it has to create an NBT object and query the internal database to read or write data Capability is a java object loaded in memory it recall data from the item internally uses NBT but only query save/write data when changes are detected, capabilities keep loaded in memory until the item is stored or discarted if you just gonna store a simple number you gonna call one every 2 or 3 ticks like the ammunition/fuel count then no problem on using NBT directly but if you wanna doo complex thing that need to consult data every tick or worst as mi items that uses json system to display animations client side it gonna slowdown the computer this case is better to recall the data from the capability loaded in memory and the capability will take care of read/writing nbt thing only when changes are detected this gun was made animation in client side whit nbt in old 1.8 its choppy and skip badly frames this one was made in 1.12 whit a capability to query the data client side
  21. hola im doing a costume block to simulate a water stream the code it more or less done but the texture the rendered is not first the block is not translucent i take the water animated texture "water_still.png.mcmeta" an delete a frange to see what happens and wtf soo i remove the tintindex thing to experiment and not it is not the problem there is in minecraft alredy transparent textures like the stained glass soo i set it whit the "light_blue_stained_glass.png" whit no tintindex ######################### jummmm theres some option or flag missing i alredy check the stained glass and dont see anyting usable public static final Block CYAN_STAINED_GLASS = register("cyan_stained_glass", stainedGlass(DyeColor.CYAN)); mi block declaraion public static final RegistryObject<Block> RUNNING_WATER = registerBlock( "running_water", () -> new rwater(BlockBehaviour.Properties.copy(Blocks.WATER).noOcclusion(), """ { "name":"running_water", "en_us_lang" : "Running Water", "es_es_lang" : "Corriente de Agua" } """, crear_archivos ) ); this is mi model for the block ############## Mi target is to make mi custom water block to look like the vanilla water block what could be needed to make a block transparent in 1.19.4 ??
  22. im trying to fix a few things for a custome toilet whit running water in this moment i alredy have keybinds and custome packages to be sended to the server side and thas working now im trying to send a package from the server side to the client side soo ijust copy paste the server package code and change in the declaration NetworkDirection.PLAY_TO_SERVER to NetworkDirection.PLAY_TO_CLIENT seems it dont trow errors but don't works still the messages gets in the console so its running i notice in this line the player is null ServerPlayer player = context.getSender(); System.out.print( ((player != null)? player.getDisplayName() : "NullPlayer" ) ); //this returns nullPlayer ############################## i need a guide on how to send a package form server to client side or a way to get the player entity form the local world i remember in 1.8 you have to do something like Minecraft mc = new Minecraft() Player pe = mc.getThePlayer(); .... half working code i made just guessing thanks for your time
  23. no i dont want tile entities coze it could be like 250 of this spawned in a tick and dessapear 10 sec later mi water block is just for temporally simulate a water current for a brief moment it just appears replacing a water block for around 10sec then it replace itself whit normal water again the block also toggles on the swim pose in the player so it can get through narrow paths the thing is i need the player to automatically unswim when no longer in contact whit this blue block that's the part that don't works this is the toilet block, when flushed it spins the entities a while then detect water blocks and replace them for mi block and send the entities through than water stream the trouble is than the player gets stuck on Pose.SWIMING after going out of the water stream i made a keybind and some packages to make the player crawl using Pose.SWIMMING but i need to make automatically uncrawl when out mi custome water block so i was thinking in a delay package that checks if player is outside of block an then proceed i been trying whit an entity but only works when feels like it Thanks for your time
×
×
  • Create New...

Important Information

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