Jump to content

destroy a block in the world(xyz) droping what it drops <SOLVED>


perromercenary00

Recommended Posts

goood days

 

i know this looks noob question but i get stuck here

 

i wanna break some blocks wuith a custom item, but idont realize how to declare this

 

weel i been doing some research and fin this

 

world.destroyBlock(x,y,z, true); but not work in 1.710

 

in some forum they say thath deprecated but there is still a

 

world.func_147480_a(x, y,z, true);  but still not work

 

and inthe world class i found

 

world.destroyBlockInWorldPartially(int,int,int,int,int);  but i dont get how to use this and the examples well the re is no examples. and donot know the order of the int's is not clear 

i been triying

 

Block blck = world.getBlock(x, y, z);

int idblock=Block.getIdFromBlock(blck);

int idplayer=p_77659_3_.getEntityId();

 

 

world.destroyBlockInWorldPartially(idplayer,x,y,z,-1); not work

world.destroyBlockInWorldPartially(idblock,x,y,z,-1); not work

 

 

ñaaaaaaaaa

 

 

sooo howdo you do to destroy a block in the given coordinates xyz  droping what its drops.??

 

 

 

 

 

Link to comment
Share on other sites

Block blck = world.getBlock(x, y, z);

blck.dropBlockAsItem(...);

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

jejejeje

is half way

but i must question again

 

public ItemStack onItemRightClick(ItemStack p_77659_1_, World world, EntityPlayer p_77659_3_){

int[] coordenadas = util.coordenadaDeBlockeEnFoco(world, 10);

Block blck = world.getBlock(coordenadas[0],coordenadas[1],coordenadas[2]);

blck.dropBlockAsItem(world, coordenadas[0],coordenadas[1],coordenadas[2], 0, 0);

}

 

thismake the block drop but dont destroy the block, is bad declarated or

is mandatory to set the block to air whith

world.setBlock(x,y,z, Block.air);

 

???

Link to comment
Share on other sites

It works, but I'd suggest calling

