
shucke
Members-
Posts
126 -
Joined
-
Last visited
Everything posted by shucke
-
Hi everyone, I am currently having an issue getting my OBJ model to load. The error i am getting is: I don't have much experience with blockstates and the new model rendering pipeline and don't really now where to go from here. this is my blockstate file: I also added OBJLoader.INSTANCE.addDomain(Ref.MOD_ID); in my client proxy. The location of my .obj file is: assets\temporia\models\block\temporite.obj I'm sorry if this is a common issue and is easy to find a fix for but i couldn't find anything that worked for me. Thanks in advance.
-
I am trying to implement leaves and i ran into a bit of a annoying problem. I don't want my block to look up different models for the various block states that it has (Being the decayable and check_decay from the leave block). But it is looking for those different variants in the blockstate class. Now since the minercraft leave blocks don't use different states in the blockstate i was wondering how i can do that for my leaves. Thanks in advance.
-
Tinkers construct is an open source mod, if you want to make your glass like it look at the code to see how they have done it and try to replicate it. Do not straight up copy the code because it will get you nowhere.
-
I need a way to render a block normally but from the TileEntitySpecialRenderer. I need this because i need to apply a rotation to it. I currently have this: private void renderWaterWheel(TileWaterWheel tile, double posX, double posY, double posZ, float partialTick){ GlStateManager.pushMatrix(); World world = tile.getWorld(); IBlockState state = tile.getBlockState(); BlockPos pos = tile.getPos(); GlStateManager.rotate(0.0F, 0.0F, 1.0F, tile.rotation); IFlexibleBakedModel model = (IFlexibleBakedModel) mc.getBlockRendererDispatcher().getModelFromBlockState(state, world, pos); mc.getBlockRendererDispatcher().getBlockModelRenderer().renderModel(world, model, state, pos, Tessellator.getInstance().getWorldRenderer()); GlStateManager.popMatrix(); } @Override public void renderTileEntityAt(TileEntity tile, double posX, double posY, double posZ, float partialTick, int i0) { renderWaterWheel((TileWaterWheel) tile, posX, posY, posZ, partialTick); } But this doesnt work. Anyone knows how to do it properly?
-
Aaahhh thanks for the explanation So now i checked in the block if the item held is an instance of an Wrench and all works well now. Thanks for helping out!
-
So i put the !world.isRemote check and it turns out the method does not get called on the servers side. I thought it would because it doesn't have a SideOnly annotation. I already tried the onItemUse method but that doesn't seem to call when i right click the desired block. Is there another method that does the same thing as the onItemUseFirst method?
-
oops my bad here it is public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ){ Block block = world.getBlockState(pos).getBlock(); if(block instanceof IRotateable){ EnumFacing facing = ((IRotateable) block).getDirection(world, pos); ((IRotateable) block).setRotation(world, pos, DirectionHelper.getNext(facing)); System.out.println(((IRotateable) block).getDirection(world, pos)); return true; } return false; }
-
Title said it all actually, my block state resets when i right click on it with an empty hand. So this is the block code. public abstract class BlockRotateable extends BlockBaseContainer implements IRotateable{ public static final PropertyEnum DIRECTION = PropertyEnum.create("direction", EnumFacing.class); public BlockRotateable(String name, Material material) { super(name, material); this.isBlockContainer = true; } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { return true; } public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer){ return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(DIRECTION, facing); } public final EnumFacing getDirection(World worldObj, BlockPos pos){ return (EnumFacing) worldObj.getBlockState(pos).getValue(DIRECTION); } @Override public void setRotation(World world, BlockPos pos, EnumFacing rotation) { IBlockState state = world.getBlockState(pos).withProperty(DIRECTION, rotation); world.setBlockState(pos, state); } public IBlockState getStateFromMeta(int meta){ return this.getDefaultState().withProperty(DIRECTION, DirectionHelper.byIndex(meta)); } public int getMetaFromState(IBlockState state){ return ((EnumFacing)state.getValue(DIRECTION)).getIndex(); } protected BlockState createBlockState(){ return new BlockState(this, new IProperty[] {DIRECTION}); } } Im probally missing something but i cant figure out what. Any help is much appreciated EDIT: i am using the onItemUseFirst method in a item class to change the block state.
-
So im trying to register 2 different items with metadata sensitve models. Now it finds the model and all but the models for the second item appear on the first item. I cant seem to find the error in this, mainly because i haven't done this before with 1.8. So here is the registering code: private void registerFishItemModels(){ List<String> rawFishModelNames = new ArrayList(); List<String> cookedFishModelNames = new ArrayList(); for(int i = 0; i < FishRegistry.getFishTypeList().length; i++){ FishType fish = FishRegistry.getFishFromID(i); if(fish == null) continue; String s = JUtils.capitalize(fish.fishName); String rawName = Fishing.ID + ":fish" + s + "Raw"; registerItemModelWithMeta(FishingItems.rawFish, i, rawName); rawFishModelNames.add(rawName); if(fish.isCookable()){ String cookedName = Fishing.ID + ":fish" + s + "Cooked"; registerItemModelWithMeta(FishingItems.cookedFish, i, cookedName); cookedFishModelNames.add(cookedName); } } ModelBakery.addVariantName(FishingItems.rawFish, JUtils.convertStringList(rawFishModelNames)); ModelBakery.addVariantName(FishingItems.cookedFish, JUtils.convertStringList(cookedFishModelNames)); } private void registerItemModelWithMeta(Item item, int meta, String loc){ Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(FishingItems.rawFish, meta, new ModelResourceLocation(loc, "inventory")); } *The JUtils class is just an helper class to convert a list to array So the models for the cooked fish appear on the raw fish and non appear on the raw fish. Any help would be greatly apreciated because i cant seem to figure it out.
-
Ok so i thought the model location worked the same as resource location. turns out not to be the case works fine now!
-
So updating to 1.8 was overall not that difficult for me. Only problem i encountered was with the way rendering works now. I am currently trying to allow my item to have a custom model. I have created a JSON model in BDCraft Cubik PRO so im assuming there aren't any problems with the model. The problem im having now is that i dont get any errors but the model isn't showing. So in my client proxy i have this: public void postInitialize(){ registerItemModel(FishingItems.crabCage, new ModelResourceLocation(Fishing.ID + ":models/", "crab_cage")); super.postInitialize(); } public void registerItemModel(Item item, ModelResourceLocation model){ Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, new ItemMeshDefinition(){ @Override public ModelResourceLocation getModelLocation(ItemStack stack) { return model; } }); } So i dont know where to start since im still new to 1.8 and got no errors and the methods are getting called aswell. *I noted that i doesnt matter if i change the name in my model resource location, it always goes points the the unlocalized name of the item
-
Yeah i am leaning towards the idea of registering a world for every dungeon type. And generating them 1000 blocks apart or something, depending on the size.
-
[1.7.2] Making time of potion effect highter that 15 minutes.
shucke replied to Sokaya's topic in Modder Support
I would suggest creating an IExtendEntityProperties for the player. Create some custom effects, store them somewhere, and add them to a list in the extended properties when a player drinks a potion for example. Create a method in your extended properties to be called onUpdate or something. Use a tick event to call the method. Check in the method for effects. Do whatever you want to happen. example: public class PlayerProperties implements IExtendedEntityProperties{ private EntityPlayer thePlayer; private List<Effect> effects = new ArrayList(); public PlayerProperties(EntityPlayer player){ thePlayer = player; } public void onUpdate(){ for(int i = 0; i < effects.size(); i++){ Effect effect = effects.get(i); effect.execute(thePlayer); effect.time--; if(effect.time == 0) effects.remove(i); } } public void addEffect(int id, int time){ effects.add(new Effect(id, time)); } } if you want more info on how to create IExtendedEntityProperties check out the tutorial from CoolAlias on the minecraft forum. -
Sorry should have been more clear. RPG Dungeon system Like when a party enters a dungeon it creates an dungeon specified to that party so only party members can join that instance of the dungeon. World at Warcraft dungeons for example, maybe i should have said dungeons in the first place...
-
So yeah title says it, how do i go about creating a temporary world? my goal is to create RPG instance system but i dont know how to world handling would be for that. My idea was to create a world with a certain id and store it in the player's data, when the player enters a instance. And that the world will be "deleted" when the player leaves the world. Any thoughts on how i would acomplish this?
-
entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F); this should set the pos fields. and its already in but doesnt work unfortunatly.
-
@SubscribeEvent public void setArmorModel(RenderPlayerEvent.SetArmorModel evt){ if(/* is wearing you armor */){ evt.result = -1; } } put this in your client event handler and try messing with the result. I have no idea if this works or not but looking at the source code this is the only way i could find to manipulate the render passes.
-
you can get the NBTTagCompound from an ItemStack with the getTagCompound() method. Note that by default an ItemStack does not have an NBTTagCompound so you need to check for that, and create one if null. to load an ItemStack from nbt you need ItemStack.loadItemStackFromNBT(tag). and to save an ItemStack to nbt you need stack.writeToNBT(tag).
-
no error, like i said it spawns but it is teleported.
-
Why not use IInventory? Even if you dont use a gui (which is totally missing the point of why people use IInventory) it is still the interface to use when creating a inventory. it gives compatibility between mods and minecraft hoppers. And if you look in the ItemStack class you can see that there are methods for writing an stack to NBT and methods for loading a stack from NBT. Use those.
-
Hi, i am trying to spawn an entity but it doesnt work as properly. Whenever the entity spawns it appears on my screen for a brief second and dissapears after. I think it has something to do with the fact that the postion of the entity is incorrect or something and that is teleported to the origin of the world. This is my current code: public static void summonEntity(Class<? extends Entity> clazz, World world, double x, double y, double z, SummoningCircleLogic logic, AdditionalSummonInfo info){ Entity entity = getEntityByClass(clazz, world); entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F); if(entity instanceof EntityLiving){ EntityLiving living = (EntityLiving) entity; living.rotationYawHead = living.rotationYaw; living.renderYawOffset = living.rotationYaw; } world.spawnEntityInWorld(entity); if(entity instanceof ISummonedEntity){ ((ISummonedEntity) entity).onSummoned(logic); ((ISummonedEntity) entity).playSummonedSound(world, x, y, z); } } public static Entity getEntityByClass(Class<? extends Entity> clazz, World world){ try { Class[] type = {World.class}; Constructor cons = clazz.getConstructor(type); Object[] obj = {world}; return (Entity) cons.newInstance(obj); } catch (NoSuchMethodException e1) { e1.printStackTrace(); } catch (SecurityException e1) { e1.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } return null; } BTW all this is executed server side only. so no need to do the !world.isRemote check.
-
Whenever i am trying to render a .obj model in minecraft it renders fine except for the lighting. It renders the model with flat lighting but i am trying to get smooth lighting. So far i couldn't figure out how to get it to work. this is what i have: @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f) { if(tile instanceof CannonLogic){ CannonLogic cannon = (CannonLogic) tile; GL11.glPushMatrix(); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glTranslated(x+0.5D, y, z+0.5D); GL11.glScalef(0.05F, 0.05F, 0.05F); bindTexture(texture); model.renderOnly("base"); GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(cannon.getYaw(), 0.0F, 1.0F, 0.0F); model.renderAllExcept("base","barrel"); model.renderOnly("barrel"); GL11.glPopMatrix(); } } Anyone knows how to enable smooth lighting in minecraft?
-
Since the ids are no longer there (at least not for usage), what is a good way to put items in a hashmap? and i dont really like the Iterator loop because i need to add every single item to it.
-
is there an existing method somewhere to find a proper spawnpoint for a Entity?