Grinder block

12 posts / 0 new
Last post
Offline
Last seen: 1 year 2 months ago
Joined: 04/04/2015 - 13:30
Gems: 0
Grinder block

Hey!

So I was making a block (techne model here : http://techne.zeux.me/3a001d9#6080) and the general idea of it is to double ores. So here are my questions/problems:

a) I want to make it so that after a while the lava disappears and you have to use another bucket on it to reactivate it (otherwise it wont grind) - id like to do this with out having to replace the block (if there's a way) and prefferably make it so the lava texture disappears

b) Now I haven't really investigated this one. I'm intrested if I can make it so that upon right click it will consume any and all ores from your inventory and give you 2 dust in return- but only do this if you have it in your inventory. Now the thing I thought would happen you for ex. use gold ore and you get back 2 iron dust - so is there a way to make it so you'd get gold for gold and iron for iron and etc.?

 

Sorry for any grammar mistakes. Thanks in advance!



Offline
Last seen: 1 year 3 weeks ago
Joined: 02/18/2014 - 07:48
Gems: 0
A)

A)
First of all have 5 or so different grinder block
1 - first one with no lava
2 - second one with a 1/4 of lava
3 - third one with a 1/2 of lava
4 - fourth one with a 3/4 of lava
5 - fifth one with full lava

Then with the first one (no lava) set a event saying on right click with player holding lava bucket, add block at i, j, k, then add the second block(1/4 lava)

