Jump to content

perromercenary00

Members
  • Posts

    849
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by perromercenary00

  1. im retaking the work on the toilet block this toilet actually works but there's two issues that bother me the first one is visual coze the toilet takes the player entity and carry it trough the tunnel in standing position, the tunnel is just one block high and player eye position is at 1.8 soo it clips inside the block above and you cannot see where the water is taking you also that's kill the player by suffocation damage in long runs that is i need a coded way to force the player to crawl position and also a way to avoid getting suffocation damage thanks for your ideas .
  2. Good days Im working to make a way soo i can hold left click and behave like hold right click but doing an different action i find and old video form mi mod in 1.8 this is one of the things i would like to accomplish in this case the gun shoots by holding right click and the chainsaw works by holding left click minecraft ticks are a little unconstant sometimes there's lag and damage calculations soo to more or less precisely calculate how mutch time the player has hold and release the left click button i need two values int ontime = 0; int offtime = 0; this values only happens in the client side soo i need to send those values back to serverside i been following kapenhoe tutorials but he don't show how to actually serialize and send values im pretty sure thats done in this to methods public ExampleC2SPacket(FriendlyByteBuf buf) { } public void toBytes(FriendlyByteBuf buf) { } ################################### in this case i need to send values to an item capability soo if is possible to specifies the itemstack in the package it would be just perfect something like public ExampleC2SPacket(ItemStack mark) { FriendlyByteBuf buf = mark.getcapability.serializeallthevaluesinsidethecapability(); send_to_server(buf) } public void toBytes(FriendlyByteBuf buf) { Itemstack mark = itemsendedfromtheclientside; mark.getcapability.deserializethisvalues(buff); } this is the spefic tutorial i benn follow ########################################## well i need a guidance on how to send values using packages and also the itemstack if its possible thanks for your time
  3. i got this question coze i see that capabilitite values automatically from server side to client side but when i was making the briefcase i notice than inside the menu gui its update the capability values form the local side to the capability in the server side is inside the capability system a funcion to force an update adnd send the values from the clienside up overwrite the value sin the serverside of a capability ? and if it is how do i use it ?
  4. a frack MouseEvent is an event who could guess such a thing //########## ########## ########## ########## @SubscribeEvent public static void on_mouse_something(MouseButton event) { //Entity entity = event.; //Level warudo = event. //ItemStack itemstack = event.?; Minecraft mc = Minecraft.getInstance(); //Level warudo = mc.level;//it return null System.out.println("on_mouse_something [" + event.getButton() + "], " ); } on_mouse_something [0], on_mouse_something [0], on_mouse_something [0], on_mouse_something [0], on_mouse_something [1], on_mouse_something [1], on_mouse_something [1], on_mouse_something [1], on_mouse_something [2], on_mouse_something [2], on_mouse_something [2], on_mouse_something [2], on_mouse_something [3], on_mouse_something [3], on_mouse_something [3], ######## but is there a misssing string i need to get the player and itemstack his holding to know how to proced on left click
  5. i dont think that gonna work the name suggest it only works when click a block is like useOn()
  6. no that dont works allwais says 1 no mather what i press // ########## ########## ########## ########## @Override public void inventoryTick(ItemStack helditem, Level warudo, Entity entity, int slot, boolean p_41408_) { int pressed = java.awt.event.MouseEvent.BUTTON1; System.out.println("inventoryTick [" + slot + "], " + ((warudo.isClientSide)? "Local World":"Server World") + ", b1=" + pressed ); } inventoryTick [2], Local World, b1=1 inventoryTick [2], Server World, b1=1 inventoryTick [2], Local World, b1=1 inventoryTick [2], Server World, b1=1 inventoryTick [2], Local World, b1=1 inventoryTick [2], Server World, b1=1 inventoryTick [2], Local World, b1=1 inventoryTick [2], Local World, b1=1
  7. i found something old //import org.lwjgl.input.Mouse; int button_presed = Mouse.getButton(); but dont works in java 17 i fond something similar but dont get it to work //import java.awt.event.MouseEvent; MouseEvent.getButton() look like you must first create MouseEvent object to use it but dont find a working exaple could it be an minecraft event trigered on left click we could capture and use ?
  8. package merctool.item.stick; import org.jetbrains.annotations.Nullable; import merctool.item.ItemInit; import merctool.item.tool.item_c_provider; import merctool.item.tool.item_handler; import merctool.util.Postate; import merctool.util.Target; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.AbstractCauldronBlock; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.material.Material; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.ToolAction; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.capabilities.ICapabilityProvider; public class stick_lefclick extends Item { public static final DirectionProperty FACING = BlockStateProperties.FACING; // ########## ########## ########## ########## public stick_lefclick(Properties propiedad) { super(propiedad); // TODO Auto-generated constructor stub // ahora las propiedades se declaran en el client side dela clase pricipal // esto va a ser un arco por ahora } // ########## ########## ########## ########## @Nullable @Override public ICapabilityProvider initCapabilities(ItemStack csaw, @Nullable CompoundTag nbt) { return new item_c_provider(csaw); } // ########## ########## ########## ########## public static item_handler get_itemhandler(ItemStack csaw) { // item_handler ih = get_itemhandler(helditem); item_handler ih = ((item_handler) csaw.getCapability(ForgeCapabilities.ITEM_HANDLER) .orElseThrow(() -> new RuntimeException("O_O"))); return ih; } // ########## ########## ########## ########## @Override public InteractionResultHolder<ItemStack> use(Level warudo, Player pe, InteractionHand hand) { ItemStack itemstack = pe.getItemInHand(hand); Target target = new Target(warudo, pe, 10); Vec3 vh = target.calcular_vh(); if (vh != null) { BlockPos pos = new BlockPos(vh);// .x, vh.y ,vh.z System.out.println(((warudo.isClientSide) ? "local : " : "remote: ") + pos); Vec3i vo = new Vec3i(pos.getX(), pos.getY() + 1, pos.getZ()); particle(warudo, Vec3.atCenterOf(vo)); } return InteractionResultHolder.pass(pe.getItemInHand(hand)); } // ########## ########## ########## ########## @Override public boolean onEntitySwing(ItemStack helditem, LivingEntity le) { System.out.println("onEntitySwing"); Level warudo = le.level; if (!warudo.isClientSide) { item_handler ih = get_itemhandler(helditem); ih.start(5); } // ItemStack itemstack = le.getItemInHand(hand); Target target = new Target(warudo, le, 10); Vec3 vh = target.calcular_vh(); if (vh != null) { BlockPos pos = new BlockPos(vh);// .x, vh.y ,vh.z System.out.println(((warudo.isClientSide) ? "local : " : "remote: ") + vh); Vec3i vo = new Vec3i(pos.getX(), pos.getY() + 1, pos.getZ()); particle(warudo, Vec3.atCenterOf(vo)); } // le.startUsingItem(InteractionHand.MAIN_HAND); // le.stopUsingItem(); le.setItemInHand(InteractionHand.MAIN_HAND, helditem); // le.swing(InteractionHand.MAIN_HAND); return false; } // ########## ########## ########## ########## @Override public void inventoryTick(ItemStack helditem, Level warudo, Entity entity, int slot, boolean p_41408_) { System.out.println("inventoryTick " + slot); if (!warudo.isClientSide) { item_handler ih = get_itemhandler(helditem); if (ih.action == 5) { // hot do i check if the player entity is presing left click ????? // if is presing keep counting and call onUseTick // if its not stop and call releaseUsing } } } // ########## ########## ########## ########## @Override public InteractionResult useOn(UseOnContext p_41427_) { System.out.println("useOn"); return InteractionResult.PASS; } // ########## ########## ########## ########## @Override public boolean onLeftClickEntity(ItemStack stack, Player player, Entity entity) { System.out.println("onLeftClickEntity"); return false; } // ########## ########## ########## ########## @Override public boolean onEntityItemUpdate(ItemStack stack, ItemEntity entity) { // System.out.println("onEntityItemUpdate"); return false; } // ########## ########## ########## ########## @Override public boolean canPerformAction(ItemStack stack, ToolAction toolAction) { System.out.println("canPerformAction"); return false; } // ########## ########## ########## ########## public void particle(Level warudo, Vec3 vh) { warudo.addAlwaysVisibleParticle(ParticleTypes.FLAME, vh.x, vh.y, vh.z, 0.0D, 0.0D, 0.0D); warudo.addParticle(ParticleTypes.SMOKE, vh.x, vh.y, vh.z, 0.0D, 0.0D, 0.0D); // pe.playSound(SoundEvents.FIRE_EXTINGUISH, 1.0F, 1.0F); } // ########## ########## ########## ########## public static boolean if_is_wet_drop(Postate relative_postate) { boolean drop = false; if (relative_postate != null) { // relative_postate.print(); if (relative_postate.getMaterial() == Material.WATER) { drop = true; // System.out.println("\nWATER BLOCK "); relative_postate.setBlockState(Blocks.AIR.defaultBlockState()); } else if (relative_postate.is_WATERLOGGED()) { drop = true; // System.out.println("\nWATERlogged "); relative_postate.set_WATERLOGGED(false); } else if (relative_postate.getBlock() instanceof AbstractCauldronBlock) { int level = relative_postate.getBlockState().getValue(BlockStateProperties.LEVEL_CAULDRON); // System.out.println("\nCAULDRUM LEVEL = " + level); if (level > 0) { drop = true; level = level - 1; if (level < 1) { relative_postate.setBlockState(Blocks.CAULDRON.defaultBlockState()); } else { relative_postate.setBlockState( relative_postate.getBlockState().setValue(BlockStateProperties.LEVEL_CAULDRON, level)); } } } } if (drop == true) { // System.out.println("\nSAVING BLOCK AS "); // relative_postate.print(); relative_postate.setBlock(2); Level warudo = relative_postate.level(); Vec3 center = relative_postate.get_center(); ItemStack dropstack = new ItemStack(ItemInit.INGOT_STEEL.get(), 1); // itemstack.shrink(1); if (warudo.isClientSide) { // System.out.println("FLAME " + warudo.isClientSide); warudo.addParticle(ParticleTypes.FLAME, (center.x), (center.y + 0.5F), (center.z), 0.0D, 0.0D, 0.0D); // le.playSound(SoundEvents.FIRE_EXTINGUISH, 1.0F, 1.0F); } if (!warudo.isClientSide) { ItemEntity pdrop = new ItemEntity(warudo, (center.x), (center.y + 0.5F), (center.z), dropstack); warudo.addFreshEntity(pdrop); } } return drop; } // ########## ########## ########## ########## public static void drop(Level warudo, LivingEntity le, BlockPos pos, ItemStack itemstack) { if (warudo.isClientSide) { warudo.addParticle(ParticleTypes.FLAME, (double) (pos.getX() + 0.5F), (double) (pos.getY() + 1.0F), (double) (pos.getZ() + 0.5F), 0.0D, 0.0D, 0.0D); le.playSound(SoundEvents.FIRE_EXTINGUISH, 1.0F, 1.0F); } if (!warudo.isClientSide) { ItemEntity drop = new ItemEntity(warudo, (double) (pos.getX() + 0.5F), (double) (pos.getY() + 1.0F), (double) (pos.getZ() + 0.5F), itemstack); warudo.addFreshEntity(drop); } } // ########## ########## ########## ########## }
  9. yeah that something im also interested but will try to avoid packages and complex things let say make a capability whit some values like int action = 0; long start = 0L; in the item on swing make action to lets say 5 and start equal to actual time in milli seconds public boolean onEntitySwing(ItemStack helditem, LivingEntity le) { System.out.println("onEntitySwing"); item_handler ih = get_itemhandler(helditem); ih.start = System.currentTimeMillis(); ih.action = 5; then on inventoryTick check the action set // ########## ########## ########## ########## @Override public void inventoryTick(ItemStack helditem, Level warudo, Entity entity, int slot, boolean p_41408_) { System.out.println("inventoryTick " + slot); if (!warudo.isClientSide && slot < 9) { item_handler ih = get_itemhandler(helditem); if (ih.action == 5) { int tick = ih.get_tick(); // hot do i check if the player entity is presing left click ????? // if is presing keep counting and call onUseTick // if its not stop and call releaseUsing } } } ############################################# then i get stuck coze i dont know how from server side ask what mouse keis is the player presing Minecraft.getMouseEvent or pe.isShiftKeyDown() or something
  10. if theres is a work around to make the logic inside the capability it would make things easier i try puting and onload method and launchi it from i notice this methods ticks for a while afther you read the capability from the item and lives while the item is in the hotbar but if you put it on the inventory and close the menu it dies so is not is not reliable becoze it only ticks a few times and stop so is unfited to make a long count and do something after like finishing the drilling action and consume the fuel value saving the numbers back to item the other option would be to call the capability once and again from the itemstack in older version there was a onupdate() method that constantly tick even when you toss the item into the world i dot find it in 1.19.2 surely the name has change
  11. java.lang.NullPointerException: Cannot invoke "net.minecraft.client.renderer.entity.EntityRenderer.shouldRender(net.minecraft.world.entity.Entity, net.minecraft.client.renderer.culling.Frustum, double, double, double)" because "entityrenderer" is null i say its missing the part where you tell it what model renderer to use whit what entity
  12. i get this one from https://crafting.thedestruc7i0n.ca/ and works { "type" : "minecraft:crafting_shaped", "pattern" : [ "###", "#P#", "# #" ], "key" : { "#" : { "item" : "minecraft:redstone" }, "P" : { "item" : "minecraft:potion" } }, "result" : { "item" : "merctool:solution_redstone", "count" : 1 } } the only diference isee is the placeholder they use for the shape all the others is the same { "type" : "minecraft:crafting_shaped", "pattern" : [ "RRR", "RBR", "R R" ], "key" : { "R" : { "item" : "minecraft:redstone" }, "B" : { "item" : "minecraft:potion" } }, "result" : { "item" : "merctool:solution_redstone", "count" : 1 } } well dont mathers issue solved
  13. good days i trying to make a recipe requiring water bottle for what i understand water bottle is a just a potion withoug any efects but this recipe dont works portdata wheres the brewing_stand recipes ?
  14. oo that when i made the animations using the tick provided by onUseTick causes chopping animations when the game start skiping frames an sometimes the animation locks in a cicle and dont let the item continue whit is normal use then i just begin to store the statr time as epoch and calculate the frame from it and fix the problem
  15. hola when you make custom blocks if you want them to break whith a picaxe item you must declare block name inside the pickaxe file src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json but if you mispell a block name or add a non existing block or you forget the ".requiresCorrectToolForDrops()" thing at declaring just one of the blocks public static final RegistryObject<Block> TOILET_BLOCK_COBBLESTONE = registerBlock("toilet_block_cobblestone", () -> new toilet(Block.Properties.copy(Blocks.COBBLESTONE).requiresCorrectToolForDrops()) ); in any of this cases gonna damage the pickaxe behaveour for all the running mods soo be carefull whit that
  16. it makes sense coze your calculatin particule position using age as angle if you change (age / 20f) for (age / 40f) would take 2 full seconds to complete a round
  17. package merctool.item.tool; import java.util.ArrayList; import java.util.Collections; import java.util.Set; import javax.annotation.Nullable; import com.google.common.collect.Sets; import merctool.util.Postate; import merctool.util.Target; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.tags.FluidTags; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.RedStoneWireBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.material.Material; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.shapes.BooleanOp; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; //import net.minecraft.item.Item; //########## ########## ########## ########## public class merc_rs_wireblock extends RedStoneWireBlock { private static final float PARTICLE_DENSITY = 0.2F; // private final BlockState crossState; private boolean shouldSignal = true; public merc_rs_wireblock(Properties propiedades) { super(propiedades); } // ########## ########## ########## ########## ########## ########## ########## @Override public void neighborChanged(BlockState blkstate, Level warudo, BlockPos pos, Block blk, BlockPos pos2, boolean cosa) { if (!warudo.isClientSide) { if (blkstate.canSurvive(warudo, pos)) { //this.updatePowerStrength(warudo, pos, blkstate); } else { dropResources(blkstate, warudo, pos); warudo.removeBlock(pos, false); } } } // ########## ########## ########## ########## ########## ########## ########## // @Override public void updatePowerStrength(Level warudo, BlockPos pos, BlockState blkstate) { int i = this.calculateTargetStrength(warudo, pos); if (blkstate.getValue(POWER) != i) { if (warudo.getBlockState(pos) == blkstate) { warudo.setBlock(pos, blkstate.setValue(POWER, Integer.valueOf(i)), 2); } Set<BlockPos> set = Sets.newHashSet(); set.add(pos); for (Direction direction : Direction.values()) { set.add(pos.relative(direction)); } for (BlockPos blockpos : set) { warudo.updateNeighborsAt(blockpos, this); } } } // ########## ########## ########## ########## ########## ########## ########## // @Override public int calculateTargetStrength(Level warudo, BlockPos pos) { this.shouldSignal = false; int i = warudo.getBestNeighborSignal(pos); this.shouldSignal = true; int j = 0; if (i < 15) { for (Direction direction : Direction.Plane.HORIZONTAL) { BlockPos blockpos = pos.relative(direction); BlockState blockstate = warudo.getBlockState(blockpos); j = Math.max(j, this.getWireSignal(blockstate)); BlockPos blockpos1 = pos.above(); if (blockstate.isRedstoneConductor(warudo, blockpos) && !warudo.getBlockState(blockpos1).isRedstoneConductor(warudo, blockpos1)) { j = Math.max(j, this.getWireSignal(warudo.getBlockState(blockpos.above()))); } else if (!blockstate.isRedstoneConductor(warudo, blockpos)) { j = Math.max(j, this.getWireSignal(warudo.getBlockState(blockpos.below()))); } } } j = ( j > 0 )? 15 : 0; return Math.max(i, j);//j - 1 } // ########## ########## ########## ########## ########## ########## ########## // @Override private int getWireSignal(BlockState p_55649_) { return p_55649_.is(this) ? p_55649_.getValue(POWER) : 0; } // ########## ########## ########## ########## ########## ########## ########## // ########## // ########## ########## ########## ########## ########## ########## ########## // ########## // ########## ########## ########## ########## ########## ########## ########## // ########## // ########## ########## ########## ########## ########## ########## ########## // ########## }
  18. Good days im testing things to fix the problem whit the detonator for mi mod in this case i decide to make a custome redstone wire that dont update by itself soo it can keep the redstone power farter i just extend the RedStoneWireBlock an copy the json's manually fixing the routes to the assets public class merc_rs_wireblock extends RedStoneWireBlock {} the plan is when the detonators turn on it ramdomly replace vainilla RedStoneWireBlock for the merc_rs_wireblock and when the detonators turn off it search for the merc_rs_wireblock and turn them back to RedStoneWireBlock mi merc_rs_wireblock works it conect whit blocks and vainilla redstone normally and ignore neighborChanged() and just turn on/off externally -> but it is white -> it has the particules but dont shine when on as the vainilla redstone wire i been looking the jsons and notice the variable "tintindex" but dont find whats providing this value coze is not a block property i Have the theory than somewhere is a "ModItemModelProperties" class but for blocks an thats whats providing the tintindex value but dont find it ####################3 do you know what it is ??
  19. well yes but not quite short ago i have to made a capability extending itemhandler to make a custome drill and i need to recalculate the value of tick to calculate animation frame and fuel comsumtion but i cannot make it so i end quickitng an made just a public int get_tick() { if( this.tick > 0) { } else if( this.action > 0) { if( this.start > 0L ) { //System.out.println( "Calcular_tick()\n" ); this.tick = (int) ((System.currentTimeMillis() - this.start) / 50); // 50 this.tick = (this.tick > this.limit)? this.limit : this.tick; } } return this.tick; } so everytime the code ask for that variable it recalculate it coze idont find any ontick() or public void tick() that works inside the capability
  20. does a capabilities has an onTick() method
  21. make the sound 20 ticks long and made the block tick every 20 until power goes off // ########## ########## ########## ########## public boolean turn_on(Postate postate, Entity entity) { if (!postate.get_POWERED()) { Level warudo = postate.level(); BlockPos pos = postate.get_blockpos(); postate.set_POWERED(true); postate.update_WATERLOGGED(); postate.setBlock(2); this.updateNeighbours(postate.getBlockState(), warudo, pos); warudo.gameEvent(entity, true ? GameEvent.BLOCK_ACTIVATE : GameEvent.BLOCK_DEACTIVATE, pos); update_neighbours(warudo, pos, true); //cause the block to tick in 20 postate.level().scheduleTick(pos, this, 20); } return false; } // ########## ########## ########## ########## public void tick(BlockState blkstate, ServerLevel serverlevel, BlockPos pos, RandomSource random) { update_neighbours((Level) serverlevel, pos, false); serverlevel.gameEvent((Entity) null, GameEvent.BLOCK_DEACTIVATE, pos); serverlevel.playSound((Player) null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.CROSSBOW_LOADING_END, SoundSource.PLAYERS, 1.0F, 1.0F); if (blkstate.getValue(POWERED)) { serverlevel.setBlock(pos, blkstate.setValue(POWERED, Boolean.valueOf(false)), 3); // this.updateNeighbours(blkstate, serverlevel, pos); // this.playSound((Player)null, serverlevel, pos, false); } }
  22. hola this code reads all the loaded blocks in the game and stores it to a hash map public static Map<String, BlockState> blocklist = new HashMap<String, BlockState>();// list whit all blocks 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(); }
  23. i got this trouble Vec3 works whit real numbers but block has this minusZero hurting mi calculations i need to calculate if an entity inside the block is close to the center on the block but block gets me BlockPos and entity gives me a vec3 when i converty i t by self it works excep if the entity is not on the block -0 causing the calculate value to move towars +0 anyway is there alredy in minecraft a function to return a BlockPos passing a Vec3 habing in count this MinusZero thing ??
  24. hay i made a custome lever block mi detonator block is kinda of tnt activator to work whit a custome explosive that still in wip state but the lever part must be finish first mi lever just extends the minecraft lever class public class detonador extends LeverBlock and works but only whit a reach like 15 blocks and the bloks like piston and lanterns just get stuck in POWERED state dont return to off to try to solve that issue an also make it reach longer i made code to detect all the RedStoneWireBlock in direct contact whit mi detonator block return the blocks as a list of postate objects then manually set the power level to 15 and it works i set like 80 blocks of redstone around the room an all of then turn ligh on but it dont activate neither redstone lamps nor pistons i been diging in the classes i find this two things but are not givin the expected result level.updateNeighbourForOutputSignal(cursor.get_blockpos(), cursor.getBlock() ); level.updateNeighborsAt(cursor.get_blockpos(), cursor.getBlock()); i suspect i must execute some other update method inside level class or maybe is an event that must be casted over the restone wire position in the level to make it trigger blocks the full class is this the Postate class is a tool class i use to facilitate change values on BlockStates and write them again to the Level well the idea is detect a RedStoneWireBlock an artifiacilly turn it on and make the surronding blocks react to this may the RedStoneWireBlock has an inner system to update its state based on a paralel data system as whit the watter fluids thanks for your time
  25. lets try again the drill has two animations and to play this two animations i beign using the same technich used to animate the bow or the shield now this json works whit a property called "pull" and i have to declare it to the drill item and pass the values from the item handler capability to this ItemModelProperties notive than to determine what animation gonna be played i use the variable called "action" from the capability ######################### then it comes the problem the code i have to read from the itemcpability is an enclosed arrow function this is not a problem if just need to read or change some value then return but becoze ItemModelProperties is also an arrow function it dont letme just return the calculate value //register the pull property ItemProperties() action => 1, 0 ItemProperties() action => 1, 1 ItemProperties() action => 1, 2 ItemProperties() action => 1, 3 ItemProperties() action => 1, 4 ItemProperties() action => 1, 5 soo i need to pull out the capability not as an arrow but as normal class/object soo i can just return the tick value thats the problem i currently have @NotNull LazyOptional<IItemHandler> handler00 = itemstack.getCapability(ForgeCapabilities.ITEM_HANDLER); //item_handler ih = (item_handler) handler00;//Cannot cast from LazyOptional<IItemHandler> to item_handler if (handler00 instanceof item_handler) { item_handler ih = (item_handler) handler00; //how i do cast from lazyoptional to mi capability class ???? }
×
×
  • Create New...

Important Information

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