That's almost exactly what I have and it's not working. The only differences in our code is that you called it setDefaultDirection and I called it direction, and the fact that I have the wrong sets of blocks in said method. But even then, it should be rotated.
EDIT: I copied and pasted your code into mine and adjusted it accordingly and nothing happened. The block stays the same direction, facing north, with the textures correct, but the rotation incorrect.
Hello all. I've come here today looking for help for something that seems really simple but I can't make happen. I just want my block to rotate to the direction I'm facing. I've looked into the blockFurnace class and I've read the numerous posts just like mine that say to do the same things. I've done that. Here is my code:
public class MachineFurnace extends BlockContainer{
private IIcon top;
public MachineFurnace() {
super(Material.rock);
setBlockName("machineFurnace");
setCreativeTab(CreativeTabs.tabDecorations);
}
public IIcon getIcon(int dir, int meta){
return dir == 2 ? top:this.blockIcon;
}
public void registerBlockIcons(IIconRegister reg){
top = reg.registerIcon(Reference.MODID + ":" + "machineAnnihilator_front");
this.blockIcon = reg.registerIcon(Reference.MODID + ":" + "crudeMachineBlock");
}
@SideOnly(Side.CLIENT)
public void onBlockAdded(World world, int x, int y, int z){
super.onBlockAdded(world, x, y, z);
this.direction(world,x,y,z);
}
public void direction(World world, int x, int y, int z){
if(!world.isRemote){
Block direction = world.getBlock(x, y, z - 1);
Block direction1 = world.getBlock(x, y, z + 1);
Block direction2 = world.getBlock(x - 1, y, z);
Block direction3 = world.getBlock(x + 1, y, z);
byte byte0 = 3;
if (direction.func_149730_j() && direction.func_149730_j()) {
byte0 = 3;
}
if (direction1.func_149730_j() && direction1.func_149730_j()) {
byte0 = 2;
}
if (direction2.func_149730_j() && direction2.func_149730_j()) {
byte0 = 5;
}
if (direction3.func_149730_j() && direction3.func_149730_j()) {
byte0 = 4;
}
world.setBlockMetadataWithNotify(x, y, z, byte0, 2);
}
}
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack itemstack) {
int direction = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
System.out.println(direction);
if (direction == 0) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
if (direction == 1) {
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
}
if (direction == 2) {
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
if (direction == 3) {
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
}
if (itemstack.hasDisplayName()) {
((TileEntityAnnihilator) world.getTileEntity(x, y, z)).setInventoryName(itemstack.getDisplayName());
}
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileEntityAnnihilator();
}
}
*Note that I know some of that is cross coded but I just made this block to test if I could get it to rotate, not actually do anything.
What am I doing wrong here? I have the onBlockAdded method and direction method (even though I have NO idea what that does, and for all I know is just THERE), plus I have my onBlockPlacedBy method. I have the proper yaw function according to BlockFurnace. I honestly have no clue. please tell me it's something super simple I'm doing wrong.
just a few words... go to hippoplatimus' piston mod page. it was originally made before pistons came out but he kept it up due to the current vanilla pistons effects. Those ones work the way you want them to.
Can someone please point me in the right direction for a tutorial that can teach me on how to build a mob in java, because techne doesnt want to work on my comp, and any other 3d software is to laggy, due to me not having a good vid card..
Hey everybody, i made a mod that spawns a new tree but whenever i THINK i come into rendering range, the minecraft crashes and i get an error report saying there was an error in EntityRenderProxy, line 14, which is the line right after the constructor starting line
MC Extended is a mod - you would have to check the thread for more about that. However, if you are working on a mod for release, keep in mind that other people may not have MC Extended. Of course, you should not hard-code IDs - provide a default (<256) value and a config so users can change them to avoid conflicts.
The 0-255 limit is one of the biggest sources of frustration most modders have to deal with. (The exception being modders who don't create blocks, of course.)
p.s. I don't know if you can add MC Extended and then decompile in MCP. MCP doesn't always deal well with modded jars.
wow, that is odd, it did work as far as i can tell, so with the mc extended can i just put that into the jar file and decompile as usual or do i have to do something special?
Caused by: java.lang.ArrayIndexOutOfBoundsException: 400
at uu.<init>(SourceFile:243)
at uu.<init>(SourceFile:265) at BlockMushroomStem.<init>(BlockMushroomStem.java:8) at mod_UndergroundRevamped.<clinit>(mod_UndergroundRevamped.java:7)
... 15 more
0
That's almost exactly what I have and it's not working. The only differences in our code is that you called it setDefaultDirection and I called it direction, and the fact that I have the wrong sets of blocks in said method. But even then, it should be rotated.
EDIT: I copied and pasted your code into mine and adjusted it accordingly and nothing happened. The block stays the same direction, facing north, with the textures correct, but the rotation incorrect.
0
Hello all. I've come here today looking for help for something that seems really simple but I can't make happen. I just want my block to rotate to the direction I'm facing. I've looked into the blockFurnace class and I've read the numerous posts just like mine that say to do the same things. I've done that. Here is my code:
package com.neo.stuff.blocks.machines;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import com.neo.stuff.tileentities.TileEntityAnnihilator;
import com.neo.stuff.utility.Reference;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class MachineFurnace extends BlockContainer{
private IIcon top;
public MachineFurnace() {
super(Material.rock);
setBlockName("machineFurnace");
setCreativeTab(CreativeTabs.tabDecorations);
}
public IIcon getIcon(int dir, int meta){
return dir == 2 ? top:this.blockIcon;
}
public void registerBlockIcons(IIconRegister reg){
top = reg.registerIcon(Reference.MODID + ":" + "machineAnnihilator_front");
this.blockIcon = reg.registerIcon(Reference.MODID + ":" + "crudeMachineBlock");
}
@SideOnly(Side.CLIENT)
public void onBlockAdded(World world, int x, int y, int z){
super.onBlockAdded(world, x, y, z);
this.direction(world,x,y,z);
}
public void direction(World world, int x, int y, int z){
if(!world.isRemote){
Block direction = world.getBlock(x, y, z - 1);
Block direction1 = world.getBlock(x, y, z + 1);
Block direction2 = world.getBlock(x - 1, y, z);
Block direction3 = world.getBlock(x + 1, y, z);
byte byte0 = 3;
if (direction.func_149730_j() && direction.func_149730_j()) {
byte0 = 3;
}
if (direction1.func_149730_j() && direction1.func_149730_j()) {
byte0 = 2;
}
if (direction2.func_149730_j() && direction2.func_149730_j()) {
byte0 = 5;
}
if (direction3.func_149730_j() && direction3.func_149730_j()) {
byte0 = 4;
}
world.setBlockMetadataWithNotify(x, y, z, byte0, 2);
}
}
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack itemstack) {
int direction = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
System.out.println(direction);
if (direction == 0) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
if (direction == 1) {
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
}
if (direction == 2) {
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
if (direction == 3) {
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
}
if (itemstack.hasDisplayName()) {
((TileEntityAnnihilator) world.getTileEntity(x, y, z)).setInventoryName(itemstack.getDisplayName());
}
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileEntityAnnihilator();
}
}
*Note that I know some of that is cross coded but I just made this block to test if I could get it to rotate, not actually do anything.
What am I doing wrong here? I have the onBlockAdded method and direction method (even though I have NO idea what that does, and for all I know is just THERE), plus I have my onBlockPlacedBy method. I have the proper yaw function according to BlockFurnace. I honestly have no clue. please tell me it's something super simple I'm doing wrong.
0
0
0
i have already made mods, and i know HOW to mod, idk about mobs though, so thanks for at least giving me a starter point for that
0
0
yes, but i think people dont think on purpose... or even read the rules, or anything, just to MAKE people hate them...
0
0
0
alright, thanks, i will do that.
0
0
then why is it that when i use any above 500 on my mods and i use modloader, it works just perfectly?
0
why not? shouldnt modloader fix that? or is it something specific to the number 400?
0
0
both of those are the starting { in the code