blck.removedByPlayer(...) instead.  removedByPlayer lets the block destroy itself, as well as call any ancillary functions that it might have that happens when the block is destroyed (I'm actually working on a mod right now that overrides this function).

 

I'd also suggest inserting a call to blck.onBlockDestroyedByPlayer(...) somewhere as well (before the call to removedByPlayer or setBlockToAir).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Wait, what do you mean by

 

"world.func_147480_a(x, y,z, true);  but still not work "

 

I've used that code many times in 1.7.10, so I don't know how it isn't working. Please explain.

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
Link to comment
Share on other sites

Are you sure your coordinates are correct?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

i been cleaning up mi code and converting the arrays[]  to ArrayList<Integer>  and

just figure out what happened but

 

the problem is that when i hold the rigthclick it sends like tenthousand orders to break this specific block soo after testing it whit the ArrayList system

world.func_147480_a(x,y,z, true); works breaking the block and droping in just one step

 

blck.dropBlockAsItem(world, x,y,z, 0, 0); works make the block drops whitout destroy and

 

world.setBlock(x,y,z, Blocks.air); delete the block as well

 

 

but i see this before in others mods

the blocks are destroy and drops item but still there, if try to jump in the hole i get stuck,  and if i close the game and reload the world the blocks come back like nothing happend

 

?is nesesary to cast some kind of sorcery to get the world to save the change in the chunks ¿

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

ñaaa

 

//codigo

 

public static void romper(World world,List<Integer> lis){

System.out.println("####  romper");

 

int llist=lis.size(); //longitud de la lista

System.out.println("####  llist="+llist);

 

for (int conteo=0; conteo < llist;conteo=conteo+3){

int x=lis.get(conteo),y=lis.get(conteo+1),z=lis.get(conteo+2);

 

//Block blck = world.getBlock(x,y,z);

//blck.dropBlockAsItem(world, x,y,z, 1, 1);

//world.setBlock(x,y,z, Blocks.air);

 

world.func_147480_a(x,y,z, true);

 

//#######  aqui esta la flag \/ \/ \/

if (world.isRemote){ System.out.println("####  world.isRemote=true ");}

else                      { System.out.println("####  world.isRemote=false");}

//#######  aqui esta la flag /\ /\ /\

 

 

System.out.println("####  x="+x+" y="+y+" z="+z);

System.out.println("####  conteo="+conteo);

}

}

 

//codigo

 

 

####  romper

[12:43:28] [Client thread/INFO] [sTDOUT]:  ####  llist=12

[12:43:28] [Client thread/INFO] [sTDOUT]:  ####  world.isRemote=true

[12:43:28] [Client thread/INFO] [sTDOUT]:  ####  x=221 y=77 z=342

 

 

by this code im working on a remote world??

 

remenber from other guides something about a class proxiserver and proxiclient is that related whith error.this

 

 

 

 

Link to comment
Share on other sites

very confused whit this

is the world is provided by the method onItemRightClick

anyway this are the two principal class of this item and  a video showing how works

 

//############

package mercenary00.mercenarymod.items;

 

 

import java.io.IOException;

 

import net.minecraft.init.Items;

import mercenary00.mercenarymod.utilidades.cfg;

import net.minecraft.item.EnumAction;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import mercenary00.mercenarymod.Mercenary;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.block.Block;

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.Item;

import net.minecraft.util.IChatComponent;

import net.minecraft.util.IIcon;

import net.minecraft.util.MovingObjectPosition;

import net.minecraft.world.World;

import net.minecraftforge.common.MinecraftForge;

import net.minecraftforge.event.entity.player.ArrowNockEvent;

import mercenary00.mercenarymod.utilidades.util;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.enchantment.Enchantment;

import net.minecraft.enchantment.EnchantmentHelper;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.entity.projectile.EntityArrow;

import net.minecraft.init.Items;

import net.minecraft.util.IIcon;

import net.minecraft.world.World;

import net.minecraftforge.common.MinecraftForge;

import net.minecraftforge.event.entity.player.ArrowLooseEvent;

import net.minecraftforge.event.entity.player.ArrowNockEvent;

import java.util.ArrayList;

 

public class varaMercenaria00 extends Item{

 

public static String name="varamercenaria00";

public static final String[] bowPullIconNameArray = new String[] {"pulling_0", "pulling_1", "pulling_2"};

@SideOnly(Side.CLIENT)

private IIcon[] iconArray;

private static final String __OBFID = "CL_00001777";

 

public static ArrayList<Integer> coordenadas0 = new ArrayList<Integer>();

public static ArrayList<Integer> coordenadas1 = new ArrayList<Integer>();

public static ArrayList<Integer> coordenadas2 = new ArrayList<Integer>();

public static boolean coor1=false;

public static boolean coor2=false;

 

//#############################################################################################

public varaMercenaria00() {

setUnlocalizedName(Mercenary.MODID + "_" + name);

GameRegistry.registerItem(this, name);

setCreativeTab(CreativeTabs.tabTools);

    setTextureName(Mercenary.MODID + ":" + name);

    this.maxStackSize = 1;

    this.setMaxDamage(500);

    this.setCreativeTab(CreativeTabs.tabCombat);

 

 

}

//#############################################################################################

//#############################################################################################

 

public ItemStack onItemRightClick(ItemStack p_77659_1_, World world, EntityPlayer steve){

// System.out.println("###    presss");

 

 

coordenadas0=util.coordenadaDeBlockeEnFocol(world, 10);

// util.MostrarLista(coordenadas0);

 

 

if (util.compararListas(coordenadas2,coordenadas0)==false){ //ignorar click

 

 

 

if (coor1){

// System.out.println("coor1 true");

 

 

if ((coor2==false)&&(util.compararListas(coordenadas0,coordenadas1)==false)){

 

coordenadas2=coordenadas0;coor2=true;

}

 

 

}else{

// System.out.println("coor1 false");

coordenadas1=coordenadas0;coor1=true;

}

 

 

if ((coor1)&&(coor2)){

System.out.println("Tengo dos coordenadas distintas");

util.MostrarLista(coordenadas1);

util.MostrarLista(coordenadas2);

coor1=false;

coor2=false;

 

//util.romper(world, util.Cuadrado(0, coordenadas1,coordenadas2));

util.romper(world,util.circulo( coordenadas1,coordenadas2));

 

}

 

} //ignorar click

 

return p_77659_1_;

}

 

}//fin de la classe

 

//##########################################################################

//##########################################################################

//##########################################################################

//##########################################################################

//##########################################################################

//##########################################################################

//##########################################################################

//##########################################################################

//##########################################################################

 

 

 

package mercenary00.mercenarymod.utilidades;

 

import net.minecraft.init.Blocks;

 

import java.io.IOException;

import java.util.ArrayList;

import java.util.List;

 

import net.minecraft.init.Items;

import mercenary00.mercenarymod.utilidades.cfg;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import mercenary00.mercenarymod.Mercenary;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.block.Block;

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.Item;

import net.minecraft.util.IIcon;

import net.minecraft.util.MovingObjectPosition;

import net.minecraft.world.World;

import net.minecraftforge.common.MinecraftForge;

import net.minecraftforge.event.entity.player.ArrowNockEvent;

import mercenary00.mercenarymod.utilidades.util;

 

 

public class util{

 

 

//#################################################################################################################

//#### devuelve las coordenadas del blocke al que esta mirando steve

 

public static ArrayList<Integer> coordenadaDeBlockeEnFocol(World world,int distancia){

//System.out.println("###coordenadaDeBlockeEnFocoL");

 

ArrayList<Integer> lin =new ArrayList<Integer>();

 

//      x          y          z

//lin.add(0);lin.add(0);lin.add(0);

 

 

MovingObjectPosition mop = Minecraft.getMinecraft().renderViewEntity.rayTrace(distancia, 1.0F);

//System.out.println("###mop="+mop);

if(mop != null)

{

    int blockHitSide = mop.sideHit;

    Block blockLookingAt = world.getBlock(mop.blockX, mop.blockY, mop.blockZ) ;

   

    int fx=(int)mop.blockX;

    int fy=(int)mop.blockY;

    int fz=(int)mop.blockZ;

   

// System.out.println("fx="+fx+" fy="+fy+" fz="+fz);

    lin.add(0,fx);

    lin.add(1,fy);

    lin.add(2,fz);

}

//

// int x=lin.get(0);

// int y=lin.get(1);

// int z=lin.get(2);

// if (world.isAirBlock(x,y,z)) {System.out.println(">>>>>### el blocke x="+x+" y="+y+" z="+z+" es aire");}

 

//  System.out.println("x="+lin.get(0)+" y="+lin.get(1)+" z="+lin.get(2));

return lin;

 

 

//

 

}

 

 

//#################################################################################################################

 

//### devuelve la id 0 del blocke en las coordenadas

public static int IDdelBlockeEn(World world, List<Integer> lin){

 

//int x=lin.get(0);

//int y=lin.get(1);

//int z=lin.get(3);

 

Block blck = world.getBlock(lin.get(0),lin.get(1),lin.get(2));

int iblck=Block.getIdFromBlock(blck);

return iblck;

}

 

//#################################################################################################################

 

public static boolean compararListas(List<Integer> lia, List<Integer> lib){

// System.out.println("compararVectores");

 

int la=lia.size(),lb=lib.size();int count=0;

 

if (la==lb){

// System.out.println("A y B miden lo mismo la="+la+" lb="+lb);

 

for (int c=0; c < la ;c++){

// System.out.println("c="+c);

 

int a=lia.get©,b=lib.get©;

 

if (a==b){

count++;

;}

// System.out.println("count="+count+" a="+a+" y b="+b);

 

}

}

 

// System.out.println("count="+count+" la="+la+" lb="+lb);

 

 

if ((count==la)&&(la==lb)){

return true;

}else{

return false;

}

 

}

//#################################################################################################################

 

 

public static List<Integer> minmax(List<Integer> lia, List<Integer> lib){

System.out.println("#### \nMetodo minmax");

 

ArrayList<Integer> orga =new  ArrayList<Integer>();

 

for (int or=0; or<6 ; or++ )

{

orga.add(0);

}

 

int count=0;

int liasize=lia.size(),libsize=lib.size();

 

 

 

System.out.println("x="+lia.get(0)+" y="+lia.get(1)+" z="+lia.get(2));

        System.out.println("x="+lib.get(0)+" y="+lib.get(1)+" z="+lib.get(2));

System.out.println("");

 

 

 

if (liasize==libsize){

// System.out.println("los dos vectores miden lo mismo ");

 

 

 

for (int c=0;c<3;c++){

int a=lia.get©;

int b=lib.get©;

 

if ( a <= b ){ orga.set( c , a ) ;}

if ( a >= b ){ orga.set((c+3) , a);}

 

if ( b <= a ){ orga.set( c , b ) ;}

if ( b >= a ){ orga.set((c+3) , b);}

 

 

                    }

                    }

return orga;

 

                          }

//#################################################################################################################

 

 

public static void romper(World world,List<Integer> lis){

System.out.println("####  romper");

 

int llist=lis.size(); //longitud de la lista

 

System.out.println("####  llist="+llist);

 

 

for (int conteo=0; conteo < llist;conteo=conteo+3){

int x=lis.get(conteo),y=lis.get(conteo+1),z=lis.get(conteo+2);

 

 

//Block blck = world.getBlock(x,y,z);

//blck.dropBlockAsItem(world, x,y,z, 1, 1);

//world.setBlock(x,y,z, Blocks.air);

 

world.func_147480_a(x,y,z, true);

 

if (world.isRemote){ System.out.println("####  world.isRemote=true ");}

else              { System.out.println("####  world.isRemote=false");}

 

 

 

System.out.println("####  x="+x+" y="+y+" z="+z);

System.out.println("####  conteo="+conteo);

}

}

 

 

//#################################################################################################################

 

public static ArrayList<Integer> Cuadrado(int modo,List<Integer> lia, List<Integer> lib){

 

ArrayList<Integer> li = new ArrayList<Integer>();

ArrayList<Integer> lo = new ArrayList<Integer>();

ArrayList<Integer> orga = new ArrayList<Integer>();

 

//System.out.println("antes de organizar");

//System.out.println("min x="+min[0]+" y="+min[1]+" z="+min[2]);

//System.out.println("max x="+max[0]+" y="+max[1]+" z="+max[2]);

 

orga=(ArrayList<Integer>) minmax(lia , lib); ///por si acaso organizar min y maximos

 

 

System.out.println("despues de organizar");

System.out.println("min x="+orga.get(0)+" y="+orga.get(1)+" z="+orga.get(2));

System.out.println("max x="+orga.get(3)+" y="+orga.get(4)+" z="+orga.get(5));

 

 

//#############################################

 

 

int xmin=orga.get(0), ymin=orga.get(1), zmin=orga.get(2);

int xmax=orga.get(3), ymax=orga.get(4), zmax=orga.get(5);

 

for(int u=zmin;u<=zmax;u++){

for(int o=ymin;o<=ymax;o++){

for(int i=xmin;i<=xmax;i++){

 

 

li.add(i);

li.add(o);

li.add(u);

 

 

}}}

//#############################################

 

 

 

 

 

 

 

/*

try {

Thread.sleep (10000);

} catch (Exception e) {

// Mensaje en caso de que falle

}

*/

return li;

}

 

public static void MostrarLista(List<Integer> in){

 

int lilong=in.size();

 

for (int lins=0 ; lins < lilong ; lins=lins+3){

 

int x=in.get(lins),y=in.get(lins+1),z=in.get(lins+2);

System.out.println(lins+" > x="+x+" y="+y+" z="+z);

 

;}

 

 

}

//#################################################################################################################

 

 

 

public static ArrayList<Integer> circulo(List<Integer> lia, List<Integer> lib){

 

 

ArrayList<Integer> li = new ArrayList<Integer>();

ArrayList<Integer> lo = new ArrayList<Integer>();

ArrayList<Integer> orga = new ArrayList<Integer>();

 

li.clear();

lo.clear();

orga.clear();

 

double xc=lia.get(0), yc=lia.get(1), zc=lia.get(2);

double xr=lib.get(0), yr=lib.get(1), zr=lib.get(2);

 

 

 

double radio= Math.sqrt(Math.pow((xc-xr),2)+Math.pow((zc-zr),2));

int    radiu=(int)radio;

 

int longitud=(int)(yc-yr); if (longitud < 0){longitud=-longitud ;}

 

System.out.println("Radio="+radio+"\nLongitud="+longitud);

//z2+x2=r2

 

System.out.println("cargar li");

for (int y=0 ; y<= longitud ; y++ ){

 

for (int x=(-radiu);x <= radiu ;x++){

 

double dz=Math.sqrt( Math.pow(radio,2)-Math.pow(x,2) );

 

//System.out.println("x="+x+" y="+y+" z="+dz);

 

//li.add(x);li.add(y);li.add((int)dz);

int zmax=(int)dz;

int zmin=(int) -dz;

 

for (int relleno=zmin; relleno <= zmax ; relleno++){

 

li.add(x);li.add(y);li.add(relleno);

 

;}

//li.add(x);li.add(y);li.add((int) -dz);

 

}

 

}

 

//util.MostrarLista(li);

 

 

int lisize=li.size();

System.out.println("cargar lo lisize="+lisize);

 

for (int lis=0 ; lis < lisize ; lis=lis+3){

 

System.out.println("lis="+lis);

 

lo.add( (int) (xc+li.get(lis)));

lo.add( (int) (yc+li.get(lis+1)));

lo.add( (int) (zc+li.get(lis+2)));

 

 

}

 

return lo;

}

 

}//fin de la classe

 

 

Link to comment
Share on other sites

very confused whit this

is the world is provided by the method onItemRightClick

minecraft always calls that kind of methods twice once with the client word once with the server world:

 

	   public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer steve){
      System.out.println(world.isRemote);
      return stack;
   }

