Jump to content

# TH3Doctor_11th

Members

18

## Posts posted by TH3Doctor_11th

### [1.12.2] MultiBlock Structure Pattern Recognition Best Practices

5 hours ago, Cadiboo said:

That sounds perfect. Then you just have to store a reference (BlockPos?) to the Master somewhere & when the blocks are right clicked return master.rightClicked.

You will also want to return the capabilities of the master when your outside blocks are queried too.

Ok! ?

4 hours ago, jabelar said:

Yep, that is how its done.

One other point, depending on the symmetry of your structure you might want to take different approaches regarding whether the rotations are handled "algorithmically" or "brute force". If you have a structure that is symmetric in both X and Z then obviously you have to only scan once since the shape is same in any rotation. If you have a structure otherwise you need to decide the best way to handle the rotation. The brute force way is to pre-compute the structure in each rotation (really four different structures) and check each with same logic as you outlined above. I generally recommend that way. But if the symmetry is simple you could choose to handle the rotation within the loop -- like when you detect the unique elements they would indicate the rotation and then you apply it.

I've seen a lot of people work hard at getting rotation to work, and in the end I recommend just considering each rotation a separate structure and then have very simple checking.

Not sure which situation applies to your structure.

So if I store the correct blocks in a matrix (static and final) for every configuration, would it be ok? Or is it too much? This structure in particular is a 3x3x3 ?

### [1.12.2] MultiBlock Structure Pattern Recognition Best Practices

After some trials, I found out a possible solution that I would like to share and get some feedback from both  As you said, I have to recognize the unique pieces of the multiblock first. If any of them is missing, I just say "nope, no correct structure". Then, through BlockPos.getAllInBox() or something like that, I get the positions in the N x N x N, and I iterate through them (ignoring the positions of the special ones, that I asserted to be there at this stage) and check if the blocks at the corresponding locations are, for example, casings. Again, if anything is not at its place, then it's not a valid structure. Else, everything is in its place, and the structure is ready  let me know

### [1.12.2] MultiBlock Structure Pattern Recognition Best Practices

Thanks for the answers @Cadiboo @jabelar  So, since I wanted to use an energy containment / transfer block (I am working on a Technical Mod) in conjuction with the controller, I could start by checking if and where it is located relative to the controller itself. So, I have to do 4 conditional checks for the x and z axis, both negative and positive, and if I am planning on adding a transfer and a battery with different costs in crafting terms, i need to check separately for both. Is it correct? (I am using Structure classes, Singletons, to hold off 3D Matrixes that contain the correct order of blocks). Just another thing, would it be better to have the structure made of TEs so wherever I click I can open the future GUI of the controller following the Master-Slave principle, or should I make players click just on the controller (which will have a different texture of course) keeping the other blocks of the structure without TEs? (except the transferer / battery, which will have their own GUIs). Thanks again for both your answers!

### [1.12.2] MultiBlock Structure Pattern Recognition Best Practices

Hi all. I have some TEs ready, with blocks and everything set, and I would like to figure out how to efficiently recognize a multiblock structure with those TEs. As regards mechanics, Master-Slave is just right. But are there any best practices about finding out if a multiblock structure is valid or not? I am currently trying with the for loops for each axis, since I don't think recursion would be much better (It's not a Fluid Tank, so the TEs composing the structure could be different. I could implement recursion, but at the moment I am focusing on solving the structure recognition first). The problem is, the structure controller is not at the perfect center of the Multiblock, and as a result I have to check where the TE block is facing. I don't think this is an efficient solution, and I was hoping someone could lead me in the right direction to figure out a good way to solve this. Thanks in advance!

### Question about Collision Boxes

Hi Everyone I recently got back to minecraft modding.. and last week I asked something about Techne. I am clearly making a mob, but here s a new dilemma: I would like to make it completely uncollidable. Entities and player should pass through it. I have seen that noppes, in his CustomNPCs, has done something to make it possible. But i really can't get how he does it. Is there someone who knows how to do it? Am I missing something really simple? Thanks in advance.

