Jump to content

perromercenary00

Members
  • Posts

    825
  • Joined

  • Last visited

  • Days Won

    4

perromercenary00 last won the day on April 10

perromercenary00 had the most liked content!

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Recent Profile Visitors

168426 profile views

perromercenary00's Achievements

Dragon Slayer

Dragon Slayer (6/8)

7

Reputation

  1. thast right kapenjoe says something about not going up from 1.20.2 for some package issue i have the mine working messing around until the code start working still seems like you have some more complex than the mine //in mi main class //########## ########## ########## ########## ########## ########## ########## ########## private void commonSetup(final FMLCommonSetupEvent event) { ModMessage.register(); } ModMessage.class
  2. i has that anyway i test it at the beginning and the end of the function just to be sure @Override public void load( CompoundTag nbt ){ super.load( nbt ); Level warudo = this.getLevel(); itemhandler.deserializeNBT( nbt.getCompound("itemhandler") ); this.progress = nbt.getInt("progress" ); System.out.println("load(nbt)"); System.out.println(NbtUtils.prettyPrint(nbt)); //super.load( nbt ); } but it does the same looking at it a second time it seems like it only store the nbt data when the entity is created and set into the world then never update values
  3. hola thanks for answering i set some system outs to test and see whats going on @Override protected void saveAdditional( CompoundTag nbt ){ nbt.put("itemhandler", itemhandler.serializeNBT() ); nbt.putInt("progress", this.progress ); System.out.println("saveAdditional(nbt)"); System.out.println(NbtUtils.prettyPrint(nbt)); //<-- this is whats getting saved super.saveAdditional( nbt ); } @Override public void load( CompoundTag nbt ){ itemhandler.deserializeNBT( nbt.getCompound("itemhandler") ); this.progress = nbt.getInt("progress" ); System.out.println(NbtUtils.prettyPrint(nbt)); //<-- this is whats minecraft is giving back to the entity System.out.println("load(nbt)"); super.load( nbt ); } This dead adventurer body has two parts a block and a block Item both has their own item-handlers and their own menus all of that seems fine Testing remarks : *when i change some element inside the gui it triggers the saveAdditional(nbt) system out and shows a pretty print of the data being saved *when the world map loads it triggers the load(nbt) system out and shows a pretty print of the data minecraft is giving to this Block Entity For the testing i gonna set mi BlockEntityBodyBlock, save something in it, close minecraft, fireup the game again and check if the items remain ################ first try set the block entity (dead adventurer body like shaped) and left only a weath seed in the slot 10 the console says its all right close minecraft, launch it again i see the system out whit the data returned to the entity and its look good theres is only a weed seed ################ Second try, now i gonna change the seed for two arrows the console says its all right the two arrows are being saved ######### Now close and run again bam Error minecraft returns the original data whit only a wheat seed the two arrows has been loss ########## try again now i gonna put 3 wheat seeds Console system out says it gets it and is saving the data ############## but after close fire again wheat seed, data losed once more time and it just throw the original ####################################################################################### sorry for the long post and the crappy video this is the reason why i say its saving the Block Entity data only when it feels like coze its saves data when it feels like ¿ its something wrong whit mi BlockEntity.saveAdditional() if i keep trying eventually it updates and the data chages i alredy try to level.removeBlockEntity(pos); level.setBlockEntity(pos, bebb); BlockEntityBodyBlock.class BlockEntityInit.class body_blockitem.class
  4. well The problem is the data in mi blockentity, its not being saved when i close the game i put items on it i retrive items from it all just seems good, the problem cames until i close minecraft then when i reload the word i have an older version of the items saved or just an empty briefcase normally when you declare an entity or a block entity or an item capability, forge automatically keeps track of changes and save the data in nbt format all of this by itself in this moments i have some items whit capabilities, those work right i have entities , those also works right but all of mi blockentities all of them are storages briefcase and all of them fails, save the data sometimes most of the time don't well i have only like 3 blockentities up now
  5. im stuck in a problem whit BlockEntities i cannot solve so im trying to work around it but in the less complex way possible i think is posible to store data to the minecraft world in older versions people talk about WordDataSave i dont find anything about it for 1.20.4 i find a tutorial for player capability in 1.19 here is an event //########## ########## ########## ########## @SubscribeEvent public static void onAttachCapabilitiesPlayer(AttachCapabilitiesEvent<Entity> event) { if(event.getObject() instanceof Player) { if(!event.getObject().getCapability(PlayerThirstProvider.PLAYER_THIRST).isPresent()) { event.addCapability(new ResourceLocation(mercmod.MOD_ID, "properties"), new PlayerThirstProvider()); } } } soo i made this //########## ########## ########## ########## @SubscribeEvent public static void onAttachCapabilitiesLevel(AttachCapabilitiesEvent<Level> event) { } i think i can do some witchcraft here but is many things don't understand to start whit i dont get yet how to recall the saved data from a BlockEntity the handler still in progress the plan is to make a Map to store nbt data using the block coordinates as index later store that map as a big nbt ########## any way the question is if theres alredy a tutorial for 1.20.4 for this ?? or some alredy working code from someone else doing something similar ?
  6. looking around for the capabilities thing i found a piece of code and find this piece of code //########## ########## ########## ########## @SubscribeEvent public static void addCustomTrades(VillagerTradesEvent event) { if(event.getType() == VillagerProfession.FLETCHER) { System.out.println("\n\n### VillagerProfession.FLETCHER \n\n");//<----------- Int2ObjectMap<List<VillagerTrades.ItemListing>> trades = event.getTrades(); ItemStack stack = new ItemStack(ItemInit.ARROW_STEEL.get(), 16); int villagerLevel = 1; trades.get(villagerLevel).add((trader, rand) -> new MerchantOffer( new ItemStack(Items.EMERALD, 2), stack,1,3,0.02F)); } if(event.getType() == VillagerProfession.TOOLSMITH) { System.out.println("\n\n### VillagerProfession.TOOLSMITH \n\n");//<----------- Int2ObjectMap<List<VillagerTrades.ItemListing>> trades = event.getTrades(); ItemStack stack = new ItemStack(ItemInit.INGOT_STEEL.get(), 1); int villagerLevel = 1; trades.get(villagerLevel).add((trader, rand) -> new MerchantOffer( new ItemStack(Items.EMERALD, 2), stack,10,8,0.02F)); } } //########## ########## ########## ########## the event is aknoledge and execute when the maps load ### VillagerProfession.FLETCHER ### VillagerProfession.TOOLSMITH //########## But is not working is a random piece of code is not working could it be than this code is old 1.18 and no valid anymore for 1.20.4 or the thing are this numbers stack,10,8,0.02F)); i dont know what this numbers means ########## the question is ¿how to add things to the villager traders thanks for your attention
  7. I have problems whit mi blockEntities they just save data only when it feels like I just retake he topic after several weeks i know it not the menu nor the packages system was thinking something xtreame like make the block entities to read write the data as .nbt text files just coze i can but think don't worts the effort ################# mi question is if theres a way to espose and directly messup whit the minecraft nbt database system ?? like SELECT nbt FROM miwarudo WHERE x='127' and y='80' and z='-3627' or something whit CompoundTag worldnbt = warudo.getLevelData().something; ?? CompoundTag blockentitynbt = worldnbt.getDataAt(x,y,z) ??
  8. make your item spawns the minecrafts extructure block at the desire position gets the block entity from that block and use the block entity to load and spawns the extructure
  9. the log says your "is missing mods.toml file" check your toml file on "/src/main/resources/META-INF/mods.toml"
  10. sound like thing for arrow loose event @SubscribeEvent public static void ArrowLoose(ArrowLooseEvent event) { System.out.println("\n\n\n### ArrowLoose "); Player shooter = event.getEntity(); String sshooter = (shooter != null)? shooter.getDisplayName().getString() : "null"; ItemStack bow = event.getBow(); if( bow != null ){ bow.enchant( Enchantments.FLAMING_ARROWS, 3 ); System.out.println("### by " + sshooter ); System.out.println("### whit " + bow.getDisplayName().getString() ); } } this ones fires up before the arrow is released and for some reason dont works whit mi custom bows
  11. looks like this is the error "0": "blocks/tea", probably must looks something like this "0": "examplemod:block/tea",
  12. not a bug you have something wrong int the json files, the blockstate the block or the model of the block has some error
  13. good days this is a kind of cursed block intended to to be set in some dungeons and give lot as a chest The problem is it saves the items only when it feels like the gold and the emeralds just get loss after reload the world the block entity just goes back to the last saved state data the one whit the carbono armor item in the chest slot i made some experiments i made a custome itemhandler whit system outs to see whats happening the important part is this here this system out must only print when a change afects the itemhandler in the server side and here i manually force the block entity to save that custom itemhandler to the Block entity nbt and then save the BlockEnt to the world // ########## ########## ########## ########## public void save() { if (this.container == null) { System.out.println("\n#this.container is Null at save()#\n"); } if (this.container != null) { Level warudo = this.container.getLevel(); if(!warudo.isClientSide()) { System.out.println("\n#this.container is saving()#\n"); CompoundTag nbt = this.container.serializeNBT(); nbt.put("inventory", this.serializeNBT()); this.container.load(nbt); warudo.setBlockEntity(this.container); } return; } //this.container.saveAdditional( this.serializeNBT() ); } in the console i see this every time i take or move some item from the gui #this.container is saving()# #this.container is saving()# #this.container is saving()# #this.container is saving()# #this.container is saving()# #################################################### this means the menu is working and sending the changes to the server side but this blockentity nbt data is not getting save to the world warudo.setBlockEntity(this.container); is doing nothing i have more block entities and those entities has the same problem i just no notice it until know my guest is coze this happends before in 1.19 and that time whats coze i dont register the blockentities to the bus but this time im doing it the thing is that i think this is not valid for 1.20.4 coze i get it from a 1.20.1 tutorial an probably the way of declaring it has change again public static final RegistryObject<BlockEntityType<BlockEntityBodyBlock>> BLOCKENTITYMOBBLOCK = BLOCK_ENTITIES.register( "blockentitymobblock", () -> BlockEntityType.Builder.of( BlockEntityBodyBlock::new, BlockInit.DEAD_BODY.get() ).build(null) ); ############################################################################################ what i think i need is an example a working code gits whit block entities register soo i could fix the mines according to 1.20.4 thanks for reading the long post
  14. Good days advancing whit the problem from a post a made short ago and dint find anyway anyway i want to give the player a briefcase whit random stuff when play a new world for the first time i made this this event triggers once the world map finish loading but before the players and the entities get loaded into the world an from it i can get a block position close to the player random spawn point and do it every time yo play the world this block position returned is always the same and is no the same as the bonus chest ###WorldInit### New World warudo false, => BlockPos{x=0, y=54, z=0} lista 0 //<-- no players yet ###WorldInit### - first problem there's no player yet when triggered - second one it triggers every time you star the game and loads the world so it keeps creating again the glow stone block those giving the briefcase again ############## i was thinking into also spawn a black wool block at the block position but at y -63 soo every time its fires check if its a black wool block at -63 this way knows if its the first time or not the other think would be not create directly the briefcase but some block whit logic to tick() 5 seconds later when i suppose the players already loaded and then create the briefcase in front of the player ########## ########## ########## ########## someone knows about another event that trigger only once when the world is loaded and the players already inside the world ? way i dont have to made complicated stuff like this to make something like that thanks for your attention
  15. may you are talking about catching all the AGE declaration even the ones from other mods custom properties ? one would be to check only againts the minecraft BlockStateProperties class the other would be dirt your hands on the nbt data of the block and check if it have a string whit same name // ########## public String print() { BlockState blkstate = this.getBlockState(); String json = ""; //int id = Block.getId(blkstate); String propiedades = ""; for (Property<?> porp : blkstate.getProperties()) { System.out.println(porp.getName() + " -> " + blkstate.getValue(porp)); propiedades += String.format( ",\"%1$s\":\"%2$s\"", porp.getName(), blkstate.getValue(porp) ); } json = String.format("{\"blockname\":\"%1$s\",\"x\":\"%2$s\",\"y\":\"%3$s\",\"z\":\"%4$s\"%5$s}", this.get_blkfullname(), this.pos.getX(), this.pos.getY(), this.pos.getZ(), propiedades ); //System.out.println("\n" + json + "\n" ); return json; }
×
×
  • Create New...

Important Information

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