This would print out:

true

false

 

I'm not too sure about the code tho (I'm somewhat new to coding)

But what i think happens is u check for coor1 to be true and then call ur own method with the client world, then u set coor1 to false. When the method actually gets called with the server world coor1 is false and you ofc dont call the method, so, Maybe just put the whole code in onItemRightClick in a if(!world.isRemote)

Link to comment
Share on other sites

public static int conteo=0;

 

public ItemStack onItemRightClick(ItemStack p_77659_1_, World world, EntityPlayer steve){

// System.out.println("###    presss");

 

conteo++;

System.out.println("is "+conteo+" times onItemRightClick is execute");

System.out.println("world.isRemote="+world.isRemote);

 

coordenadas0=util.coordenadaDeBlockeEnFocol(world, 10);

// util.MostrarLista(coordenadas0);

 

 

 

it gets weirder here :

 

16:00:10]  Player962 joined the game

[16:00:20] items.varaMercenaria00:onItemRightClick:79]: is 1 times onItemRightClick is execute

[16:00:20] items.varaMercenaria00:onItemRightClick:80]: world.isRemote=true

[16:00:20] items.varaMercenaria00:onItemRightClick:79]: is 2 times onItemRightClick is execute

[16:00:20] items.varaMercenaria00:onItemRightClick:80]: world.isRemote=false

