
SuperLuke
Members-
Posts
23 -
Joined
-
Last visited
Converted
-
Gender
Undisclosed
-
Personal Text
I am new!
SuperLuke's Achievements

Tree Puncher (2/8)
0
Reputation
-
i have other blocks that work just fine l have multiple versions of sand and planks it's just the logs that don't work. so i still have to move my "common code" over to the client proxy
-
this is in my main file in preinit ModBlocks.inti(); ModBlocks.register(); modblocks file info public static void register() { GameRegistry.registerBlock(l = new ModdedLogs(), ItemBlockMeta.class,"modlogs").setUnlocalizedName("modlogs"); } reg(ModBlocks.l, 0, "darkwood"); reg(ModBlocks.l, 1, "corwood"); public static void reg(Block block, int meta, String file) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(Item.getItemFromBlock(block), meta, new ModelResourceLocation("mymod:" + file, "inventory")); } proxy public class ClientProxy extends CommonProxy { @Override public void preInit( FMLPreInitializationEvent event ) { super.preInit(event); ModEntities.RegisterEntity(); } @Override public void init( FMLInitializationEvent event ) { ModBlocks.registerRenders(); } @Override public void postInit( FMLPostInitializationEvent event ) { super.postInit(event); } }
-
i've been doing a lot of testing and i actually have multiple blockstate files i don't know which one is being called so here they are darkwood.json { "variants": { "normal": { "model": "mymod:DarkStone" } } } darkwood_modlogs.json { "variants": { "axis=y": { "model": "acacia_log" }, "axis=z": { "model": "acacia_log", "x": 90 }, "axis=x": { "model": "acacia_log", "x": 90, "y": 90 }, "axis=none": { "model": "acacia_bark" } } } modlogs.json { "variants": { "variant=darkwood": { "axis=y": { "model": "acacia_log" }, "axis=z": { "model": "acacia_log", "x": 90 }, "axis=x": { "model": "acacia_log", "x": 90, "y": 90 }, "axis=none": { "model": "acacia_bark" } } } }
-
I can't seem to figure out how to make my log display a texture here's an error message: Exception loading blockstate for the variant mymod:modlogs#axis=z,variant=corwood: java.lang.Exception: Could not load model definition for variant mymod:modlogs and here are the classes for my custom log: Logs package mymod.blocks; import java.util.List; import javax.annotation.Nullable; import net.minecraft.block.BlockLog; import net.minecraft.block.material.MapColor; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import com.google.common.base.Predicate; public class ModdedLogs extends BlockLog implements IMetaBlockName { public static final PropertyEnum<ModdedPlanks.EnumType> VARIANT = PropertyEnum.<ModdedPlanks.EnumType>create("variant", ModdedPlanks.EnumType.class, new Predicate<ModdedPlanks.EnumType>() { public boolean apply(@Nullable ModdedPlanks.EnumType p_apply_1_) { return p_apply_1_.getMetadata() < 4; } }); public ModdedLogs() { this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, ModdedPlanks.EnumType.Dark).withProperty(LOG_AXIS, BlockLog.EnumAxis.Y)); } /** * Get the MapColor for this Block and the given BlockState */ public MapColor getMapColor(IBlockState state) { ModdedPlanks.EnumType blockplanks$enumtype = (ModdedPlanks.EnumType)state.getValue(VARIANT); switch ((BlockLog.EnumAxis)state.getValue(LOG_AXIS)) { case X: case Z: case NONE: default: switch (blockplanks$enumtype) { case Dark: default: return ModdedPlanks.EnumType.Dark.getMapColor(); case Corrupted: return ModdedPlanks.EnumType.Corrupted.getMapColor(); } case Y: return blockplanks$enumtype.getMapColor(); } } /** * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) */ @SideOnly(Side.CLIENT) public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) { list.add(new ItemStack(itemIn, 1, ModdedPlanks.EnumType.Dark.getMetadata())); list.add(new ItemStack(itemIn, 1, ModdedPlanks.EnumType.Corrupted.getMetadata())); } /** * Convert the given metadata into a BlockState for this Block */ public IBlockState getStateFromMeta(int meta) { IBlockState iblockstate = this.getDefaultState().withProperty(VARIANT, ModdedPlanks.EnumType.byMetadata((meta & 3) + 4)); switch (meta & 12) { case 0: iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y); break; case 4: iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.X); break; case 8: iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z); break; default: iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.NONE); } return iblockstate; } /** * Convert the BlockState into the correct metadata value */ @SuppressWarnings("incomplete-switch") public int getMetaFromState(IBlockState state) { int i = 0; i = i | ((ModdedPlanks.EnumType)state.getValue(VARIANT)).getMetadata(); switch ((BlockLog.EnumAxis)state.getValue(LOG_AXIS)) { case X: i |= 4; break; case Z: i |= 8; break; case NONE: i |= 12; } return i; } protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] {VARIANT, LOG_AXIS}); } protected ItemStack createStackedBlock(IBlockState state) { return new ItemStack(Item.getItemFromBlock(this), 1, ((ModdedPlanks.EnumType)state.getValue(VARIANT)).getMetadata()); } /** * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It * returns the metadata of the dropped item based on the old metadata of the block. */ public int damageDropped(IBlockState state) { return ((ModdedPlanks.EnumType)state.getValue(VARIANT)).getMetadata(); } @Override public String getSpecialName(ItemStack stack) { // TODO Auto-generated method stub return stack.getItemDamage() == 0 ? "white" : "black"; } } Planks package mymod.blocks; import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IStringSerializable; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class ModdedPlanks extends Block implements IMetaBlockName { public static final PropertyEnum<ModdedPlanks.EnumType> VARIANT = PropertyEnum.<ModdedPlanks.EnumType>create("variant", ModdedPlanks.EnumType.class); public ModdedPlanks() { super(Material.WOOD); this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, ModdedPlanks.EnumType.Dark)); this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS); } /** * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It * returns the metadata of the dropped item based on the old metadata of the block. */ public int damageDropped(IBlockState state) { return ((ModdedPlanks.EnumType)state.getValue(VARIANT)).getMetadata(); } /** * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) */ @SideOnly(Side.CLIENT) public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) { for (ModdedPlanks.EnumType blockplanks$enumtype : ModdedPlanks.EnumType.values()) { list.add(new ItemStack(itemIn, 1, blockplanks$enumtype.getMetadata())); } } /** * Convert the given metadata into a BlockState for this Block */ @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(VARIANT, ModdedPlanks.EnumType.byMetadata(meta)); } /** * Get the MapColor for this Block and the given BlockState */ public MapColor getMapColor(IBlockState state) { return ((ModdedPlanks.EnumType)state.getValue(VARIANT)).getMapColor(); } /** * Convert the BlockState into the correct metadata value */ @Override public int getMetaFromState(IBlockState state) { return ((ModdedPlanks.EnumType)state.getValue(VARIANT)).getMetadata(); } protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] {VARIANT}); } public static enum EnumType implements IStringSerializable { Dark(0, "darkwood", MapColor.WOOD), Corrupted(1, "corwood", MapColor.OBSIDIAN); private static final ModdedPlanks.EnumType[] META_LOOKUP = new ModdedPlanks.EnumType[values().length]; private final int meta; private final String name; private final String unlocalizedName; /** The color that represents this entry on a map. */ private final MapColor mapColor; private EnumType(int metaIn, String nameIn, MapColor mapColorIn) { this(metaIn, nameIn, nameIn, mapColorIn); } private EnumType(int metaIn, String nameIn, String unlocalizedNameIn, MapColor mapColorIn) { this.meta = metaIn; this.name = nameIn; this.unlocalizedName = unlocalizedNameIn; this.mapColor = mapColorIn; System.out.println(nameIn); } public int getMetadata() { return this.meta; } /** * The color which represents this entry on a map. */ public MapColor getMapColor() { return this.mapColor; } public String toString() { return this.name; } public static ModdedPlanks.EnumType byMetadata(int meta) { if (meta < 0 || meta >= META_LOOKUP.length) { meta = 0; } return META_LOOKUP[meta]; } @Override public String getName() { return this.name; } public String getUnlocalizedName() { return this.unlocalizedName; } static { for (ModdedPlanks.EnumType blockplanks$enumtype : values()) { META_LOOKUP[blockplanks$enumtype.getMetadata()] = blockplanks$enumtype; } } } @Override public String getSpecialName(ItemStack stack) { return stack.getItemDamage() == 0 ? "white" : "black"; } } it's most likely i have something named wrong, but i can't find what that would be.
-
oh, yeah my apologies. here you go, and i'm aware that my code may not make sense i'm a little uncertain on how Capabilities and nbt writing and reading works Main file: /* PROXY INFO */ @SidedProxy(clientSide = "mymod.proxies.ClientProxy", serverSide = "mymod.proxies.CommonProxy") public static CommonProxy proxy; @CapabilityInject(mymod.events.Capability.CorTimer.class) public static final Capability<mymod.events.Capability.CorTimer> TIMER = null; proxy code : public class ClientProxy extends CommonProxy { @Override public void preInit( FMLPreInitializationEvent event ) { super.preInit(event); ModEntities.RegisterEntity(); } @Override public void init( FMLInitializationEvent event ) { ModItems.registerRenders(); ModBlocks.registerRenders(); } @Override public void postInit( FMLPostInitializationEvent event ) { super.postInit(event); } } and the Capability code: package mymod.events; import java.util.Random; import mymod.Main; import mymod.inti.ModBlocks; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.passive.IAnimals; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTBase.NBTPrimitive; import net.minecraft.nbt.NBTTagInt; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.ICapabilitySerializable; import net.minecraftforge.common.capabilities.Capability.IStorage; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.player.PlayerWakeUpEvent; import net.minecraftforge.event.entity.player.SleepingLocationCheckEvent; import net.minecraftforge.fml.common.eventhandler.Event.Result; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class Capability { @SubscribeEvent public void onEntityConstruct(AttachCapabilitiesEvent.Entity evt) { evt.addCapability(new ResourceLocation(Main.MODID, "IExtraSleeping"), new ICapabilitySerializable<NBTPrimitive>() { CorTimer inst = Main.TIMER.getDefaultInstance(); @Override public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, EnumFacing facing) { return capability == Main.TIMER; } @Override public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, EnumFacing facing) { return capability == Main.TIMER ? Main.TIMER.<T>cast(inst): null; } @Override public NBTPrimitive serializeNBT() { return (NBTPrimitive)Main.TIMER.getStorage().writeNBT(Main.TIMER, inst, null); } @Override public void deserializeNBT(NBTPrimitive nbt) { Main.TIMER.getStorage().readNBT(Main.TIMER, inst, null, nbt); } }); } public interface CorTimer { int isTimer(); void setTimer(int value); } public static class Storage implements IStorage<CorTimer> { @Override public void readNBT(net.minecraftforge.common.capabilities.Capability<CorTimer> arg0, CorTimer arg1, EnumFacing arg2, NBTBase arg3) { // TODO Auto-generated method stub arg1.setTimer(10); } @Override public NBTBase writeNBT(net.minecraftforge.common.capabilities.Capability<CorTimer> arg0, CorTimer arg1, EnumFacing arg2) { // TODO Auto-generated method stub return new NBTTagInt((arg1.isTimer())); } } public static class DefaultImpl implements CorTimer { private int isSleeping = 0; @Override public int isTimer() { return isSleeping; } @Override public void setTimer(int value){this.isSleeping = value;} } @SubscribeEvent public void onLivingUpdate(LivingUpdateEvent e) { if(e.getEntity() instanceof IAnimals) { EntityLiving entity = (EntityLiving)e.getEntity(); if(entity instanceof EntitySheep) { final CorTimer sleep = entity.getCapability(Main.TIMER, null); if (sleep != null) sleep.setTimer(100);; System.out.println(": " + sleep); /*BlockPos pos = entity.getPosition(); Random rand = new Random(); BlockPos pos1 = pos.add(rand.nextInt(2) +1, -1, rand.nextInt(2) +1); World world = entity.worldObj; IBlockState iblockstate1 = world.getBlockState(pos1); Block[] list = {ModBlocks.CorrtuptedGrass}; for(int i = 0; i < list.length; i++) { if(list[i] == iblockstate1.getBlock()) { } } System.out.println(pos + " new pos" + pos1);*/ } } } }
-
it just crashes and says "Attempted to load a proxy type mymod.proxies.ClientProxy into mymod.Main.TIMER, but the types don't match" the TIMER being my Capability, what does that mean?
-
I'm trying to make an event, that when a vanilla mob is close to a certain block, that mob will be give a count down timer (just like zombies have for conversion) and when that timer reaches zero the mob will be struck by lighting, but the issue is that when one mob's timer reaches zero, all the the timers reach zero too, and that's just because I use an int variable to keep track of the timer. So, I was thinking I could create a new nbtdata thing to keep track of the timer for each mob instead of an int, but I don't know how to do that. if anyone could help me that would be great.
-
is there a way to remove certain biomes? i'm testing a custom biome and it would be a lot easier to find if i could remove all the other biome, or at least increase the chances my biome will spawn.
-
[1.9] registerEntityRenderingHandler not working
SuperLuke replied to SuperLuke's topic in Modder Support
oh, I didn't know that. I had this in the 1.6.4 version of my mod and I just ported it over. yeah taking that out fix the issue. Thank you. -
it looks like your json file are wrong the model and texture paths should have you mod id in it like this "modid:tomato_stage0" and your texture path should be like this "modid:blocks/tomato_stage0"
-
[1.9] registerEntityRenderingHandler not working
SuperLuke replied to SuperLuke's topic in Modder Support
if I did it right the ID thing should make my entities compatible with other mods, so you don't get an error because matching ids there are no errors in the console yes my entity is being spawned -
I have two mobs one the CaveMan renders properly and the other one is just a white cube, here are the the renders and models for my mobs and my client proxy CaveMan Model: CaveManRender my custom Creeper render and the model ClientProxy and finally where i register my entitys also it seems since my creeper render doesn't work the game likes to render the creeper as the CaveMan. if anyone could help, that would be great.
-
[1.9.4]Teleporting player using onEntityWalking
SuperLuke replied to SuperLuke's topic in Modder Support
regardless if it is actually player or not it should still let me cast, but your right if i ran the code the way it is now it would probably crash -
[1.9.4]Teleporting player using onEntityWalking
SuperLuke replied to SuperLuke's topic in Modder Support
on this is the code with out me trying to teleport the player as i have not figured out how to do that yet. public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn) { if(entityIn instanceof IMob) { return; } else if(entityIn instanceof IAnimals) { return; } else { EntityPlayer player = (EntityPlayer)entityIn; //the error here says,"cannot cast from Entity to EntityPlayer" } } -
I'm trying to make a block that when the player walks on it they will be randomly teleported, so i figured i could just use the onEntityWalking method then convert the entity to an entityPlayer and then figure out how to make them teleport, but I seem to be unable to cast entity to entityPlayer. does anyone know a way to make entitys teleport or how to cast to entityPlayer