### Question about Collision Boxes

Hi Everyone I recently got back to minecraft modding.. and last week I asked something about Techne. I am clearly making a mob, but here s a new dilemma: I would like to make it completely uncollidable. Entities and player should pass through it. I have seen that noppes, in his CustomNPCs, has done something to make it possible. But i really can't get how he does it. Is there someone who knows how to do it? Am I missing something really simple? Thanks in advance.

### Question about Techne

That's why i said having no animations was normal btw, here are is code:

public class PNModelUmbrellaStatue extends ModelBase

{

//fields

ModelRenderer head;

ModelRenderer body;

ModelRenderer chest;

ModelRenderer rightshoulder;

ModelRenderer rightforearm;

ModelRenderer rightelbow;

ModelRenderer rightarm;

ModelRenderer leftshoulder;

ModelRenderer leftforearm;

ModelRenderer leftelbow;

ModelRenderer leftarm;

ModelRenderer rightlegpreknee;

ModelRenderer rightknee;

ModelRenderer rightleg;

ModelRenderer leftlegpreknee;

ModelRenderer leftknee;

ModelRenderer leftleg;

public PNModelUmbrellaStatue()

{

textureWidth = 128;

textureHeight = 64;

this.head = new ModelRenderer(this, 0, 0);

this.head.addBox(-4F, -8F, -4F, 9, 8, 8 );

this.head.setRotationPoint(-1F, -2F, -5F);

this.head.setTextureSize(128, 64);

this.head.mirror = true;

setRotation(this.head, 0.5235988F, -0.2617994F, -0.2617994F);

this.body = new ModelRenderer(this, 78, 0);

this.body.addBox(-4F, 0F, -2F, 12, 6, 6);

this.body.setRotationPoint(-2F, 11F, 0F);

this.body.setTextureSize(128, 64);

this.body.mirror = true;

setRotation(this.body, 0F, 0F, 0F);

this.chest = new ModelRenderer(this, 34, 0);

this.chest.addBox(-1F, 0F, 0F, 14, 12, 8 );

this.chest.setRotationPoint(-6F, -0.5F, -6F);

this.chest.setTextureSize(128, 64);

this.chest.mirror = true;

setRotation(this.chest, 0.2617994F, 0F, 0F);

this.rightshoulder = new ModelRenderer(this, 98, 12);

this.rightshoulder.addBox(-3F, -2F, -2F, 4, 5, 6);

this.rightshoulder.setRotationPoint(-10F, 2F, -0.5F);

this.rightshoulder.setTextureSize(128, 64);

this.rightshoulder.mirror = true;

setRotation(this.rightshoulder, 0F, -0.3490659F, -0.5235988F);

this.rightforearm = new ModelRenderer(this, 42, 20);

this.rightforearm.addBox(0F, 0F, 0F, 6, 4, 4);

this.rightforearm.setRotationPoint(-16F, 11.5F, -3.5F);

this.rightforearm.setTextureSize(128, 64);

this.rightforearm.mirror = true;

setRotation(this.rightforearm, -0.5235988F, -0.715585F, -1.308997F);

this.rightelbow = new ModelRenderer(this, 72, 23);

this.rightelbow.addBox(0F, 0F, 0F, 1, 4, 4);

this.rightelbow.setRotationPoint(-15.5F, 14F, -6F);

this.rightelbow.setTextureSize(128, 64);

this.rightelbow.mirror = true;

setRotation(this.rightelbow, -0.5235988F, -1.308997F, -1.047198F);

this.rightarm = new ModelRenderer(this, 96, 23);

this.rightarm.addBox(0F, 0F, 0F, 3, 4, 4);

this.rightarm.setRotationPoint(-15F, 18.5F, -8.5F);

this.rightarm.setTextureSize(128, 64);

this.rightarm.mirror = true;

setRotation(this.rightarm, -0.5235988F, -1.570796F, -1.047198F);

this.leftshoulder = new ModelRenderer(this, 78, 12);

this.leftshoulder.addBox(0F, 0F, 0F, 4, 5, 6);

this.leftshoulder.setRotationPoint(16F, 4F, -2.5F);

this.leftshoulder.setTextureSize(128, 64);

this.leftshoulder.mirror = true;

setRotation(this.leftshoulder, 0.2617994F, -2.094395F, -0.7853982F);

this.leftforearm = new ModelRenderer(this, 22, 20);

this.leftforearm.addBox(0F, 0F, 0F, 6, 4, 4);

this.leftforearm.setRotationPoint(10F, 10F, -11F);

this.leftforearm.setTextureSize(128, 64);

this.leftforearm.mirror = true;

setRotation(leftforearm, -0.5235988F, -1.047198F, -0.7853982F);

this.leftelbow = new ModelRenderer(this, 62, 23);

this.leftelbow.addBox(0F, 0F, 0F, 1, 4, 4);

this.leftelbow.setRotationPoint(7F, 11F, -11F);

this.leftelbow.setTextureSize(128, 64);

this.leftelbow.mirror = true;

setRotation(this.leftelbow, -0.7853982F, -0.5235988F, -0.3490659F);

this.leftarm = new ModelRenderer(this, 82, 23);

this.leftarm.addBox(0F, 0F, 0F, 3, 4, 4);

this.leftarm.setRotationPoint(2F, 12.5F, -13F);

this.leftarm.setTextureSize(128, 64);

this.leftarm.mirror = true;

setRotation(this.leftarm, -0.2617994F, -0.1047198F, -0.2617994F);

this.rightlegpreknee = new ModelRenderer(this, 0, 28);

this.rightlegpreknee.addBox(-2F, 0F, -2F, 6, 5, 5);

this.rightlegpreknee.setRotationPoint(-4F, 18.5F, -2F);

this.rightlegpreknee.setTextureSize(128, 64);

this.rightlegpreknee.mirror = true;

setRotation(this.rightlegpreknee, 0F, -0.7853982F, 0.1308997F);

this.rightknee = new ModelRenderer(this, 0, 16);

this.rightknee.addBox(0F, 0F, 0F, 4, 4, 1);

this.rightknee.setRotationPoint(-8.5F, 18F, -6.5F);

this.rightknee.setTextureSize(128, 64);

this.rightknee.mirror = true;

setRotation(this.rightknee, 0F, 0F, 0F);

this.rightleg = new ModelRenderer(this, 44, 31);

this.rightleg.addBox(0F, 0F, 0F, 4, 8, 4);

this.rightleg.setRotationPoint(-9F, 19F, -8F);

this.rightleg.setTextureSize(128, 64);

this.rightleg.mirror = true;

setRotation(this.rightleg, -1.396263F, 0F, -0.2617994F);

this.leftlegpreknee = new ModelRenderer(this, 22, 28);

this.leftlegpreknee.addBox(-2F, 0F, -2F, 5, 5, 6);

this.leftlegpreknee.setRotationPoint(4F, 17.5F, -2F);

this.leftlegpreknee.setTextureSize(128, 64);

this.leftlegpreknee.mirror = true;

setRotation(this.leftlegpreknee, -0.5235988F, -0.2617994F, 0F);

this.leftknee = new ModelRenderer(this, 10, 16);

this.leftknee.addBox(0F, 0F, 0F, 4, 4, 1);

this.leftknee.setRotationPoint(3F, 16.5F, -7.5F);

this.leftknee.setTextureSize(128, 64);

this.leftknee.mirror = true;

setRotation(this.leftknee, 0F, 0F, 0F);

this.leftleg = new ModelRenderer(this, 60, 31);

this.leftleg.addBox(0F, 0F, 0F, 4, 8, 4);

this.leftleg.setRotationPoint(3F, 17F, -9.5F);

this.leftleg.setTextureSize(128, 64);

this.leftleg.mirror = true;

setRotation(this.leftleg, -1.047198F, 0.2617994F, 0F);

}

public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)

