perromercenary00
Members-
Posts
849 -
Joined
-
Last visited
-
Days Won
5
Everything posted by perromercenary00
-
[1.19.4] limit stack size to 1 for Item and for Block
perromercenary00 replied to perromercenary00's topic in Modder Support
no no no get the idea where that `stacksTo` item properti is -
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
-
[1.19.4] limit stack size to 1 for Item and for Block
perromercenary00 replied to perromercenary00's topic in Modder Support
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 -
[1.19.4] limit stack size to 1 for Item and for Block
perromercenary00 replied to perromercenary00's topic in Modder Support
//@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 -
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
-
[1.19.4, ANSWERED] Capability or NBT for items?
perromercenary00 replied to LeeCrafts's topic in Modder Support
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- 1 reply
-
- 1
-
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 ??
-
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
-
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
-
good nights im working in a custome water block for a custome toilet im updathing to 1.19.4 and i wanna fix some issues the old code has for what i need to check every 20 ticks if the player is still inside mi custome watter block for some reason making a custome entity to track this dont works all the time is like the function entityInside(BlockState blkstate, Level warudo, BlockPos pos, Entity rider) is not running in the server world but some kind of pseudo world of something ###############################3 anyway the plan is to send a costume package to server side whit a delay this package when received must check if player is inside of the costume water block if not must reset the player pose to null or standing soo the issue is how to apply an delay to a package ??
-
i need some headstorm here 1.19.4 change the way to add the items and blocks to custome mod tabs now you have to use an event an manually add every item or block and thas a pain in <t> coze i have to many blocks soo i tell to miself what if i use a foor loop whith "DeferredRegister<Item> ITEMS" thing and it works it drops everything into the tab and i dont have to manually keep track of it if change something but i have some blocks and some items that are kinda metablocks/subitems basically the same block thing and i dont nedd/want them to be visible i try to filter them by class but dint works coze in this stage they are already converted to item block soo i cannot filter using instance of if(!(actualBlock instanceof trampilla)) { event.accept(actualBlock); } Sooo any idea how i can mark this items blocks to be excluded from the tab
-
yaa that is its even better coez includes the mod_id so no same name different mod collusion no string fixing needed 95 block="mercblk:oak_planks_trampilla", Oak Planks TrapDoor ); 96 block="minecraft:pink_concrete_powder", Pink Concrete Powder ); 97 block="minecraft:suspicious_sand", Suspicious Sand ); 98 block="minecraft:oak_planks", Oak Planks ); 99 block="minecraft:cut_sandstone", Cut Sandstone ); 100 block="minecraft:torchflower_crop", Torchflower Crop );
-
Im trying to update mi code from 19.2 to 19.4 need to fix the code to level up land sec 13 to 25 and find a little problem probably there from 19.2 i dint notice before when i call the block name it return localizated version of the name of the block soo it someone change the languague from english to any other it completely fucks up mi terrain and extructures //----------------------------------------- i need to find a way to retrieve the block name whitout localization System.out.println( actualBlock.getName().getString() ) ; if the game is in English it returns Oak Planks if the game is in Spanish it returns Tablas de Roble but the real name is "oak_planks" public static final Block OAK_PLANKS = register("oak_planks", new Block(BlockBehaviour.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(2.0F, 3.0F).sound(SoundType.WOOD))); Thanks for you time
-
To make that you have to calculate at the moment of the first hit the trajectory of the arrow extend it some meters calculate the final vector vo then using the position of the arrow at hit as vi an the vo check if there's another mods and do damage to them using the same functions the arrows use to causes damage
-
Im currently believing is some kind of bug fireup old 19.2 version and there the capability get the values synced immediately on every change anyway i find a workaround a hacky one if in the capability.class manually force it to save the nbtdata to the item It gets immediately updated to the client side looks like no side effect and brings an opening to made a working onUseTick() function inside the capability // ########## ########## ########## ########## public void save() { if (this.container == null) { System.out.println("\n#this.container is Null at save()#\n"); return; } this.container.setTag(serializeNBT()); }
-
Hellow good days Im remaking this item for 19.4 and this particular item has 3 types or states i store to a capability ih.type = 0 suspension normal unactivated ih.type = 1 suspension shaking ih.type = 3 suspension activated im storing the value of type in the capability on the server side to later retrieve that value in the client side to define what json texture the item gonna use i notice than the values form the capability in the server side are not updating immediately to client side sometimes it does after a while sometimes not , but if close the game and open it again then the values appears as expected in both server and client side this is whats i see in the console //client side this.comment => 0 this.start_time => 0 this.time => 0 this.type => 0 //server side this.comment => 0 this.start_time => 136810 this.time => 21 this.type => 1 ############################## sooo : * could be than capabilities declaration way has been change and just dont mark as error in mi intellij installation but still works coze hooked right to the item NBTtag * in the capability file some flag must be turned on to make it send the data to client side and that flag is missing * Capabiities has violently change whit 19.4 and as this is just copy paste from 19.2 code . i set the capability to the item this way and use a function to get the object and test it using a print function inside on entity swing the capability full item thanks for your time
-
[1.19.4] registering items missing class or property
perromercenary00 replied to perromercenary00's topic in Modder Support
hay thanks and all i alredy check it but i like an writed example stuck here coze dont know if is the tutorial not updated or its mi intellij that dont wana take those classes/attributes -
hay im trying to get mi code updated to 1.19.4 from 1.19.2 followen the tutorials from Kaupenjoe when trying to register the first item itellij dont finds the class or property "tab" the code must look like this public static final RegistryObject<Item> INGOT_STEEL = ITEMS.register("ingot_steel", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC) ) ); but Item.Properties() don't has a "tab" also CreativeModeTab don't has a "TAB_MISC" i know Kaupenjoe does this turorials some time ago whit and old version of the forge library and today im trying to reproduce whit today last version of "forge-1.19.4-45.0.59-mdk.zip" soo may the class objects names has change or may intellij imports the wrong classes import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; import net.perromercenario.mercblk.mercblk; ############################################# Can someone pinpoint mi error or even better bring me a link to an already working code so i just can look up ? thanks for your time
-
well them the second aproach i have this event code @SubscribeEvent public static void onCrafting(PlayerEvent.ItemCraftedEvent event) { ItemStack items = event.getCrafting(); Entity entity = event.getEntity(); Level warudo = entity.level; System.out.println("--------------" + ((warudo.isClientSide) ? " local world " : " server world ")); System.out.println("Crafted Description ID: " + items.getItem().getDescriptionId()); System.out.println("Count: " + items.getCount()); } everitime i craft something in the crafting table its print output -------------- local world Crafted Description ID: block.minecraft.birch_door Count: 3 -------------- server world Crafted Description ID: block.minecraft.birch_door Count: 3 its just only works for crafting table i need to find an equivalent for the cutting tabble
-
goods days im trying to cut a minecraft door in half using the cutting table and i want it to return the door pieces i alredy have the two parts of the block as individual block doors mercblk:birch_door_top_puerta, mercblk:birch_door_bottom_puerta i been experiment whit the recipes but no advances this don't woks buts the general idea { "type": "minecraft:stonecutting", "count": 1, "ingredient": { "item" : "minecraft:birch_door" }, "result" : ["mercblk:birch_door_top_puerta", "mercblk:birch_door_bottom_puerta"], "count" : 1 } the online recipe generators only has one output https://crafting.thedestruc7i0n.ca/ i think there must b a way could be an event triggering when using cutting table soo i can check if the output is mi "birch_door_top_puerta" then just drop the bottom part to player position or a function in the block class for when the item is crafted thank for your time
-
// ########## ########## ########## ########## @Override public InteractionResultHolder<ItemStack> use(Level warudo, Player pe, InteractionHand hand) { if(!warudo.isClientSide) { ListTag nbtpos = new ListTag(); BlockPos bpos = new BlockPos( 6,7,8 ); nbtpos.add(IntTag.valueOf( bpos.getX() )); nbtpos.add(IntTag.valueOf( bpos.getY() )); nbtpos.add(IntTag.valueOf( bpos.getZ() )); System.out.println("nbtpos=" + nbtpos.getInt(0) +", "+nbtpos.getInt(1) +", "+nbtpos.getInt(2) ); } return InteractionResultHolder.pass(pe.getItemInHand(hand)); } is a weird way to solved it looks more like kinda hacky google point me to this early this morning but cannat doo anything whit this one List<Value> coords = ((ListValue)value).getItems(); ListTag tag = new ListTag(); tag.add(DoubleTag.of(NumericValue.asNumber(lv.get(0), "x").getDouble())); tag.add(DoubleTag.of(NumericValue.asNumber(lv.get(1), "y").getDouble())); tag.add(DoubleTag.of(NumericValue.asNumber(lv.get(2), "z").getDouble())); ltag.add(tag); but the result is what iwas needing now my copyed extructures can be picked up by the vainilla structure block { "blocks" : list<TAG_Compound>[10] [ { "pos" : list<TAG_Int>[3] [ 1, 0, 1 ], "state": 0 }, { "pos" : list<TAG_Int>[3] [ 2, 0, 0 ], "state": 0 }, thanks i gonne write the resto of code later
-
hello good days i need to store block Positions as nbtdata in the same way minecrafts structure_block does save its capture structures that looks like this { "pos" : list<TAG_Int>[3] [ 0, 0, 2 ], <-- this looks like an array inside a listtag "state": 0 }, if a use the alredy avaliable method nbtpos = NbtUtils.writeBlockPos( bpos ); it end looking like this { "pos" : { "X": 1, "Y": 2, "Z": 1 }, <---- but the mine is an object whit keys in a regular tag "state": 1 }, Mi code nor the structure_block cannot read this values made a test item and put in some experimental code // ########## ########## ########## ########## @Override public InteractionResultHolder<ItemStack> use(Level warudo, Player pe, InteractionHand hand) { if(!warudo.isClientSide){ int [] apos = {0,0,0}; int index = 2; ListTag nbtpos = new ListTag(); BlockPos bpos = new BlockPos( 6,7,8 ); apos[0] = bpos.getX(); apos[1] = bpos.getY(); apos[2] = bpos.getZ(); //nbtpos.getIntArray(index); //<---- whats the opossite of this nbtpos.????( apos ); <-- the missing part where i store the data as positions inside the taglist System.out.println("nbtpos=" + nbtpos.getInt(0) +", "+nbtpos.getInt(1) +", "+nbtpos.getInt(2) ); //profit } return InteractionResultHolder.pass(pe.getItemInHand(hand)); } looks theres is a missing function for store an array in a taglist nbtpos.setIntArray(apos); nbtpos.putIntArray(apos); nbtpos.addIntArray(apos); or at least nbtpos.add( int justanIntvalue); ####################### soo how i doo to store int values directly in a listtag wey it end looking like minecraft does ?? { "pos" : list<TAG_Int>[3] [ 0, 0, 2 ], thanks for your attention