Jump to content

perromercenary00

Members
  • Posts

    631
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Recent Profile Visitors

21615 profile views

perromercenary00's Achievements

Dragon Slayer

Dragon Slayer (6/8)

3

Reputation

  1. this block is a common block its weird how it dont work if i just put the code on public BlockState getStateForPlacement(BlockPlaceContext context) {} thats why i think there exist some pseudo Levels only having access to reduced part of database soo i was using the tick the button and the presure plate use to reset to normal thats how i manage to set the ladder blocks and retrieve them ########################### from the minecraft terrain generation i dont think its gonna fit mi desires is like a mi thing i want the main area round, circular and i want the area leveled using slabs so the max inclination goes to like 22.5 degrees way the village looks always different based on the previous terrain characteristics sorry i dont speak english so mi gramatical thing is wrong i need to fix the grass slab color thing is weird how it looks when the grass has two diferent colors ############################ anyway let say i change from a common block to an TileEntity block and make it detonate at 10 ticks of existing the extructure its 25chunks big #################################################################################################### soo i need way to check if those chuncks alredy exist and if not i need to force minecraft to generate those chunks can you help me whit those two things
  2. using the tall towers example i wanna spawn a complex villages like old version 1.8 the plan until now consist on making a especial block to do all the job following the steps * fix and level up the land to remove the stepped parts and pitfalls * spawn village fence in the borders * spawn the sewer tunnels * spawn the gravel / compacted grass paths * houses * villagers / animals and spawn that block in the world using the datapacks system this is what i have the data packs works and spawn the block in the world but the blocks dont pops up at this point only has the code to level up the terrain ###### the trouble seem like data packs put blocks in the world without triggering the internal block i try this tree things but nothing triggers // ########## ########## ########## ########## public void tick(BlockState blkstate, ServerLevel warudo, BlockPos blkpos, RandomSource randomsource) { System.out.println("\n\ntick()\n\n"); warudo.setBlock(blkpos, Blocks.AIR.defaultBlockState(), 10); AreaCircular ac = new AreaCircular(warudo); ac.setRadio(32.0F); ac.aplanar_area_circular(blkpos); ac.bm.setBlocks(); } @Override public void setPlacedBy(Level warudo, BlockPos blkpos, BlockState p_49849_, @Nullable LivingEntity p_49850_, ItemStack p_49851_) { System.out.println("\n\nsetPlacedBy()\n\n"); warudo.setBlock(blkpos, Blocks.AIR.defaultBlockState(), 10); AreaCircular ac = new AreaCircular(warudo); ac.setRadio(32.0F); ac.aplanar_area_circular(blkpos); ac.bm.setBlocks(); } @Override public void onPlace(BlockState p_60566_, Level warudo, BlockPos blkpos, BlockState p_60569_, boolean p_60570_) { System.out.println("\n\nonPlace()\n\n"); warudo.setBlock(blkpos, Blocks.AIR.defaultBlockState(), 10); AreaCircular ac = new AreaCircular(warudo); ac.setRadio(32.0F); ac.aplanar_area_circular(blkpos); ac.bm.setBlocks(); } ##### may the block spawn process in a pseudo level of something i dont know i need way to trigger the block on spawn and launch ac.aplanar_area_circular(blkpos); to start the process thanks for your time
  3. yaa thats what i was looking for i change the code to work mi style i find than for some reason the vainilla BlockState.rotate() method dont works for mi custome blocks but just work around it package basemmod.util; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Optional; import java.util.Set; import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtIo; import net.minecraft.nbt.NbtUtils; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.util.StringRepresentable; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; public class NbtStructure { public LevelAccessor warudo = null; public LevelAccessor getWarudo() { return warudo; } public void setWarudo(LevelAccessor warudo) { this.warudo = warudo; } public String modname = "basemmod"; public String structureName = ""; public Rotation rot = Rotation.NONE; private int ci_x = 0; private int ci_y = 0; private int ci_z = 0; // ########## ########## ########## ########## ########## ########## // BlockMap part // ########## ########## ########## ########## ########## ########## // X Z Y private Map<Integer, Map<Integer, Map<Integer, BlockState>>> map = new HashMap<Integer, Map<Integer, Map<Integer, BlockState>>>(); // Z Y private Map<Integer, Map<Integer, BlockState>> X = new HashMap<Integer, Map<Integer, BlockState>>(); // Y private Map<Integer, BlockState> Z = new HashMap<Integer, BlockState>(); public Set<BlockPos> block_list = new HashSet<BlockPos>(); private BlockState blkstate = null; private BlockPos blkpos = null; private ResourceManager resourceManager = null; // ########## ########## ########## ########## // sets the blockstate for this blockpos in the blockmap public boolean setBlockState(BlockPos pos, BlockState value) { return setBlockState(pos.getX(), pos.getY(), pos.getZ(), value); } public boolean setBlockState(int bx, int by, int bz, BlockState value) { X = map.get(bx); if (X == null) { X = new HashMap<Integer, Map<Integer, BlockState>>(); map.put(bx, X); } if (X != null) { Z = X.get(bz); if (Z == null) { Z = new HashMap<Integer, BlockState>(); X.put(bz, Z); } if (Z != null) { Z.put(by, value); this.block_list.add(new BlockPos(bx, by, bz)); return true; } } return false; } // ########## ########## ########## ########## // return the blockstate for this blockpos from the blockmap public BlockState getBlockState(BlockPos pos) { BlockState blkstate = getBlockState(pos.getX(), pos.getY(), pos.getZ()); return blkstate; } public BlockState getBlockState(int bx, int by, int bz) { BlockState blkstate = null; X = map.get(bx); if (X != null) { Z = X.get(bz); if (X != null) { blkstate = Z.get(by); } } return blkstate; } public void print() { int count = 0; for (BlockPos cursor : block_list) { System.out.print("\n" + count + ") "); System.out.print(cursor.getX() + ", "); System.out.print(cursor.getY() + ", "); System.out.print(cursor.getZ() + " : "); System.out.print(get_blkfullname(this.getBlockState(cursor)) + "\n"); count++; } } // ########## ########## ########## ########## ########## ########## // main constructor // NBT part // ########## ########## ########## ########## ########## ########## public NbtStructure(Level warudo, String structureName) { this.warudo = warudo; this.getResourceManager(); this.structureName = structureName; getBuildingBlocks(this.structureName); this.print(); } public NbtStructure(Level warudo, String structureName, BlockPos cornerstone, Rotation rot) { this.warudo = warudo; this.getResourceManager(); this.ci_x = cornerstone.getX(); this.ci_y = cornerstone.getY(); this.ci_z = cornerstone.getZ(); this.rot = rot; this.structureName = structureName; getBuildingBlocks(this.structureName); this.print(); } public NbtStructure(Level warudo, String structureName, BlockPos cornerstone, Direction facing) { switch (facing) { default: case UP: case DOWN: case SOUTH: this.rot = Rotation.NONE; break; case NORTH: this.rot = Rotation.CLOCKWISE_180; break; case EAST: this.rot = Rotation.COUNTERCLOCKWISE_90; break; case WEST: this.rot = Rotation.CLOCKWISE_90; break; } this.warudo = warudo; this.getResourceManager(); this.ci_x = cornerstone.getX(); this.ci_y = cornerstone.getY(); this.ci_z = cornerstone.getZ(); this.structureName = structureName; getBuildingBlocks(this.structureName); this.print(); } // ########## ########## ########## ########## ########## ########## public ResourceManager getResourceManager() { if (resourceManager == null) if (this.warudo.isClientSide()) this.resourceManager = Minecraft.getInstance().getResourceManager(); else this.resourceManager = this.warudo.getServer().getResourceManager(); return resourceManager; } // ########## ########## ########## ########## ########## ########## // load blocks from nbt.file to the blockmap // ########## ########## ########## ########## ########## ########## public void getBuildingBlocks(String structureName) { CompoundTag nbt = getBuildingNbt(structureName); if (nbt == null) { System.out.println(" Structure not find "); return; } // load in blocks (list of blockPos and their palette index) ListTag blocksNbt = nbt.getList("blocks", 10); ArrayList<BlockState> palette = getBuildingPalette(nbt); for (int i = 0; i < blocksNbt.size(); i++) { CompoundTag blockNbt = blocksNbt.getCompound(i); ListTag blockPosNbt = blockNbt.getList("pos", 3); blkstate = palette.get(blockNbt.getInt("state")); blkpos = new BlockPos(blockPosNbt.getInt(0), blockPosNbt.getInt(1), blockPosNbt.getInt(2)); // rotate blkstate = rotate_blockstate(blkstate, this.rot); blkpos = rotate_blockpos(blkpos, this.rot); // fit to corner stone block blkpos = (new BlockPos((blkpos.getX() + this.ci_x), (blkpos.getY() + this.ci_y), (blkpos.getZ() + this.ci_z))); // save to the hash map this.setBlockState(blkpos, palette.get(blockNbt.getInt("state"))); block_list.add(blkpos); // warudo.setBlock(blkpos, blkstate, 10); } } // ########## ########## ########## ########## ########## ########## // writte the blocks to the world // ########## ########## ########## ########## ########## ########## public void setBlocks() { BlockState cursorstate = null; FluidState fluidstate = null; boolean waterlogged = false; for (BlockPos cursor : this.block_list) { cursorstate = this.getBlockState(cursor); waterlogged = false; // especial blocks and stuff if (cursorstate.hasProperty(BlockStateProperties.WATERLOGGED)) { waterlogged = cursorstate.getValue(BlockStateProperties.WATERLOGGED); if (!waterlogged) { fluidstate = this.warudo.getFluidState(cursor); if (fluidstate.getType() == Fluids.WATER) { cursorstate = cursorstate.setValue(BlockStateProperties.WATERLOGGED, true); } } } this.warudo.setBlock(cursor, cursorstate, 10); } } // ########## ########## ########## ########## ########## ########## // ########## ########## ########## ########## ########## ########## public CompoundTag getBuildingNbt(String structureName) { try { ResourceLocation rl = new ResourceLocation(this.modname, "structures/" + structureName + ".nbt"); Optional<Resource> rs = this.resourceManager.getResource(rl); return NbtIo.readCompressed(rs.get().open()); } catch (Exception e) { // System.out.println(e); return null; } } // ########## ########## ########## ########## ########## ########## public ArrayList<BlockState> getBuildingPalette(CompoundTag nbt) { ArrayList<BlockState> palette = new ArrayList<>(); // load in palette (list of unique blockstates) ListTag paletteNbt = nbt.getList("palette", 10); for (int i = 0; i < paletteNbt.size(); i++) palette.add(NbtUtils.readBlockState(paletteNbt.getCompound(i))); return palette; } // ########## ########## ########## ########## public BlockState rotate_blockstate(BlockState blkstate, Rotation rot) { // Direccion Direction facing = null; if (blkstate.hasProperty(BlockStateProperties.FACING)) { facing = blkstate.getValue(BlockStateProperties.FACING); } if (blkstate.hasProperty(BlockStateProperties.HORIZONTAL_FACING)) { facing = blkstate.getValue(BlockStateProperties.HORIZONTAL_FACING); } Direction.Axis axix = null; if (blkstate.hasProperty(BlockStateProperties.AXIS)) { axix = blkstate.getValue(BlockStateProperties.AXIS); } if (blkstate.hasProperty(BlockStateProperties.HORIZONTAL_AXIS)) { axix = blkstate.getValue(BlockStateProperties.HORIZONTAL_AXIS); } if (facing != null && facing != Direction.UP && facing != Direction.DOWN) { switch (rot) { default: NONE: // du nothing break; case CLOCKWISE_180: facing = facing.getOpposite(); break; case CLOCKWISE_90: facing = facing.getClockWise(); break; case COUNTERCLOCKWISE_90: facing = facing.getCounterClockWise(); break; } if (blkstate.hasProperty(BlockStateProperties.FACING)) { blkstate = blkstate.setValue(BlockStateProperties.FACING, facing); } if (blkstate.hasProperty(BlockStateProperties.HORIZONTAL_FACING)) { blkstate = blkstate.setValue(BlockStateProperties.HORIZONTAL_FACING, facing); } } // axis // Direction.Axis.valueOf(value.toUpperCase()) if (axix != null) { switch (axix) { default: case Y: // du nuthing break; case X: axix = Direction.Axis.Z; break; case Z: axix = Direction.Axis.X; break; } if (blkstate.hasProperty(BlockStateProperties.AXIS)) { blkstate = blkstate.setValue(BlockStateProperties.AXIS, axix); } if (blkstate.hasProperty(BlockStateProperties.HORIZONTAL_AXIS)) { blkstate = blkstate.setValue(BlockStateProperties.HORIZONTAL_AXIS, axix); } } // this thing dont works on mod made blocks if (axix == null && facing == null) { blkstate.rotate(rot); } return blkstate; } // ########## ########## ########## ########## public BlockPos rotate_blockpos(BlockPos cursor, Rotation rot) { switch (rot) { default: // case NORTH: // du nuthing break; case CLOCKWISE_90: cursor = new BlockPos(cursor.getZ() * -1, cursor.getY(), cursor.getX()); break; case CLOCKWISE_180: cursor = new BlockPos(cursor.getX() * -1, cursor.getY(), cursor.getZ() * -1); break; case COUNTERCLOCKWISE_90: cursor = new BlockPos(cursor.getZ(), cursor.getY(), cursor.getX() * -1); break; } return cursor; } // ########## ########## ########## ########## ########## ########## // ########## ########## ########## ########## ########## ########## // public static String get_blkfullname(BlockState blkstate) { if (blkstate == null) { return "NULL"; } String nnn = "" + blkstate.getBlock().getName().getString().toLowerCase(); return fix_blkfullname(nnn); } // ########## ########## ########## ########## ########## ########## // public static String fix_blkfullname(String blkfullname) { if (blkfullname.contains(".")) { String[] split1 = blkfullname.split("\\."); // "\\." if (split1.length > 1) { blkfullname = split1[split1.length - 1].replaceAll("_", " "); } } return blkfullname.toLowerCase(); } // ########## ########## ########## ########## // ########## ########## ########## ########## public static BlockPos chunk_northwest_corner(Level warudo, BlockPos pos) { BlockPos min = null; int subx = 0; int subz = 0; int abs = 0; int factox = 0; int factoz = 0; // si el valor es negativo if (pos.getX() < 0) { abs = Math.abs(pos.getX()); factox = (abs / 16); factox = ((abs % 16) > 0) ? factox + 1 : factox; subx = -16 * factox; } else { subx = pos.getX() - (pos.getX() % 16); } // si el valor es negativo if (pos.getZ() < 0) { abs = Math.abs(pos.getZ()); factoz = (abs / 16); factoz = ((abs % 16) > 0) ? factoz + 1 : factoz; subz = -16 * factoz; } else { subz = pos.getZ() - (pos.getZ() % 16); } min = new BlockPos(subx, pos.getY(), subz); return min; } // ########## ########## ########## ########## ########## ########## // ########## ########## ########## ########## ########## ########## // ########## ########## ########## ########## ########## ########## // ########## ########## ########## ########## ########## ########## } // ########## ########## ########## ########## @Override public InteractionResultHolder<ItemStack> use(Level warudo, Player pe, InteractionHand hand) { Target target = new Target(warudo, pe, 20); //spanw full chunk structure aligned whit borders if(!warudo.isClientSide) { Postate postate = target.get_postate(); //Direction facing = pe.getDirection(); BlockPos min = NbtStructure.chunk_northwest_corner( warudo, postate.get_blockpos() ); NbtStructure structure = new NbtStructure(warudo, "empty_chumk", min, Direction.SOUTH ); structure.setBlocks(); //write the bocks } return InteractionResultHolder.pass(pe.getItemInHand(hand)); }
  4. hay good nights i made an structure and save it to nbt using the minecraft:StructureBlock the idea basically is a sewer i have to made all the sections and later joint them in the level i wanna to create a wand to spawn this same structure on right click and i need to apply the offset soo the sewer section spawn buried underground i put the nbt file in /src/main/resources/data/basemmod/structures/tunel_i.nbt but i dont know how to call it from code to make it spanw in the world i need something like // ########## ########## ########## ########## @Override public InteractionResultHolder<ItemStack> use(Level warudo, Player pe, InteractionHand hand) { System.out.println("use( Spawn Structure at target Block using Player.getDirection() to define rotation );"); Target target = new Target(warudo, pe, 20); Vec3 vh = target.getVh();// util.calcularVectores(pe, 10 , 0.0F );// System.out.println("use();" + warudo.isClientSide ); if(!warudo.isClientSide) { IdontKnowWhatClass idkn = IdontKnowWhatClass.loadStructure("basemmod:tunel_i"); idkn.setPosition( target.getBlockPos() ); idkn.setOffset( -2, - 6, 0 ); idkn.spanwStructure(); } return InteractionResultHolder.pass(pe.getItemInHand(hand)); } thanks for your attention
  5. ?? java models shield is an entity but you can just put an normal item model and left the entity translucent thats wat im doing
  6. Im trying to make an costume shield model the thing is i want it to have a curved form and round corners as this one im using blockbench for this and is i made the shield side whit round borders and try to rotate 22.5 in Y its fucks up the corner blocks iT like a cube cannot have more than one rotation aniway i been seen mods whit nice modeled items what are they using
  7. how to fix fml.modloading.dupedmod

  8. ya i found it mi base class was lacking client side @Mod.EventBusSubscriber(modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public static class ClientModEvents { @SubscribeEvent public static void onClientSetup(FMLClientSetupEvent event) { ModItemModelProperties.make_shield_shield( ItemInit.CARBON_SHIELD.get() ); } } now i have some issues whit the model position and textures
  9. forgive the clumsines also i dont speak the languague i could'n figure out by miself how to make a item to change the model based on the state im making a custome shield just extending the vainilla shield it works blocks arrows and all now i want the shield to have 2 states two jsons one for when relaxed and the other json model for when shielding those two models individually works as the videos prove know the troubles come here becoze from this point i dont understand a thing first of all the two models are named "basemmod:item/carbon_shield_relaxed" "basemmod:item/carbon_shield_blocking" then im using the itembow as a base soo i let the shield whit same properties as the bow ############ first problem based on answer from previous post i made a custome ModItemModelProperties class but i dont have the lesser idea of how to apply this to the shield item public class ModItemModelProperties { //###### ###### ###### ###### ###### ###### 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; }); } } where this class must gooo and how i declare it to works whith the shield ???? i made the parent json this way but donts work the shield is invisible i think is coze the missing step from the ModelProperties class before may it has also some errors i dont know yet { "overrides": [ { "predicate": { "pulling": 0 }, "model": "basemmod:item/carbon_shield_relaxed" }, { "predicate": { "pulling": 1, "pull": 0.1 }, "model": "basemmod:item/carbon_shield_blocking" } ] } the shield item is invisible carbon_shield_blocking ########## ########## ########## ########## may the question be wrong formulated soo sorry before hand basically i want this shield to apply one of two json models based on if the item is in use
  10. ja thanks thats what i need @Override public InteractionResult use(BlockState blkstate, Level warudo, BlockPos pos, Player pe, InteractionHand hand, BlockHitResult hit) { ItemStack itemstack = pe.getItemInHand(hand); if (!warudo.isClientSide) { System.out.println("\n\n use("+ itemstack.getDisplayName().getString() +")\n\n"); if( itemstack.getItem() == BlockInit.OAK_STEEP_LADDER.get().asItem() ) { System.out.println("\n use(Es una escalera )\n"); } if( itemstack.getItem() == Blocks.AIR.defaultBlockState().getBlock().asItem() ) { System.out.println("\n use(Es AIRE )\n"); } } an empty hand returns a block of air thats weird but it works
  11. hi good days i made this custom mesh i made for a chicken farm @Override public void fallOn(Level warudo, BlockState blkstate_, BlockPos pos_, Entity en, float p_152430_) { en.causeFallDamage(p_152430_, 1.0F, DamageSource.FALL); System.out.println( "Fall On " + warudo + " ·>" + en.getName().getString() ); } the other thing i try was to catch the event but dont know whats the event and on_toss(ItemTossEvent event) only works when player drops something whit Q
  12. hi i have this block is a custome ladder block (BlockInit.OAK_STEEP_LADDER) and i need to know if player is right clicking the ladder whit another ladder of the same kind or the hand is empty the think is i have the reference to mi custome block as a block from mi blockInit class the thing i get from the hand is an item instance i cannot compare blocks to items how i get the itemblock from the block instance? and by the way i also need to know if the hand is empty to return the block as an item to user hand // ########## ########## ########## ########## // Onright click @Override public InteractionResult use(BlockState blkstate, Level warudo, BlockPos pos, Player pe, InteractionHand hand, BlockHitResult hit) { ItemStack itemstack = pe.getItemInHand(hand); if (!warudo.isClientSide) { System.out.println("\n\n use("+ itemstack.getDisplayName().getString() +")\n\n"); if( itemstack.getItem() == BlockInit.OAK_STEEP_LADDER.get??? ) { //do things } } return InteractionResult.sidedSuccess(warudo.isClientSide); // } thank for our attention
  13. i do something similar and is complicated public static Map<String, BlockState> blocklist = new HashMap<String, BlockState>();// list whit all blocks Block actualBlock = null; String type = ""; String nnn = ""; int count = 0; //load hashmap whit all blocks and fix their names for (Entry<ResourceKey<Block>, Block> ResourceKey : ForgeRegistries.BLOCKS.getEntries()) { actualBlock = ResourceKey.getValue(); nnn = fix_blkfullname(actualBlock.getName().getString()); blocklist.put(nnn, actualBlock.defaultBlockState()); if (nnn.contains("slab")) { slablist.put(nnn, ""); } count++; } // ########## ########## ########## ########## ########## ########## // public static String fix_blkfullname(String blkfullname) { if (blkfullname.contains(".")) { String[] split1 = blkfullname.split("\\."); // "\\." if (split1.length > 1) { blkfullname = split1[split1.length - 1].replaceAll("_", " "); } } return blkfullname.toLowerCase(); } is up to you to use the if (nnn.contains("slab")) { slablist.put(nnn, ""); } to find all tha planks and logs in the list and sort them as it suits you
  14. reformulating the question i need to make a droop_table.json for the custome block that drops different items on break based on the block properties value as the slab droop_table that drops 1 or 2 items depending on the type property from the block
  15. i wanna test what i have done alongside whith other mods like mrcraifish furniture twilith forest biomas you go etc ect all have i tested crash eclipse i drop the mod jars on workspace/mod-1.19.2-43.1.3/run/mods i have eclipse 2022-06 whit java JDK17 has someone know what its this happening i think that works well on old 1.8
×
×
  • Create New...

Important Information

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