{

super.render(entity, f, f1, f2, f3, f4, f5);

setRotationAngles(f, f1, f2, f3, f4, f5, entity);

this.head.render(f5);

this.body.render(f5);

this.chest.render(f5);

this.rightshoulder.render(f5);

this.rightforearm.render(f5);

this.rightelbow.render(f5);

this.rightarm.render(f5);

this.leftshoulder.render(f5);

this.leftforearm.render(f5);

this.leftelbow.render(f5);

this.leftarm.render(f5);

this.rightlegpreknee.render(f5);

this.rightknee.render(f5);

this.rightleg.render(f5);

this.leftlegpreknee.render(f5);

this.leftknee.render(f5);

this.leftleg.render(f5);

}

private void setRotation(ModelRenderer model, float x, float y, float z)

{

model.rotateAngleX = x;

model.rotateAngleY = y;

model.rotateAngleZ = z;

}

public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)

{

super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);

/*float f6 = (180F / (float)Math.PI);

this.head.rotateAngleX = f5 / (180F / (float)Math.PI);

this.head.rotateAngleY = f4 / (180F / (float)Math.PI);

this.body.rotateAngleX = ((float)Math.PI / 2F);*/

}

}

and here are the pics:

,
. What I am saying is clear if you look at its left shoulder. Thanks again