[16:00:21] items.varaMercenaria00:onItemRightClick:79]: is 3 times onItemRightClick is execute

[16:00:21] items.varaMercenaria00:onItemRightClick:80]: world.isRemote=true

 

[16:00:21] items.varaMercenaria00:onItemRightClick:107]: Tengo dos coordenadas distintas

[16:00:21] .utilidades.util:romper:174]: ####  romper

[16:00:21] .utilidades.util:romper:191]: ####  world.isRemote=true

[16:00:21] .utilidades.util:romper:191]: ####  world.isRemote=true

 

_________________________________________________________________________

 

the world is remote true an then false an again is true in the romper part is always true

 

anyway on item rigth click is giving my this remote  world and dont think this is a bug this code was copy from the item.bow class

 

 

_________________________________________________________________________

soo i made a little xperiment create a block that on click it breaks the floor under and make the world check think

 

 

[server thread/INFO] [sTDOUT]: onBlockClicked:46]: se ejecuto onBlockClicked

[16:47:33] [server thread/INFO] [sTDOUT]:onBlockClicked:50]: ####  world.isRemote=false

[16:47:33] [server thread/INFO] [sTDOUT]l:romper:174]: ####  romper

[16:47:33] [Client thread/INFO] [sTDOUT]:: se ejecuto onBlockClicked

