Jump to content

perromercenary00

Members
  • Posts

    849
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by perromercenary00

  1. good days i was updating to 1.20 and have this problem i need to check the material in blocks for many items and things but the class material exist no more Material pmat = tmpstate.getMaterial(); if ((pmat == Material.AIR) || (pmat == Material.PLANT) || (pmat == Material.LEAVES) || (pmat == Material.REPLACEABLE_PLANT)) { return false; } also the .getMaterial() method is gonne an without being market as deprecated so i dont find the replacement forums says //import net.minecraft.world.level.material.Material; that class dont exist on mi forge-1.20.2-48.0.49-mdk.zip i was thingking in using soundtype instead //import net.minecraft.world.level.block.SoundType but its a little uncosistent coze is designed for other thing and i would have to write custom functions everywhere just to check if a block like isMetal() could be SoundType.ANVIL SoundType.METAL SoundType.CHAIN and i hand an custome ladder ladder made of iron
  2. hola i have this pipe that faces not and has this propeties // ########## ########## ########## ########## public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; //public static final BooleanProperty NORTH = BlockStateProperties.NORTH; public static final BooleanProperty SOUTH = BlockStateProperties.SOUTH; public static final BooleanProperty EAST = BlockStateProperties.EAST; public static final BooleanProperty WEST = BlockStateProperties.WEST; public static final BooleanProperty UP = BlockStateProperties.UP; public static final BooleanProperty DOWN = BlockStateProperties.DOWN; the block consist of this two model rotated to fill the six directions a hollow face and a solid cover face the full ook must be like ########################### well i need to do an if else statement and no idea how to make the else part if(north=true){ apply hole_model } else { apply cover_model } { "multipart": [ { "when": { "north":"true" }, "apply": { "model" : "%MOD_ID%:block/parent/%TYPEFOLDER%/parent_tubo_norte_hole", "uvlock": true }, "when not??": { "north":"true" }, "apply": { "model" : "%MOD_ID%:block/parent/%TYPEFOLDER%/parent_tubo_norte_cover", "uvlock": true } } ] } thanks
  3. hola mi question is just like that im redoing mi blue herb on a pot digging minecraft code i could dig out this public void effectos(LivingEntity le){ Collection<MobEffectInstance> effects = le.getActiveEffects(); //Iterator<MobEffectInstance> iterator = effects.iterator(); for( MobEffectInstance effectinstance : effects ){ MobEffect mobeffect = effectinstance.getEffect(); System.out.println( "Efecto: " + mobeffect.getDisplayName() ); if (mobeffect == MobEffects.POISON)//mobeffect == MobEffects.REGENERATION || { le.removeEffect(mobeffect); } } } i find something but this object mobeffect i dont understand how it works like i know theres poison and poison II both return on terminal the same line of text Efecto: translation{key='effect.minecraft.poison', args=[]} //this is poison normal 3min Efecto: translation{key='effect.minecraft.poison', args=[]} //this is poison II // mi questions i wanna instantly remove poison 1 but on poison II i wanna downgrade it to poison 1 in the net.minecraft.world.effect.MobEffects tehres only a POISON entry so poison II must be some internal thing also i dont see how to access to the poison timers from here that i could work whit how ? thanks for your time
  4. well i finally find a way to preload a custome chest whit things from a loot table //st = block pos warudo.setBlock( st, maletin_init.BRIEFCASE_BLOCK.get().defaultBlockState(), 10 ); container_9_ghost ghost = (container_9_ghost)warudo.getBlockEntity(st); CompoundTag NBT = ghost.serializeNBT(); NBT.putString("LootTable", "minecraft:chests/spawn_bonus_chest"); ghost.load(NBT); i dont know how it internally works just realize minecraft:structure_block set a tag on the blockentity nbt and i just artificially set the tag, it works, call it a day ####################################################################### two questions spawning first of all how doo i spand this vanilla loot lists in /home/usuario/.minecraft/versions/Forge 1.20.1/Forge 1.20.1/data/minecraft/loot_tables/chests/ to add costume items, they looks more complicated than the forge tag lists the second one is can i use this loot tables to spawn frames whit loot on mi costume structures ?? item frames have potential they allow you to make the frame invisible and give the impression of things just dropped on tables and floors Direction facing = (blkstate.getValue(UP))? Direction.UP : ((blkstate.getValue(DOWN))? Direction.DOWN : blkstate.getValue(FACING)); ItemStack dropstack = new ItemStack(ItemInit.INGOT_STEEL.get(), 1); ItemFrame pframe = new ItemFrame(warudo, pos, facing); //pframe.setItem(dropstack);//seems diferent from the chest block entity pframe.setInvisible(true); warudo.addFreshEntity(pframe); CompoundTag NBT = pframe.serializeNBT(); NBT.putString("LootTable", "minecraft:chests/spawn_bonus_chest"); pframe.load(NBT); //this dont works the frame its always invisible but empty
  5. package done naa i find a working example and fix it in a the netowrk message package
  6. well good days form the bedblock class i extract code and made this public static void texto( Player pe, String mensaje){ //Style st = new Style(); pe.displayClientMessage(Component.translatable(mensaje), true); } only works on client side for reasons the plan is to extend this to make a network message to send text from the server side to client side and in the client side change text size and font color for that looks like the format is made using this class Style st = new Style(); i dont find example of this class usage to apply format to the text, the size and color thing thaks for your att
  7. i find the code piece but no idea on how to use it i made this custome block is basically a dead rotten body whit a tile entity for now im user hooppertile entity i get how to set some items to the bodies but it has no sense to write a whole loot system to load this things when alredy minecraft has this in the tileEntity code ### this is the one i have troubles whit ### public void setLootTable(ResourceLocation p_59627_, long p_59628_) { this.lootTable = p_59627_; this.lootTableSeed = p_59628_; } setloottable i supouse i have to pass the loot file as resource location minecraft/loot_tables/chests/village/village_plains_house.json ResourceLocation rl = new ResourceLocation(this.modname, "structures/" + structureName + ".nbt"); Optional<Resource> rs = this.resourceManager.getResource(rl); eee pues i dont have idea on how to declare tha file as a resource location i have to say more about the seed i see is a long value but any value is valid or tehre is some rules for it to work ?? ######################################### anyway i need a working example of HopperBlockEntity be = (HopperBlockEntity) blockentity; be.setLootTable(ResourceLocation , ); thanks for your time
  8. short ago i learn this way to get the main keys in the server side only if (!player.getLevel().isClientSide()) { Minecraft instance = Minecraft.getInstance(); KeyMapping keyUse = instance.options.keyUse; KeyMapping keyAta = instance.options.keyAttack; KeyMapping keyMid = instance.options.keyPickItem; //Player pe = instance.player; if( keyUse.isDown() ) { System.out.println("tick( Right use " + keyUse.getKey().getValue() + ");"); } if( keyAta.isDown() ) { System.out.println("tick( Left atack " + keyAta.getKey().getValue() + ");"); } if( keyMid.isDown() ) { System.out.println("tick( Middle pick " + keyMid.getKey().getValue() + ");"); } } if is custome keybinds you have to search youtube for kaupenjoe courses about keybinds and networking
  9. hellow i want mi custome block to catch fire as if it was some wood block not the kind of furnace fuel but the kind of catch fire whit flint and steel i sont get it it must be put in some of those json files ? or its a function flag that needs to be added to the block code ?
  10. the json part { "overrides": [ { "predicate": { "pulling": 0 }, "model": "merctool:item/carbon_shield_relaxed" }, { "predicate": { "pulling": 1 }, "model": "merctool:item/carbon_shield_blocking" } ] } or the Item properties thing //###### ###### ###### ###### ###### ###### public static void make_shield_shield(Item shield) { ItemProperties.register(shield, new ResourceLocation("pull"), (itemstack, warudo, le, p_174638_) -> { //ItemModelsProperties.register(item, new ResourceLocation("pull"), (itemstack, warudo, le) -> { if (le == null) { return 0.0F; } else { float pull = (float)((( itemstack.getUseDuration() - le.getUseItemRemainingTicks() ) % 5 ) / 5.0F); //System.out.println( " ticks = " + pull ); return (le.getUseItem() != itemstack )? 0.0F : pull; //(itemstack.getUseDuration() - le.getUseItemRemainingTicks()) / 20.0F; } }); ItemProperties.register(shield, new ResourceLocation("pulling"), (itemstack, warudo, le, p_174638_) -> { //ItemModelsProperties.register(item, new ResourceLocation("pulling"), (itemstack, warudo, le) -> { return (le != null && le.getUseItem() == itemstack) ? 1.0F : 0.0F; }); }
  11. 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; }
  12. 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
  13. 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()); } } } }
  14. 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
  15. 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)); }
  16. check the deltas Vec3 vm = pe.getDeltaMovement(); if( (vm.x + vm.y + vm.z) > 0 ){ //stuff }
  17. 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() ); } } }
  18. 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
  19. // ########## ########## ########## ########## ########## ########## 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; }
  20. 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
  21. 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
  22. sounds like regular block whit the grass plant model on it
  23. 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
  24. 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
  25. 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
×
×
  • Create New...

Important Information

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