With the second one (1/4 lava) set a event saying on right click with player holding lava bucket, add block at i, j, k, then add the third block(1/2 lava)
Also with the second block set a event saying every tick have a 3%(doesn't really matter, depends on how often you want the lava to go back down) chance of add block at i, j, k, then add the first block(no lava)

With the third one (1/2 lava) set a event saying on right click with player holding lava bucket, add block at i, j, k, then add the fourth block(3/4 lava)
Also with the third block set a event saying every tick have a 3%(doesn't really matter, depends on how often you want the lava to go back down) chance of add block at i, j, k, then add the second block(1/4 lava)

With the fourth one (3/4 lava) set a event saying on right click with player holding lava bucket, add block at i, j, k, then add the fifth block(filled lava)
Also with the fourth block set a event saying every tick have a 3%(doesn't really matter, depends on how often you want the lava to go back down) chance of add block at i, j, k, then add the third block(1/2 lava)

With the fifth block set a event saying every tick have a 3%(doesn't really matter, depends on how often you want the lava to go back down) chance of add block at i, j, k, then add the fourth block(no lava)

B)
Sadly this should simple but the events for adding items don't work so its impossible
:( the only way to give a player items is to create a new block, for example a block named 'grinded ore block' and set its drop to the items so when a person grinds a ore you can set the grinded ore block to appear and the player can break it but that's about it, I know its not a ideal solution but sadly its the only way to work. This problem has prevented my mod from working and I looked into it so much and unless I can find out how to code a block to drop multiple items My mod screwed even though depending what you want I could help you with getting the best out of using a block to drop the items you wanna give the player

Offline
Last seen: 1 year 3 weeks ago
Joined: 02/18/2014 - 07:48
Gems: 0
Btw, Nice Model :)

Btw, Nice Model :)

Offline
Last seen: 1 year 2 months ago
Joined: 04/04/2015 - 13:30
Gems: 0
Massive thanks! Cheers dude!

Massive thanks! Cheers dude!

Offline
Last seen: 1 year 3 weeks ago
Joined: 02/18/2014 - 07:48
Gems: 0
No Problem

No Problem

Offline
Last seen: 1 year 2 months ago
Joined: 04/04/2015 - 13:30
Gems: 0
So I tried to make the block

So I tried to make the block but I got an error...
Here's the block code (just tried the active one for now with out any of the options to see if the block will actually work)

Spoiler: Highlight to view
package mod.mcreator;//based on master condiguration

import cpw.mods.fml.client.*;
import cpw.mods.fml.client.registry.*;
import cpw.mods.fml.common.*;
import cpw.mods.fml.common.asm.*;
import cpw.mods.fml.common.asm.transformers.*;
import cpw.mods.fml.common.discovery.*;
import cpw.mods.fml.common.discovery.asm.*;
import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.functions.*;
import cpw.mods.fml.common.network.*;
import cpw.mods.fml.common.registry.*;
import cpw.mods.fml.common.toposort.*;
import cpw.mods.fml.common.versioning.*;
import cpw.mods.fml.relauncher.*;
import cpw.mods.fml.server.*;
import net.minecraft.block.*;
import net.minecraft.block.material.*;
import net.minecraft.client.*;
import net.minecraft.client.audio.*;
import net.minecraft.client.entity.*;
import net.minecraft.client.gui.*;
import net.minecraft.client.gui.achievement.*;
import net.minecraft.client.gui.inventory.*;
import net.minecraft.client.model.*;
import net.minecraft.client.multiplayer.*;
import net.minecraft.client.particle.*;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.culling.*;
import net.minecraft.client.renderer.entity.*;
import net.minecraft.client.renderer.tileentity.*;
import net.minecraft.client.settings.*;
import net.minecraft.command.*;
import net.minecraft.crash.*;
import net.minecraft.creativetab.*;
import net.minecraft.dispenser.*;
import net.minecraft.enchantment.*;
import net.minecraft.entity.*;
import net.minecraft.entity.ai.*;
import net.minecraft.entity.boss.*;
import net.minecraft.entity.effect.*;
import net.minecraft.entity.item.*;
import net.minecraft.entity.monster.*;
import net.minecraft.entity.passive.*;
import net.minecraft.entity.player.*;
import net.minecraft.entity.projectile.*;
import net.minecraft.inventory.*;
import net.minecraft.item.*;
import net.minecraft.item.crafting.*;
import net.minecraft.nbt.*;
import net.minecraft.network.*;
import net.minecraft.network.rcon.*;
import net.minecraft.pathfinding.*;
import net.minecraft.potion.*;
import net.minecraft.profiler.*;
import net.minecraft.server.*;
import net.minecraft.server.dedicated.*;
import net.minecraft.server.gui.*;
import net.minecraft.server.integrated.*;
import net.minecraft.server.management.*;
import net.minecraft.src.*;
import net.minecraft.stats.*;
import net.minecraft.tileentity.*;
import net.minecraft.util.*;
import net.minecraft.village.*;
import net.minecraft.world.*;
import net.minecraft.world.biome.*;
import net.minecraft.world.chunk.*;
import net.minecraft.world.chunk.storage.*;
import net.minecraft.world.demo.*;
import net.minecraft.world.gen.*;
import net.minecraft.world.gen.feature.*;
import net.minecraft.world.gen.layer.*;
import net.minecraft.world.gen.structure.*;
import net.minecraft.world.storage.*;
import net.minecraftforge.classloading.*;
import net.minecraftforge.client.*;
import net.minecraftforge.client.event.*;
import net.minecraftforge.client.event.sound.*;
import net.minecraftforge.common.*;
import net.minecraftforge.event.*;
import net.minecraftforge.event.entity.*;
import net.minecraftforge.event.entity.item.*;
import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.minecart.*;
import net.minecraftforge.event.entity.player.*;
import net.minecraftforge.event.terraingen.*;
import net.minecraftforge.event.world.*;
import net.minecraftforge.oredict.*;
import net.minecraftforge.transformers.*;
import net.minecraft.init.*;
import java.util.*;

import net.minecraftforge.common.util.*;
import net.minecraft.client.renderer.texture.*;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
public class mcreator_grinder {

public mcreator_grinder(){}

public static BlockGrinder block;

public static Object instance;public int addFuel(ItemStack fuel){return 0;}
public void serverLoad(FMLServerStartingEvent event){}
public void preInit(FMLPreInitializationEvent event){

GameRegistry.registerBlock(block, "Grinder");
}
public void registerRenderers(){ClientRegistry.bindTileEntitySpecialRenderer(mcreator_grinder.TileEntityCustom.class, new mcreator_grinder.TileEntityCustomRenderer());}
public void load(){
GameRegistry.registerTileEntity(mcreator_grinder.TileEntityCustom.class, "tileEntityGrinder");
GameRegistry.addRecipe(new ItemStack(block, 1), new Object[]{
"012", "345", "678", Character.valueOf('0'), new ItemStack(Items.lava_bucket, 1), Character.valueOf('1'), new ItemStack(Blocks.obsidian, 1), Character.valueOf('2'), new ItemStack(Blocks.log, 1), Character.valueOf('3'), new ItemStack(Items.water_bucket, 1), Character.valueOf('4'), new ItemStack(Blocks.log, 1), Character.valueOf('5'), new ItemStack(Blocks.obsidian, 1), Character.valueOf('6'), new ItemStack(Blocks.stone, 1), Character.valueOf('7'), new ItemStack(Blocks.redstone_block, 1), Character.valueOf('8'), new ItemStack(Blocks.stone, 1),
});
}

static{

block = (BlockGrinder)(new BlockGrinder().setHardness(4.0F)
.setResistance(20.0F)
.setLightLevel(0.0F)
.setBlockName("Grinder")
.setBlockTextureName("furnacefront")
.setLightOpacity(0)
.setStepSound(Block.soundTypeStone)
.setCreativeTab(mcreator_tabDarknessGathers.tab)
);block.setBlockBounds(0.0F,0.0F,0.0F,1.0F,1.0F,1.0F);
Block.blockRegistry.addObject(188, "Grinder", block);
block.setHarvestLevel("pickaxe", 0);
}

public void generateSurface(World world, Random random, int chunkX, int chunkZ){}
public void generateNether(World world, Random random, int chunkX, int chunkZ){}
static class BlockGrinder extends BlockContainer
{

int a1 = 0,a2 = 0,a3 = 0,a4 = 0,a5 = 0,a6 = 0;

IIcon gor = null, dol = null, st1 = null, st2 = null, st3 = null, st4 = null;

boolean red = false;

protected BlockGrinder()
{
super(Material.ground);

}

public void onBlockAdded(World world, int i, int j, int k){
EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
if(entity!=null&&world!=null){
int le = MathHelper.floor_double((double)(entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
world.setBlockMetadataWithNotify(i, j, k, le, 2);
}

world.scheduleBlockUpdate(i, j, k, this, this.tickRate(world));

}
public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5){
return red?1:0;
}
public void randomDisplayTick(World world, int i, int j, int k, Random random){
EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
World par1World = world;
int par2 = i;
int par3 = j;
int par4 = k;
Random par5Random = random;
if(true)
for (int la = 0; la < 4; ++la)
{
int l = par1World.getBlockMetadata(par2, par3, par4);
double d0 = (double)((float)par2 + 0.5F) + (double)(par5Random.nextFloat() - 0.5F) * 0.5D;
double d1 = ((double)((float)par3 + 0.7F) + (double)(par5Random.nextFloat() - 0.5F) * 0.5D)+0.5D;
double d2 = (double)((float)par4 + 0.5F) + (double)(par5Random.nextFloat() - 0.5F) * 0.5D;
double d3 = 0.2199999988079071D;
double d4 = 0.27000001072883606D;

if (l == 1)
{
par1World.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
}
else if (l == 2)
{
par1World.spawnParticle("smoke", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
}
else if (l == 3)
{
par1World.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
}
else if (l == 4)
{
par1World.spawnParticle("smoke", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
}
else
{
par1World.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
}
}

}
@Override public TileEntity createNewTileEntity(World var1, int var2){return new TileEntityCustom();}
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(int i, int par2){

if (i == 0)
return gor;

else if (i == 1)
return dol;

else if (i == 2)
return st1;

else if (i == 3)
return st2;

else if (i == 4)
return st4;

else if (i == 5)
return st3;

else
return gor;

}

@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister reg){
this.gor = reg.registerIcon("furnacefront");
this.dol = reg.registerIcon("furnacefront");
this.st1 = reg.registerIcon("furnacefront");
this.st2 = reg.registerIcon("furnacefront");
this.st3 = reg.registerIcon("furnacefront");
this.st4 = reg.registerIcon("furnacefront");
}
public boolean isOpaqueCube()
{
return false;
}

public boolean renderAsNormalBlock()
{
return false;
}

public int getRenderType(){
return -1;
}
@Override
public int tickRate(World world)
{
return 10;
}

public int quantityDropped(Random par1Random){
return 1;
}

}
public static class TileEntityCustom extends TileEntity {}
public static class TileEntityCustomRenderer extends TileEntitySpecialRenderer {
private final Modelgrinder model;
public TileEntityCustomRenderer() {this.model = new Modelgrinder();}
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
GL11.glPushMatrix();
GL11.glTranslatef((float)x+0.5F, (float)y+1.0F, (float)z+0.5F);
ResourceLocation textures = (new ResourceLocation("grinder.png"));
Minecraft.getMinecraft().renderEngine.bindTexture(textures);
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glPushMatrix();
GL11.glRotatef(te.getBlockMetadata() * 90, 0.0F, 1.0F, 0.0F);
this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
GL11.glPopMatrix();
GL11.glPopMatrix();
GL11.glPopMatrix();}
}

// Date: 19.04.2015 10:57:00
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX

public static class ModelGrinder extends ModelBase
{
//fields
ModelRenderer Base;
ModelRenderer backgroundrod;
ModelRenderer frontfuelrod;
ModelRenderer backgroundglass;
ModelRenderer frontglass;
ModelRenderer backplating;
ModelRenderer frontplate;
ModelRenderer uppergrinder;
ModelRenderer lowergrindertilted;
ModelRenderer lowergrinder;
ModelRenderer uppergrindertilted;

public ModelGrinder()
{
textureWidth = 128;
textureHeight = 64;

Base = new ModelRenderer(this, 0, 0);
Base.addBox(-8F, 0F, -8F, 16, 1, 16);
Base.setRotationPoint(0F, 23F, 0F);
Base.setTextureSize(128, 64);
Base.mirror = true;
setRotation(Base, 0F, 0F, 0F);
backgroundrod = new ModelRenderer(this, 0, 57);
backgroundrod.addBox(-2.5F, 0F, -2.5F, 5, 2, 5);
backgroundrod.setRotationPoint(-5F, 21F, 4F);
backgroundrod.setTextureSize(128, 64);
backgroundrod.mirror = true;
setRotation(backgroundrod, 0F, 0F, 0F);
frontfuelrod = new ModelRenderer(this, 0, 57);
frontfuelrod.addBox(-2.5F, 0F, -2.5F, 5, 2, 5);
frontfuelrod.setRotationPoint(-5F, 21F, -4F);
frontfuelrod.setTextureSize(128, 64);
frontfuelrod.mirror = true;
setRotation(frontfuelrod, 0F, 0F, 0F);
backgroundglass = new ModelRenderer(this, 16, 20);
backgroundglass.addBox(-1.5F, 0F, -1.5F, 3, 9, 3);
backgroundglass.setRotationPoint(-5F, 12F, 4F);
backgroundglass.setTextureSize(128, 64);
backgroundglass.mirror = true;
setRotation(backgroundglass, 0F, 0F, 0F);
frontglass = new ModelRenderer(this, 0, 20);
frontglass.addBox(-1.5F, 0F, -1.5F, 3, 9, 3);
frontglass.setRotationPoint(-5F, 12F, -4F);
frontglass.setTextureSize(128, 64);
frontglass.mirror = true;
setRotation(frontglass, 0F, 0F, 0F);
backplating = new ModelRenderer(this, 0, 35);
backplating.addBox(-4F, 0F, 0F, 8, 13, 1);
backplating.setRotationPoint(3F, 10F, 6F);
backplating.setTextureSize(128, 64);
backplating.mirror = true;
setRotation(backplating, 0F, 0F, 0F);
frontplate = new ModelRenderer(this, 0, 35);
frontplate.addBox(-4F, 0F, 0F, 8, 13, 1);
frontplate.setRotationPoint(3F, 10F, -7F);
frontplate.setTextureSize(128, 64);
frontplate.mirror = true;
setRotation(frontplate, 0F, 0F, 0F);
uppergrinder = new ModelRenderer(this, 85, 0);
uppergrinder.addBox(-2F, 0F, -2F, 4, 12, 4);
uppergrinder.setRotationPoint(3F, 14F, -6F);
uppergrinder.setTextureSize(128, 64);
uppergrinder.mirror = true;
setRotation(uppergrinder, 1.570796F, 0F, 0F);
lowergrindertilted = new ModelRenderer(this, 85, 0);
lowergrindertilted.addBox(-2F, 0F, -2F, 4, 12, 4);
lowergrindertilted.setRotationPoint(3F, 14F, -6F);
lowergrindertilted.setTextureSize(128, 64);
lowergrindertilted.mirror = true;
setRotation(lowergrindertilted, 1.570796F, 0F, 0.7853982F);
lowergrinder = new ModelRenderer(this, 85, 0);
lowergrinder.addBox(-2F, 0F, -2F, 4, 12, 4);
lowergrinder.setRotationPoint(3F, 20F, -6F);
lowergrinder.setTextureSize(128, 64);
lowergrinder.mirror = true;
setRotation(lowergrinder, 1.570796F, 0F, 0F);
uppergrindertilted = new ModelRenderer(this, 85, 0);
uppergrindertilted.addBox(-2F, 0F, -2F, 4, 12, 4);
uppergrindertilted.setRotationPoint(3F, 20F, -6F);
uppergrindertilted.setTextureSize(128, 64);
uppergrindertilted.mirror = true;
setRotation(uppergrindertilted, 1.570796F, 0F, 0.7853982F);
}

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);

Base.render(f5);
backgroundrod.render(f5);
frontfuelrod.render(f5);
backgroundglass.render(f5);
frontglass.render(f5);
backplating.render(f5);
frontplate.render(f5);
uppergrinder.render(f5);
lowergrindertilted.render(f5);
lowergrinder.render(f5);
uppergrindertilted.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 e)

{
super.setRotationAngles(f, f1, f2, f3, f4, f5, e);
}

}}

Offline
Last seen: 1 year 3 weeks ago
Joined: 02/18/2014 - 07:48
Gems: 0
Sorry Im not so good with

Sorry Im not so good with coding, can you explain what you did?

Offline
Last seen: 1 year 2 months ago
Joined: 04/04/2015 - 13:30
Gems: 0
This is what I get for not

This is what I get for not reading properly. When you enter the name of the techne model I thought I had to enter the name of the JAVA model - so I checked me techne model and the names were different - changed it now and recompiling worked :P just hoping duplication works as well :D

Offline
Last seen: 1 year 3 weeks ago
Joined: 02/18/2014 - 07:48
Gems: 0
Ok Good For You :D Btw whats

Ok Good For You :D Btw whats your mod called? this way ill know what to download ;)

Offline
Last seen: 1 year 2 months ago
Joined: 04/04/2015 - 13:30
Gems: 0
No official name atm but I

No official name atm but I think "Darkness Gathers" is a good idea :)

Offline
Last seen: 2 years 1 week ago
Joined: 03/31/2015 - 13:31
Gems: 0
RE:No official name atm but I

@LeBadWolf Tell me when you will release it, I want to download it.

Pages