### Question about Techne

Hi all I am recently using Techne to create some new mobs.. I have created it, textured it, but when i try to render it in minecraft.. Well, the model appears correctly, there are no animations at the moment, everything normal, but there are some boxes of the model that in techne appear to be correctly rotated, but in game they are wrongly rotated. I was trying to remember if there was some kind of correction i had to do about angles from techne to minecraft.. And I am asking your help to remind me what the problem is Thanks in advance

### Question about slots and containers

Hello everyone. I'm not used to create containers, and i was wondering if there's a way to set which items can be put in a slot. As an example, I was trying to create a slot which only accepts water buckets. Thanks in advance.

### [1.7.10] Patching vanilla class

Why am I trying to do that? Because I need a new level of authentication and I need to modify the allowUserToConnect adding a call to my method

### [1.7.10] Patching vanilla class

Hello everyone,

I'm trying to get ServerConfigurationManager properly patched (using a ClassTransformer), but even if the class is correctly recognized by this method http://i.imgur.com/HsVBrh4.png and the patch method is called, the server does not seem to show any change.

I'm also patching another method of another class (that can be found both on client and server side) and it's perfectly working so I don't understand why this isn't  Emoticon unsure

No matter what I change of the target method of ServerConfigurationManager, I can't see any change when recompiled.

Moreover, the problem comes only when the source is recompiled, on a dev environment all gets patched.

Do you have any ideas about the solution/problem source?

### [1.7.10] Open GuiScreen on PlayerInteractEvent

Like he said, you are checking the server side. world.isRemote = Client !world.isRemote = Server. Also, are you trying to open a gui and set a TileEntity for a block? Because you're suppose to do that in the block class and then, make a GuiHandler to open it.

God, I feel stupid lol . I focused on the last lines and I forgot to check the first part.. Thanks for helping, man Next time I hope I'll be more careful

### [1.7.10] Open GuiScreen on PlayerInteractEvent

So, can you please have a look on these lines? I can't upload it on github for personal reasons, sorry

