-
Posts
440 -
Joined
-
Last visited
Everything posted by Flenix
-
Anyone able to help with this?
-
Way to run a forge server from inside eclipse?
Flenix replied to snocavotia's topic in Modder Support
Once you have set up forge and eclipse correctly, there's a test for both client and server. Hit the little green > button up in the top-left corner. The drop down arrow next to it lets you choose client or server, and it'll auto-run whichever you tested most recently. -
Hey guys, I've been trying to learn how to make Entities properly. I've been following vswe's tutorial after some advice from IRC users ( ), but when I reached the first test point, there was an issue. In the video he loads up just fine, spawns one and it's all good. However, in mine, the entity only renders when I'm looking at it from a specific angle - anything else and it vanishes. It's a very narrow angle too. I tried continuing the tutorial a little further to see if I'd notice a mistake anywhere, but I didn't. When it came to the second test (mounting the entity), I also couldn't do that, and gave up and cried for help on IRC. No one seemed to know, so posting here! Can anyone spot my mistake? Note, I'm using the supplied Render class (with slight alterations as the 1.6.1 version provided didn't work), and I've tried both the supplied model file and my own one. Here's the classes, let me know if you need anything else. [spoiler=Entity] package co.uk.silvania.roads.entity; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; public class EntityBasicCar extends Entity { public EntityBasicCar(World world) { super(world); setSize(4.0F, 2.0F); } @Override public AxisAlignedBB getBoundingBox() { return boundingBox; } @Override public AxisAlignedBB getCollisionBox(Entity entity) { if (entity != riddenByEntity) { return entity.boundingBox; } else { return null; } } @Override public boolean canBeCollidedWith() { return !isDead; } @Override public boolean interactFirst(EntityPlayer player) { if (!worldObj.isRemote && riddenByEntity == null) { player.mountEntity(this); } return true; } @Override public double getMountedYOffset() { return -0.15; } @Override protected void entityInit() { } @Override protected void readEntityFromNBT(NBTTagCompound nbt) { } @Override protected void writeEntityToNBT(NBTTagCompound nbt) { } } [spoiler=Entity Registry] package co.uk.silvania.roads.entity; import co.uk.silvania.roads.Roads; import cpw.mods.fml.common.registry.EntityRegistry; public class Entities { public static void init() { EntityRegistry.registerModEntity(EntityBasicCar.class, "EntityBasicCar", 0, Roads.instance, 80, 3, true); } } [spoiler=Render] package co.uk.silvania.roads.client.vehicles; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBoat; import net.minecraft.client.renderer.entity.Render; import net.minecraft.util.ResourceLocation; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; import org.lwjgl.opengl.GL11; import co.uk.silvania.roads.entity.EntityBasicCar; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderBasicCar extends Render { private static final ResourceLocation texture = new ResourceLocation("roads", "textures/vehicles/BasicCar.png"); private static final ResourceLocation chargedTexture = new ResourceLocation("roads", "textures/vehicles/BasicCar_red.png"); protected ModelBasicCar model; public RenderBasicCar() { shadowSize = 0.5F; model = new ModelBasicCar(); } public void renderBasicCar(EntityBasicCar car, double x, double y, double z, float yaw, float partialTickTime) { GL11.glPushMatrix(); GL11.glTranslatef((float)x, (float)y, (float)z); GL11.glRotatef(180.0F - yaw, 0.0F, 1.0F, 0.0F); GL11.glScalef(-1.0F, -1.0F, 1.0F); bindEntityTexture(car); model.render(car, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); } @Override public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTickTime) { this.renderBasicCar((EntityBasicCar)entity, x, y, z, yaw, partialTickTime); } protected ResourceLocation getCarTextures(EntityBasicCar entity) { return texture; } @Override protected ResourceLocation getEntityTexture(Entity entity) { return (this.getCarTextures((EntityBasicCar)entity)); //Originally had a check if it was charged here, but as my Entity doesn't have the charged methods yet, I changed it to match "RenderCow" } } [spoiler=My Model (Techne export)] package co.uk.silvania.roads.client.vehicles; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelBasicCar extends ModelBase { //fields ModelRenderer Front; ModelRenderer Windscreen; ModelRenderer Wheel_1; ModelRenderer Wheel_2; ModelRenderer Wheel_3; ModelRenderer Wheel_4; ModelRenderer Right; ModelRenderer Back; ModelRenderer Left; ModelRenderer Floor; ModelRenderer Steering_Wheel; ModelRenderer Steering_Column; ModelRenderer Chair_Base; ModelRenderer Chair_Top; ModelRenderer Wiper_Right; ModelRenderer Wiper_Left; public ModelBasicCar() { textureWidth = 512; textureHeight = 512; Front = new ModelRenderer(this, 0, 0); Front.addBox(0F, 0F, 0F, 48, 16, 20); Front.setRotationPoint(-24F, 2F, -32F); Front.setTextureSize(512, 512); Front.mirror = true; setRotation(Front, 0F, 0F, 0F); Windscreen = new ModelRenderer(this, 0, 53); Windscreen.addBox(0F, 0F, 0F, 48, 16, 1); Windscreen.setRotationPoint(-24F, -14F, -13F); Windscreen.setTextureSize(512, 512); Windscreen.mirror = true; setRotation(Windscreen, 0F, 0F, 0F); Wheel_1 = new ModelRenderer(this, 0, 0); Wheel_1.addBox(0F, -4F, -4F, 1, 8, ; Wheel_1.setRotationPoint(-25F, 20F, -21F); Wheel_1.setTextureSize(512, 512); Wheel_1.mirror = true; setRotation(Wheel_1, 0F, 0F, 0F); Wheel_2 = new ModelRenderer(this, 0, 0); Wheel_2.addBox(-1F, -4F, -4F, 1, 8, ; Wheel_2.setRotationPoint(25F, 20F, -21F); Wheel_2.setTextureSize(512, 512); Wheel_2.mirror = true; setRotation(Wheel_2, 0F, 0F, 0F); Wheel_3 = new ModelRenderer(this, 0, 0); Wheel_3.addBox(0F, -4F, -4F, 1, 8, ; Wheel_3.setRotationPoint(-25F, 20F, 35F); Wheel_3.setTextureSize(512, 512); Wheel_3.mirror = true; setRotation(Wheel_3, 0F, 0F, 0F); Wheel_4 = new ModelRenderer(this, 0, 0); Wheel_4.addBox(-1F, -4F, -4F, 1, 8, ; Wheel_4.setRotationPoint(25F, 20F, 35F); Wheel_4.setTextureSize(512, 512); Wheel_4.mirror = true; setRotation(Wheel_4, 0F, 0F, 0F); Right = new ModelRenderer(this, 0, 0); Right.addBox(0F, 0F, 0F, 1, 16, 35); Right.setRotationPoint(-24F, 2F, -12F); Right.setTextureSize(512, 512); Right.mirror = true; setRotation(Right, 0F, 0F, 0F); Back = new ModelRenderer(this, 0, 0); Back.addBox(0F, 0F, 0F, 48, 16, 20); Back.setRotationPoint(-24F, 2F, 23F); Back.setTextureSize(512, 512); Back.mirror = true; setRotation(Back, 0F, 0F, 0F); Left = new ModelRenderer(this, 0, 0); Left.addBox(0F, 0F, 0F, 1, 16, 35); Left.setRotationPoint(23F, 2F, -12F); Left.setTextureSize(512, 512); Left.mirror = true; setRotation(Left, 0F, 0F, 0F); Floor = new ModelRenderer(this, 105, 5); Floor.addBox(0F, 0F, 0F, 46, 1, 35); Floor.setRotationPoint(-23F, 17F, -12F); Floor.setTextureSize(512, 512); Floor.mirror = true; setRotation(Floor, 0F, 0F, 0F); Steering_Wheel = new ModelRenderer(this, 75, 40); Steering_Wheel.addBox(-4F, -4F, -1F, 8, 8, 1); Steering_Wheel.setRotationPoint(14F, 0F, -5.8F); Steering_Wheel.setTextureSize(512, 512); Steering_Wheel.mirror = true; setRotation(Steering_Wheel, 0F, 0F, 0F); Steering_Column = new ModelRenderer(this, 97, 43); Steering_Column.addBox(-1F, -1F, -8F, 2, 2, ; Steering_Column.setRotationPoint(14F, 0F, -6.5F); Steering_Column.setTextureSize(512, 512); Steering_Column.mirror = true; setRotation(Steering_Column, 0.6108652F, 0F, 0F); Chair_Base = new ModelRenderer(this, 0, 80); Chair_Base.addBox(0F, 0F, 0F, 12, 2, 14); Chair_Base.setRotationPoint(8F, 11F, -2F); Chair_Base.setTextureSize(512, 512); Chair_Base.mirror = true; setRotation(Chair_Base, -0.122173F, 0F, 0F); Chair_Top = new ModelRenderer(this, 80, 80); Chair_Top.addBox(0F, -6F, 0F, 12, 20, 2); Chair_Top.setRotationPoint(8F, 0F, 13F); Chair_Top.setTextureSize(512, 512); Chair_Top.mirror = true; setRotation(Chair_Top, -0.2617994F, 0F, 0F); Wiper_Right = new ModelRenderer(this, 0, 100); Wiper_Right.addBox(-20F, 0F, 0F, 20, 1, 1); Wiper_Right.setRotationPoint(-1F, 1F, -13.5F); Wiper_Right.setTextureSize(512, 512); Wiper_Right.mirror = true; setRotation(Wiper_Right, 0F, 0F, 0F); Wiper_Left = new ModelRenderer(this, 0, 97); Wiper_Left.addBox(-20F, 0F, 0F, 20, 1, 1); Wiper_Left.setRotationPoint(20F, 1F, -13.5F); Wiper_Left.setTextureSize(512, 512); Wiper_Left.mirror = true; setRotation(Wiper_Left, 0F, 0F, 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); Front.render(f5); Windscreen.render(f5); Wheel_1.render(f5); Wheel_2.render(f5); Wheel_3.render(f5); Wheel_4.render(f5); Right.render(f5); Back.render(f5); Left.render(f5); Floor.render(f5); Steering_Wheel.render(f5); Steering_Column.render(f5); Chair_Base.render(f5); Chair_Top.render(f5); Wiper_Right.render(f5); Wiper_Left.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); } } [spoiler=Official Model (not being used right now, provided for completeness)] package example.client; import java.util.ArrayList; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class ModelSpaceship extends ModelBase { private ArrayList<ModelRenderer> parts = new ArrayList<ModelRenderer>(); public ModelSpaceship() { textureWidth = 128; textureHeight = 64; ModelRenderer bot = new ModelRenderer(this, 0, 0); parts.add(bot); bot.addBox( -14, -8, -2, 28, 16, 4, 0.0F); bot.setRotationPoint(0, 4, 0); bot.rotateAngleX = (float)Math.PI / 2F; ModelRenderer side1 = new ModelRenderer(this, 0, 20); parts.add(side1); side1.addBox( -14, -1.5F, -2, 28, 3, 4, 0.0F); side1.setRotationPoint(0, 0, -9); side1.rotateAngleX = (float)Math.PI / 2F; ModelRenderer side2 = new ModelRenderer(this, 0, 20); parts.add(side2); side2.addBox( -14, -1.5F, -2, 28, 3, 4, 0.0F); side2.setRotationPoint(0, 0, 9); side2.rotateAngleX = (float)Math.PI / 2F; ModelRenderer back = new ModelRenderer(this, 0, 27); parts.add(back); back.addBox( -10.5F, -1.5F, -2, 21, 3, 4, 0.0F); back.setRotationPoint(15.5F, 0, 0); back.rotateAngleX = (float)Math.PI / 2F; back.rotateAngleY = (float)Math.PI / 2F; ModelRenderer wing1 = new ModelRenderer(this, 0, 34); parts.add(wing1); wing1.addBox( -13, -0.5F, -4, 26, 1, 8, 0.0F); wing1.setRotationPoint(0, -1, -14); ModelRenderer wing2 = new ModelRenderer(this, 0, 34); parts.add(wing2); wing2.addBox( -13, -0.5F, -4, 26, 1, 8, 0.0F); wing2.setRotationPoint(0, -1, 14); ModelRenderer front = new ModelRenderer(this, 0, 43); parts.add(front); front.addBox( -7.5F, -2.5F, -3, 15, 5, 6, 0.0F); front.setRotationPoint(-16, 1, 0); front.rotateAngleX = (float)Math.PI / 2F; front.rotateAngleY = (float)Math.PI / 2F; ModelRenderer window = new ModelRenderer(this, 0, 54); parts.add(window); window.addBox( -7.5F, -0.5F, -2, 15, 1, 4, 0.0F); window.setRotationPoint(-14.5F, -4, 0); window.rotateAngleX = (float)Math.PI / 2F; window.rotateAngleY = (float)Math.PI / 2F; } public void render(Entity entity, float val1, float val2, float val3, float val4, float val5, float mult) { for (ModelRenderer part : parts) { part.render(mult); } } } [spoiler=Item (to spawn the vehicle)] package co.uk.silvania.roads.entity; import co.uk.silvania.roads.Roads; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ItemBasicCar extends Item { public ItemBasicCar(int id) { super(id); this.setCreativeTab(Roads.tabRoads); } //TODO resource stuff @Override public boolean onItemUseFirst(ItemStack item, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { if (world.isRemote) { EntityBasicCar car = new EntityBasicCar(world); car.posX = x + 0.5; car.posY = y + 1.5; car.posZ = z + 0.5; world.spawnEntityInWorld(car); return true; } else { return false; } } } [spoiler=And this is in my client proxy] RenderingRegistry.registerEntityRenderingHandler(EntityBasicCar.class, new RenderBasicCar()); I'm guessing the error is probably due to some sort of change between the version of forge when the video was made, and the version we're using now. Note, I'm still on the previous recommended build (916 I think?) - I didn't want to dive into Gradle until after I've done this.
-
Thanks for the ideas. There's not going to be anything in the code which defines an actual "shop", as in a network. I'll just have one shelf, connected to one chest - but multiple shelves can connect to the cash register. The shelf is kind of like a fancy item frame with a GUI I suppose. Deciding how to link them is something I'm still unsure of... I figured the easiest way might be to have the user place everything as they want it, then have a linking wand which stores the location of the shelf as NBT, and adds it to the NBT of whichever storage block & cash register they choose. From there, the storage block would only use the latest value, whereas the cash register would have a list. My 64 block range limit means the chunks wouldn't matter, chunks within 64 blocks of the player should always be loaded because that's only a 4 chunk radius. I suppose a check for the server view distance wouldn't hurt though (I believe servers can set it as low as 3, in which case a maximum distance setup wouldn't work)
-
I don't think you understood the question at all. I know that's how the client fixes it. But, I want my modded client to be able to connect to an unmodded server if the user wishes - I don't want them to have to close their client and remove my mod to join a vanilla server or a server which doesn't run my mod - it's quite a negative point on the mod to do that...
-
Hey guys, I've got a mod which slightly alters how food works. However, the change means if I try and connect to a server without my mod, I get kicked with "ID Mismatches" Is there a simple way that I can just disable my mod if it's not on the server, so I can still connect to those servers? Thanks
-
Hey guys, I want to do some linking of Tile Entities for the shop part of my economy system. The way I figured I'd do the shop is with three separate Tile Entities; The "Shelf" block. which is the point of sale. It shows the item, and a buyer can click the item to buy it. The shelf also changes it's GUI depending on whether the owner is interacting or not - If the owner opens it, they can edit things, whereas the buyer can only buy or sell, so I probably need to transmit data between the tile entity and the GUI to write text from the TE onto the GUI, eg price of the item. The "Storage" block. Effectively a glamorized chest, but the Shelf ties into it. The Shelf gets it's stock from here. Only the owner can open this, but I think that'd be quite easy to do; just detect who placed it, write their username to NBT then check on right click? (Or is there a better way?) The "Cash Register" block. This is where the money taken from the player will go. Now, I need to connect these without them actually being next to one another. Also, I want the storage to only accept one shelf at a time, but the cash register needs unlimited. Finally I don't want an unlimited range; I'll say 64 blocks to allow for large shops. Anyone got any advice on how I'd do something like this? Maybe someone knows an example of something vaguely similar? Any help is great, not quite sure where to start! Finally, I know I could do all this within one block, but I'm going for realism.
-
I do something similar in my FlenixCities mod in an incredibly simple way. If all you're doing is changing something you can alter within the GUI class on-screen (IE, you're not showing different items or anything like that), you can use a String as a variable to set a "GUI Stage". Then, when you click one of the tab buttons, it changes the string's value to a different number. You then use if statements to define what should be shown depending on which number the string is set to. May not be the neatest way but if you're only doing simple stuff, it's certainly the easiest.
-
Probably wont work but worth a try; In your model class, move the candle so it's rendered in the opposite order to the glass currently. IE, if it's currently above the glass, put it below, and if it's below the glass, put it above. It works in techne but I've never tried that kind of thing in-game. (Also, off-topic but as a suggestion, it'd be cool to see some flames rendering on the candle like you get on a Torch
-
Extending on this; is it possible to make a mod only work when a user connects to a specific server? I may be making a private mod for someone, and by doing that they can test it out while it's being worked on.
-
Hey guys, I need to somehow call information from the NBT of an item the player is holding, in the GuiContainer class for a block. The player will only ever be holding one item (as you have to right click the block with this item for the GUI to open). How would I go about doing this? I'm assuming I'll probably need packets? Thanks
-
Cheers. I'll give that a try, then I'll add it to the list for you
-
https://github.com/BuildCraft/BuildCraft/blob/master/common/buildcraft/energy/render/RenderEngine.java The reason I didn't want Buildcraft is because it seems to do things quite differently to other mods. I'm sure it's all very efficient, but the above render class is TOTALLY different to any other render class I've seen before. I can't see any reference to power or redstone in there, nor to the PartialTickTime you just mentioned. Maybe I'm just being blind?
-
Hey guys. What would be the best way for me to do the above? I have a metadata-based rotation block; it can face one of four directions (N/E/S/W). What I want to be able to do, is when it has redstone power, it places a block above. When the power is removed, it deletes that block and places one to the right. I can do the "if meta is 1 place it here" parts etc just fine. What I'm having trouble with is actually changing between powered and unpowered. Do I need to change the metadata when I power it or anything? If so, how would I do that? I dislike redstone
-
Just for the sake of logging;
-
Can anyone point me to a place where I can see how they work? A tutorial would be brilliant, but failing that some simple working source code to look at would be nice (The only one I could think of was Buildcraft, which to be honest isn't exactly simple ) I don't need to do anything too fancy, just want to animate a few things with the Tile Entity Special Renderer. Any help is great
-
Hey, I was one of the guys from before. Specifically, I was the guy who had the same issue, but managed to get it working. Anyway, if you wanna have a look through, here's the main code you need. Note I'm using Doubles, but an int would work EXACTLY the same, just use an int not a double and change the word where appropriate; https://github.com/Flenix/FlenixCitiesCore/blob/master/co/uk/silvania/cities/core/blocks/atm/TileEntityATMBlock.java https://github.com/Flenix/FlenixCitiesCore/blob/master/co/uk/silvania/cities/core/NBTConfig.java The first is my block. When the player right-clicks the ATM with their money, it gets stored. The second simply controls the NBT stuff; there might be a better way of doing it, but this works. (Also, not gonna lie I didn't read any other replies. If this was already solved, just ignore me
-
Using redstone to alter TESR texture. Spot my stupid mistake!
Flenix replied to Flenix's topic in Modder Support
But don't I need to do something special in order to receive the packet? How does my render code know what to do? I tried looking in your render code, but couldn't see any references to the packet... Bit confused by that to be honest -
Using redstone to alter TESR texture. Spot my stupid mistake!
Flenix replied to Flenix's topic in Modder Support
Any examples of this in use? -
Using redstone to alter TESR texture. Spot my stupid mistake!
Flenix replied to Flenix's topic in Modder Support
Really? Got any examples of how I'd handle them then? I thought you always need a handler for any packets -
Using redstone to alter TESR texture. Spot my stupid mistake!
Flenix replied to Flenix's topic in Modder Support
That's what diesieben on IRC said too. Guess I need to get a packet handler going... damnit I hate packets -
Hey guys. I've been trying to change my texture depending on whether the block is recieving redstone power. It's not playing nice. I get the feeling I'm just getting annoyed with it and overlooking something incredibly simple that I've missed, so I was just wandering if someone could take a look at my code and tell me what it might be? Sorry it's a little messy, I've been experimenting. I did clean it up a bit before the paste but there might still be messy parts All three classes (Block, TE, and Renderer) are in the pastebin. Any help is great http://pastebin.com/SsQGvJNZ
-
Is there a simple method for creating my own villager?
Flenix replied to Flenix's topic in Modder Support
Alright thanks. is there a "next available ID" kind of thing for their ID? I don't want to clash with other mods doing the same thing. -
I'll look into that This is more of an admin thing anyway for setting up on a server/map. It's only going to be available in creative mode by default - I'll have a crafting recipe which can be enabled but it'll be endgame expensive even then. It's for part of the mechanics of my Cities mod. What is actually happening is the receiver is the only "block" part of it, and will actually be hidden. The sender is really a mob, whom will teleport you to it after selecting your location and paying a fee with the built-in economy, as part of an airline fast-travel system I'm adding to the mod.
-
As the title says. From googling I've found methods which are a single line of code (and a trade handler class) for adding new villagers with their own texture and trade setups. But, the code I found was old, none of it worked in 1.6 Is something like this still possible? I don't need a new building for the village, but I do need him to spawn with other villagers.