[16:47:33] [Client thread/INFO] [sTDOUT]:onBlockClicked:49]: ####  world.isRemote=true 

 

[Client thread/INFO] [sTDOUT]:: se ejecuto onBlockActivated

[16:47:49] [Client thread/INFO] : ####  world.isRemote=true

[16:47:49] [Client thread/INFO]  ####  romper

[16:47:49] [Client thread/INFO] : ####  world.isRemote=true

[16:47:49] [Client thread/INFO: ####  world.isRemote=true

 

[server thread/INFO] [sTDOUT]:: se ejecuto onBlockActivated

[16:47:49] [server thread/INFO] [sTDOUT]: ####  world.isRemote=false

[16:47:49] [server thread/INFO] [sTDOUT]:: ####  romper

Link to comment
Share on other sites

SO i made little video showing this think

 

the think jeopardizing is this

 

[16:59:49] [Client thread/INFO] [sTDOUT]

[16:59:49] [Client thread/INFO] [sTDOUT]

[16:59:49] [server thread/INFO] [sTDOUT]

[16:59:49] [server thread/INFO] [sTDOUT]:

 

Client thread | Server thread 

wen i destroy whit the block is make a cycle on client and then a cycle on server but

 

why this is not  happening with the wand

 

 

Link to comment
Share on other sites

i use the bow code as base to make this,  cut paste i edit wat i need soo the code for varita mercenaria is a few post up.

 

basicli im using the method

 

public ItemStack onItemRightClick(ItemStack p_77659_1_, World world, EntityPlayer steve){

}  // i get this from the bow class

 

varamercenaria00 exist just to get two blocks coordenates  i name it  coordenadas1=firstclick  coordenadas2=secundclick

coordenadas0 is just a cache for the input from util.coordenadaDeBlockeEnFocol(world, 10);

 

when there is two diferent coordenates loaded in coordenadas1 and coordenas2 it run

 

util.romper(world,util.circulo( coordenadas1,coordenadas2));

 

and set to zero coordenadas1 and coordenas2

 

the magic is in util.circulo( coordenadas1,coordenadas2) who define all the block in a cilinder volumen and returit like a list of coordenates then util.romper take the world data and break all the blocks in the list

late i the nigth i gona reduce the exit of system.out soo the importantings could be seen in the eclipse stoudout

 

the trouble whith eclipse,  it have a limit to the output so i can grab all the exit,

 

 

 

 

Link to comment
Share on other sites

 

public ItemStack onItemRightClick(ItemStack p_77659_1_, World world, EntityPlayer steve){

//      System.out.println("###    presss");

 

conteo++;

System.out.println("is "+conteo+" times onItemRightClick is execute");

System.out.println("world.isRemote="+world.isRemote);

       

return p_77659_1_;

}

 

//stoudout

 

 

[20:52:32] [Client thread/INFO] [sTDOUT]: [mercenary00.mercenarymod.items.varaMercenaria00:onItemRightClick:89]: is 1 times onItemRightClick is execute

[20:52:32] [Client thread/INFO] [sTDOUT]: [mercenary00.mercenarymod.items.varaMercenaria00:onItemRightClick:90]: world.isRemote=true

[20:52:32] [server thread/INFO] [sTDOUT]: [mercenary00.mercenarymod.items.varaMercenaria00:onItemRightClick:89]: is 2 times onItemRightClick is execute

[20:52:32] [server thread/INFO] [sTDOUT]: [mercenary00.mercenarymod.items.varaMercenaria00:onItemRightClick:90]: world.isRemote=false

[20:52:32] [Client thread/INFO] [sTDOUT]: [mercenary00.mercenarymod.items.varaMercenaria00:onItemRightClick:89]: is 3 times onItemRightClick is execute

[20:52:32] [Client thread/INFO] [sTDOUT]: [mercenary00.mercenarymod.items.varaMercenaria00:onItemRightClick:90]: world.isRemote=true

[20:52:32] [server thread/INFO] [sTDOUT]: [mercenary00.mercenarymod.items.varaMercenaria00:onItemRightClick:89]: is 4 times onItemRightClick is execute

[20:52:32] [server thread/INFO] [sTDOUT]: [mercenary00.mercenarymod.items.varaMercenaria00:onItemRightClick:90]: world.isRemote=false

[20:52:33] [Client thread/INFO] [sTDOUT]: [mercenary00.mercenarymod.items.varaMercenaria00:onItemRightClick:89]: is 5 times onItemRightClick is execute

[20:52:33] [Client thread/INFO] [sTDOUT]: [mercenary00.mercenarymod.items.varaMercenaria00:onItemRightClick:90]: world.isRemote=true

[20:52:33] [server thread/INFO] [sTDOUT]: [mercenary00.mercenarymod.items.varaMercenaria00:onItemRightClick:89]: is 6 times onItemRightClick is execute

[20:52:33] [server thread/INFO] [sTDOUT]: [mercenary00.mercenarymod.items.varaMercenaria00:onItemRightClick:90]: world.isRemote=false

[20:52:39] [Client thread/INFO] [sTDOUT]: [mercenary00.mercenarymod.items.varaMercenaria00:onItemRightClick:89]: is 7 times onItemRightClick is execute

[20:52:39] [Client thread/INFO] [sTDOUT]: [mercenary00.mercenarymod.items.varaMercenaria00:onItemRightClick:90]: world.isRemote=true

[20:52:39] [server thread/INFO] [sTDOUT]: [mercenary00.mercenarymod.items.varaMercenaria00:onItemRightClick:89]: is 8 times onItemRightClick is execute

[20:52:39] [server thread/INFO] [sTDOUT]: [mercenary00.mercenarymod.items.varaMercenaria00:onItemRightClick:90]: world.isRemote=false

 

 

Link to comment
Share on other sites

I just realized

in which consist the problem

 

when one uses the method onItemRightClick() validates several times

runs several times

interleaving the worlds first remote then the local remote again and again the local

performance obsessed me as I wrote the code so that it will only accept a cycle by sending the coordinates and the parameters only once so sending only the first world the remote world that is always first, ignoring the local world.

change the code to just send the variables only when the world is local

and only do it once until  the coordinates change

now looks like this

 

if ((coor1)&&(coor2)&&(!world.isRemote)){

 

util.romper(world,util.circulo( coordenadas1,coordenadas2));

}

 

 

there in a one more cuestion but it goes in another treat

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • [net.minecraftforge.fml.loading.RuntimeDistCleaner/DISTXFORM]: Attempted to load class net/minecraft/client/MouseHandler for invalid dist DEDICATED_SERVER when im trying to start server mods: sinytra connector forgified fabric api jei forge origins forge moraks medival races forge geckolib forge wthit forge wizards fabric paladins and priests fabric runes fabric spell engine fabric playeranimator fabric (i checked its not clientside only mod and spell engine doesnt work without it) pehkui forge soulbound forge biomes o plenty forge biome blender forge terralith forge starlight fabric serializationisbad fabric ice and fire forge lazydfu fabric gravestone forge citadel forge alex mobs forge the undead revamped forge badpackets forge trinkets forge rpg difficulty fabric azurelib armor forge cloth config forge caelus forge ferritecore forge   [09May2024 11:32:59.097] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--launchTarget, forgeserver, --fml.forgeVersion, 47.2.20, --fml.mcVersion, 1.20.1, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20230612.114412] [09May2024 11:32:59.102] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.9+10.0.9+main.dcd20f30 starting: java version 17.0.11 by Eclipse Adoptium; OS Linux arch amd64 version 5.4.0-172-generic [09May2024 11:33:00.615] [main/INFO] [net.minecraftforge.fml.loading.ImmediateWindowHandler/]: ImmediateWindowProvider not loading because launch target is forgeserver [09May2024 11:33:00.694] [main/INFO] [mixin-transmog/]: Mixin Transmogrifier is definitely up to no good... [09May2024 11:33:00.798] [main/INFO] [mixin-transmog/]: crimes against java were committed [09May2024 11:33:00.830] [main/INFO] [mixin-transmog/]: Original mixin transformation service successfully crobbed by mixin-transmogrifier! [09May2024 11:33:00.997] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/server/server-data/mods/Connector-1.0.0-beta.43+1.20.1.jar%23133%23136!/ Service=ModLauncher Env=SERVER [09May2024 11:33:01.008] [main/INFO] [io.dogboy.serializationisbad.core.SerializationIsBad/]: Initializing SerializationIsBad, implementation type: modlauncher [09May2024 11:33:01.815] [main/INFO] [io.dogboy.serializationisbad.core.SerializationIsBad/]: Using remote config file [09May2024 11:33:01.820] [main/INFO] [io.dogboy.serializationisbad.core.SerializationIsBad/]: Loaded config file [09May2024 11:33:01.822] [main/INFO] [io.dogboy.serializationisbad.core.SerializationIsBad/]:   Blocking Enabled: true [09May2024 11:33:01.823] [main/INFO] [io.dogboy.serializationisbad.core.SerializationIsBad/]:   Loaded Patch Modules: 39 [09May2024 11:33:03.095] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /server/jars/forge-1.20.1-47.2.20/libraries/net/minecraftforge/fmlcore/1.20.1-47.2.20/fmlcore-1.20.1-47.2.20.jar is missing mods.toml file [09May2024 11:33:03.096] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /server/jars/forge-1.20.1-47.2.20/libraries/net/minecraftforge/javafmllanguage/1.20.1-47.2.20/javafmllanguage-1.20.1-47.2.20.jar is missing mods.toml file [09May2024 11:33:03.097] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /server/jars/forge-1.20.1-47.2.20/libraries/net/minecraftforge/lowcodelanguage/1.20.1-47.2.20/lowcodelanguage-1.20.1-47.2.20.jar is missing mods.toml file [09May2024 11:33:03.098] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /server/jars/forge-1.20.1-47.2.20/libraries/net/minecraftforge/mclanguage/1.20.1-47.2.20/mclanguage-1.20.1-47.2.20.jar is missing mods.toml file [09May2024 11:33:04.426] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select two dependency jars from JarJar which have the same identification: Mod File:  and Mod File: . Using Mod File: [09May2024 11:33:04.427] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.JarInJarDependencyLocator/]: Found 50 dependencies adding them to mods collection [09May2024 11:33:10.029] [main/INFO] [dev.su5ed.sinytra.connector.service.hacks.ModuleLayerMigrator/]: Successfully made module authlib transformable [09May2024 11:33:14.416] [main/INFO] [mixin/]: Compatibility level set to JAVA_17 [09May2024 11:33:15.020] [main/ERROR] [dev.su5ed.sinytra.connector.loader.ConnectorEarlyLoader/]: Skipping early mod setup due to previous error [09May2024 11:33:15.095] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'forgeserver' with arguments [] [09May2024 11:33:22.894] [main/ERROR] [net.minecraftforge.fml.loading.RuntimeDistCleaner/DISTXFORM]: Attempted to load class net/minecraft/client/MouseHandler for invalid dist DEDICATED_SERVER [09May2024 11:33:22.895] [main/WARN] [mixin/]: Error loading class: net/minecraft/client/MouseHandler (java.lang.RuntimeException: Attempted to load class net/minecraft/client/MouseHandler for invalid dist DEDICATED_SERVER) [09May2024 11:33:22.896] [main/WARN] [mixin/]: @Mixin target net.minecraft.client.MouseHandler was not found fabric-screen-api-v1.mixins.json:MouseMixin from mod fabric_screen_api_v1 [09May2024 11:33:22.898] [main/ERROR] [net.minecraftforge.fml.loading.RuntimeDistCleaner/DISTXFORM]: Attempted to load class net/minecraft/client/gui/screens/Screen for invalid dist DEDICATED_SERVER [09May2024 11:33:22.899] [main/WARN] [mixin/]: Error loading class: net/minecraft/client/gui/screens/Screen (java.lang.RuntimeException: Attempted to load class net/minecraft/client/gui/screens/Screen for invalid dist DEDICATED_SERVER) [09May2024 11:33:22.899] [main/WARN] [mixin/]: @Mixin target net.minecraft.client.gui.screens.Screen was not found fabric-screen-api-v1.mixins.json:ScreenAccessor from mod fabric_screen_api_v1 [09May2024 11:33:24.819] [main/INFO] [MixinExtras|Service/]: Initializing MixinExtras via com.llamalad7.mixinextras.service.MixinExtrasServiceImpl(version=0.3.5).
    • I think i've found a more "generation friendly way" of generating random blobs of mineral around the ore. This both does the trick and make the generation work flawlessly (albeit i need to make some adjustments). I just ended up thinking "MAYBE there is another Feature I can use to place the minerals instead of doing it manually" And, low and behold, SCATTERED_ORE  is actually a thing. I don't really know how "orthodox" this solution is, but it works and rids me of all the problems I had witht my original "manual" implementation. If anybody has any insight on why my original class could've been causing lag to the point of freezes and chunk generation just refusing to keep loading new chunks, I'm also all ears:   Here is the full if (placed) block for anyone with a smiliar issue: if (placed) { // Define the block to replace surrounding blocks with BlockState surroundingBlockState = BlockInit.ABERRANT_MINERALOID.get().defaultBlockState(); RuleTest stoneReplacement = new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES); //Tag which indicates ores that can replace stone RuleTest deepslateReplacement = new TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES); //Tag which indicates ores that can replace deepslate // Create a list of TargetBlockState for the Aberrant Mineraloids List<OreConfiguration.TargetBlockState> targets = new ArrayList<>(); targets.add(OreConfiguration.target(stoneReplacement, surroundingBlockState)); targets.add(OreConfiguration.target(deepslateReplacement, surroundingBlockState)); // Create a new OreConfiguration for the Aberrant Mineraloids OreConfiguration mineraloidConfig = new OreConfiguration(targets, 9); // vein size // Create a new context for the Aberrant Mineraloids FeaturePlaceContext<OreConfiguration> mineraloidCtx = new FeaturePlaceContext<>( Optional.empty(), world, ctx.chunkGenerator(), ctx.random(), offsetOrigin, mineraloidConfig ); // Generate the Aberrant Mineraloids using the SCATTERED_ORE configuration boolean mineraloidsPlaced = Feature.SCATTERED_ORE.place(mineraloidCtx); }  
    • bonjour , j ai trouver une vidéo très intéressant sur Minecraft comment voler des villageois sans qu'il sans rendent compte en 37 manière , c est très intéressant a voir et surtout  le refaire après    Je vous les met le lien de la vidéo YouTube : https://shrinkme.cc/ZlHy 
  • Topics

×
×
  • Create New...

Important Information

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