if (((event.world.getBlock(event.x, event.y, event.z) instanceof PNBlockBarrel))

&& (!event.world.isRemote)) {

PNTileEntityBarrel te = (PNTileEntityBarrel) event.world

.getTileEntity(event.x, event.y, event.z);

if (event.action == Action.RIGHT_CLICK_BLOCK) {

if (event.entityPlayer.getHeldItem() != (null)) {

if (new ItemStack(Items.water_bucket).getItem().equals(

event.entityPlayer.getHeldItem().getItem())

&& !te.isWaterLevelRight()) {

te.waterUsed();

if (!event.entityPlayer.capabilities.isCreativeMode) {

event.entityPlayer.setCurrentItemOrArmor(

0,

new ItemStack(Items.bucket, event.entityPlayer

.getHeldItem().stackSize));

}

event.world.markBlockForUpdate(event.x, event.y, event.z);

}

if (new ItemStack(Items.wheat).getItem().equals(

event.entityPlayer.getHeldItem().getItem())

&& !te.isWheatUsed() && te.getGrapesUsed() == 0) {

te.wheatUsed();

if (!event.entityPlayer.capabilities.isCreativeMode) {

event.entityPlayer.getHeldItem().stackSize--;

}

event.world.markBlockForUpdate(event.x, event.y, event.z);

}

if (new ItemStack(PNFoodRegistry.LuppoliItem).getItem().equals(

event.entityPlayer.getHeldItem().getItem())

&& event.entityPlayer.getHeldItem().getTagCompound()

.getInteger("STATE") != 0

&& !te.isHopsUsed()

&& te.getGrapesUsed() == 0) {

te.hopsUsed();

if (!event.entityPlayer.capabilities.isCreativeMode) {

event.entityPlayer.getHeldItem().stackSize--;

}

event.world.markBlockForUpdate(event.x, event.y, event.z);

}

if (new ItemStack(PNFoodRegistry.UvaItem).getItem().equals(

event.entityPlayer.getHeldItem().getItem())

&& event.entityPlayer.getHeldItem().getTagCompound()

.getInteger("STATE") != 0

&& !te.isGrapesUsed()

&& te.getWheatUsed() == 0 && te.getHopsUsed() == 0) {

te.grapesUsed();

if (!event.entityPlayer.capabilities.isCreativeMode) {

event.entityPlayer.getHeldItem().stackSize--;

}

event.world.markBlockForUpdate(event.x, event.y, event.z);

}

}

else {

System.out.println(event.entityPlayer.worldObj.isRemote);

event.entityPlayer.openGui(PNMod.instance, PNGuiHandler.idScreenBarrel, event.world, event.x, event.y, event.z);

}

}

}

I have put System.out.println as a sort of debug, and it prints false. I know that code isn't so good, but I'll clean it after first i need to sort the problem out If you can help me, it would be great

### [1.7.10] Open GuiScreen on PlayerInteractEvent

As the title says, i'm trying to open a GuiScreen from PlayerInteractEvent. I think the problem is that event.world is WorldServer, and that it doesn't open GuiScreen beacuse this type of Gui is only client side. I perfectly know that through onBlockActivated it works, but I'm curious to know if what I'm asking is possible Thanks in advance, bros.

### NBT Crafting & Smelting

Not asking about changin' it I fully understand, this was my last try.. You'll find it very strange, but i hate metadata. I don't know why, but I hate it. However, I have to use it.. Thanks for such a fast answer, man

### NBT Crafting & Smelting

I asked not to say such things lel I'm asking beacuse I know it's nearly impossible, but there will be a way.. There must be a way.. How could no one think about this possibility?

### NBT Crafting & Smelting

Hi all, guys. This is THEDoctor. I'll be straight to the point

I'm currently developing a mod, that includes items that, through NBTs, gets rot or saved with items. I've successfully implemented such thing, but there's a problem.. Following the logic behind the mod, you should be able to craft, for example, a saved item through a normal item(it is going to decay but it is not rot) and salt. And for furnaces, for example, only normal meat can be cooked, and not the one decayed. I know there are and there were other topics about such question, but no one of them  had an answer to solve it.. Pls, don't say things like "You can't do it" or "Change everything", beacuse it's very useless

Thanks in advance

×

• #### Activity

×
• Create New...

## Important Information

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