-
Posts
108 -
Joined
-
Last visited
Everything posted by oldcheese
-
at line 22 of your SlotPestleOutput you're for some reason trying to cast an IItemhandler to an TileEntity. IItemhandlers are the default implementation for the inventory capability while the TileEntity is your Pestle block's entity. I'm not sure why you've tried to do it, but I imagine that once you fix that everything might work better. Since the GUI can't render if the slots are bugged.
-
It'd be helpfull if you paste the entire error here. Or at least the first block of errors after something happens. From your post it's also not very clear if the game crashes when you try to open the GUI, or if there's simply an error and nothing happens.
-
1.12 How do I make my entity or item breathe fire?
oldcheese replied to TheRPGAdventurer's topic in Modder Support
Yeah, that's the only thing you can't do with the raytrace method, dodging. I guess it depends on what the player wants. Either way, you raise some fair points. Also, does the bow actually do less damage when you hit from afar? I thought it based it on the charge time. It'd be a lot easier to just implement the ticksexisted time and then base damage on the reverse of that. I imagine you woudln't want gravity for a flamethrower, or even reverse the gravity, then setDead() if ticks existed goes too high. -
Do you get any specific errors in the console when rightclicking your block?
-
1.12 How do I make my entity or item breathe fire?
oldcheese replied to TheRPGAdventurer's topic in Modder Support
It's more usefull to look into the ghast, in this case. Since the ghast launches a projectile as part of it's AI already. Either way. I'd strongly advise using raytracing and particles rather than firing a ton of tiny arrows. Or at the very least fire a few arrows instead of one for each particle. Unless it's only used sparsely. Otherwise having 10-20 of these fire monsters would shoot 100 entities every attack. -
Using gui overlays you could easily implement one of those yourself. Though that'd be the next step. Good luck.
-
The Iterable is basically just a list with one item from each of your armor slots, so yes. If you want to check if the player has every single part equipped then you'd want to check every armorslot to see if your armor was there. you could do this with a for loop.
-
Re-check your If statements. If the comment doesn't fire then your code doesn't reach the if statements. I also believe you're missing an bracket. I'm not sure if it'd make a difference here since Java should decide it belongs to the first applicable clause to which it could belong. I do believe you might not get past the ent.getArmorInventoryList() instanceof ArmorBase), since that'll return an Iterable of the Itemstack. Again, I'm not 100% sure. But you could start to check by inserting comments to see where exactly you're not getting further.
-
[Solved] Storing and Retrieving NBT for an Item
oldcheese replied to shauncjones's topic in Modder Support
It's not saving anything. The items are just in there, if they had saved it'd work when you log in again. The class net.minecraft.item.ItemStack has methods for saving NBT data containing items and whatnot. I'd take a gander over there for saving NBT data. -
1.12 How do I make my entity or item breathe fire?
oldcheese replied to TheRPGAdventurer's topic in Modder Support
Basically this is the most efficient way for the computer. The only difficulty is that you'll hit people who aren't in line of sight, but even this could technically be fixed by doing raytracing between the entity and whoever is getting hit. . You can figure out where a mob's mouth is using maths. Then spawn a bunch of particles and hurt people in a cone in front of it. The second, much easier but much convoluted and CPU-intensive way is to make projectiles shoot from the mob's mouth in a spray. This would also make sure that the 'fire' is stopped by walls. Make a big, square invisible projectile and simply force it to spawn a ton of fire/different particles behind it. Then make it set on fire and deal fire damage on hit. You can look at the EntitySmallFireball for hints on how to spawn particles and whatnot. -
First off, why do entities need to have multiple thousands of health? 1024 is pretty high even for a damage mod. It'd seem simpler to just make your weapons/spells do 20 damage rather than 20k. Second, you could always try the way of 'damage reduction'. When the player hits an enemy an event is fired that damages said enemy. The easiest way to make an enemy feel like he has a certain amount of health would be to make every 100 damage instead do 1 damage. Then hold the leftover damage for the next hit. That way it'd still take 4000k worth of damage to hit a 10 hp enemy. The only problem that we'd have here now is that tooltip mods would still show 10 hearts. The obvious way is to say "Well, lets pretend a heart is 10k instead of 2." If you implement your own tooltip system in the game you could just show health as hearths x 10,000 or something of the like, or make it more precise depending on how much you hit. If the health is hard coded to have a 1024 limit there's no way to go about that. Not that I know off at least.
-
Have you tried EntityItemPickupEvent? it has the EntityItem, from which you could get the item information you'd need.
-
[Solved][1.12] Ignoring light/lack of light in TESR using Tesselator
oldcheese replied to oldcheese's topic in Modder Support
Welp. I was so entranced in trying to figure out how to properly rotate, transform and add vertexes that I forgot to look at the actual TESR class. That definitely did the trick. Thanks. -
Heya. I'm working on a TileEntity and since it's something that's rarely used I wanted to add a moving part to it that always turned towards you regardless of where you were. For this I used the Tesselator and TESR using GlStatemanager to make sure it always rotates towards the player. code here: public class TESRHenge extends TileEntitySpecialRenderer<TileEntityHenge> { @Override public void render(TileEntityHenge te, double x, double y, double z, float partialTicks, int destroyStage, float alpha){ GlStateManager.enableRescaleNormal(); GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.translate(x+0.5, y+0.5 , z+0.5); GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate((float)(Minecraft.getMinecraft().getRenderManager().playerViewX == 2 ? -1 : 1) * Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); GlStateManager.scale(0.6, 0.6, 0.6); Tessellator tess = Tessellator.getInstance(); BufferBuilder buff = tess.getBuffer(); Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(Main.MODID + ":" + "textures/modeltex/sphere.png")); buff.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); buff.pos(-0.5, -0.5, 0.0D).tex(1, 1).color(1.0F, 1.0F, 1.0F, 1F).endVertex(); buff.pos(0.5, -0.5, 0.0D).tex(0, 1).color(1.0F, 1.0F, 1.0F, 1F).endVertex(); buff.pos(0.5,0.5, 0.0).tex(0, 0).color(1.0F, 1.0F, 1.0F, 1F).endVertex(); buff.pos(-0.5,0.5, 0.0).tex(1, 0).color(1.0F, 1.0F, 1.0F, 1F).endVertex(); tess.draw(); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); GlStateManager.disableBlend(); } As a disclaimer: I have never used the Tessellator before. It took me about an hour of experimenting before I realized I needed to draw the four corners. I'm also still reading into GlStateManager The thing is, I want this spawned 'particle' to completely ignore lighting and always be at maximum brightness. I've tried using GlStateManager.disableLighting and Enablelighting. I'm just not quite sure what each one does. Anyhow. Seems the easiest way would be to simply make my block be a light source. But I'd rather not do that. I feel like there should be a way here. Am I supposed to use GlStateManager for this or should I somehow implement a lightmap into my Tessellator? How would I start doing this? If anyone could point me in the right direction that'd be great. Edit: I'm not very smart. There's a function for this in the TESR class itself.
-
Alright. I've simply added the blocks to my renderer using @SubscribeEvent public void registerRenders(ModelRegistryEvent event){ registerRender(Item.getItemFromBlock(RPVPBlocks.oreSilver)); registerRender(Item.getItemFromBlock(RPVPBlocks.shrine)); } private static void registerRender(Item item) { ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); } which seems to automatically render the item as a small block, no JSON needed. Though I see how I could make a custom icon using that. Thanks.
-
Hey there. Currently I'm in the process of updating everything to 1.12, since I'm fairly sure that I'm never going to finish my mod while 1.10 is still relevant. And it's plainly easier to release everything for 1.12 and have longevity for a year or so. Anyway. I'm registering blocks and blockItems as such: @SubscribeEvent public void registerBlocks(RegistryEvent.Register<Block> event){ final Block[] blocks = { oreSilver, shrine, }; event.getRegistry().registerAll(blocks); } @SubscribeEvent public void registerItemBlock(RegistryEvent.Register<Item> event){ final ItemBlock[] items = { new ItemBlock(shrine), new ItemBlock(oreSilver), }; for(final ItemBlock item:items){ final Block block = item.getBlock(); event.getRegistry().register(item.setRegistryName(block.getRegistryName())); } } obviously I subscribe the event and such. If I don't register an ItemBlock I don't get an item. Previously I was able to just get an item from the block, considering that blocks had an item that was just a miniature render of the block. Now all of my itemBlocks give me a default/missing pink and black texture. Is that because I need a JSON file and a texture for all my blocks? Is there a way to simply add a default texture to my items? The setCustomModelResourceLocation method still works, but I'm assuming there's perhaps a more up to date method?
-
[1.12.1] Few questions about biomes and dimensions
oldcheese replied to Erfurt's topic in Modder Support
one way is to subscribe to the WorldEvent.Load event. Then you can use the event.getWorld().provider.getDimension() to figure out if it's the nether or not. or whatever Dimension ID you want. Then you can modify the BiomeProvider field of that dimension to change what biomes specifically spawn. This is how I added biomes to the nether before. Obviously, if you've made your own Biome and your own Dimension you could alternatively just change your dimension from the start and make sure that the biomeprovider for your world has the biomes in it. I'm not sure how that works, since I haven't made dimensions. I've just modified the nether. -
[SOLVED] PlayerEvent.StartTracking alternative
oldcheese replied to Sorashi's topic in Modder Support
I was 99% Sure it would. But considering I've never had to track mobs on the client I didn't want to make any false promises. I started out by typing that it would work, but then my insecurities got the better of me. I actually just tested it. It works like a charm. -
[SOLVED] PlayerEvent.StartTracking alternative
oldcheese replied to Sorashi's topic in Modder Support
Nobody cares what is considered a cheat. Why exactly are you looking for ways to check mobs in your area on the client side? If you want to get a list of mobs in the player's area one way I can think of off the top of my head is to make a tickhandler that gets entities from the world using something like this: List players = world.getEntitiesWithinAABB(EntityPlayer.class, //or use EntityMob since you're looking for mobs. new AxisAlignedBB( playerCoord.x - area, playerCoord.y - area, playerCoord.z - area, playerCoord.x + area, playerCoord.y + area, playerCoord.z + area)); //formatted so it's not a huge string of text. for(int i = 0; i < players.size(); i++){ do stuff } which gets you a list of all players around the player. I'm fairly sure that method should work just fine on the client. (Though I might be mistaken.) (Edit: I just tested it out, it works pretty fine!) If you want to keep using that event you could alternatively try sending a packet to the client. But if you're making a radar of sorts there's not really any reason to bother the client with it. Unless you really want to. If you're doing anything to these other entities, however. You probably do want to make a packet and execute your code Server side. -
No problem. If you have another problem in the future or can't get it to work, feel free to post again. Also make sure to distinguish between slots and rectangles. Since both are shaped like a box. A box really isn't anything! Anyway, good luck.
-
WARNING: coremods are present: Do not report to Forge! Remove FoamFixAPI (or replace with FoamFixAPI-Lawful) and try again. (foamfix-0.8.0-1.12-anarchy.jar) If the crash doesn't stop, feel free to replace foamFixAPI with FoamFixAPI-Lawful. If you're playing someone else's server they might have to reset your player file or clear your inventory. I'm not sure what foamFixAPI does. Since i'm not the mod author. If your problem keeps going on you probably want to post to their server thread.
-
With boxes do you mean slots? when you add a slot to your container like such: for (int i = 0; i < 3; i++) { for (int j = 0; j < 9; j++) { addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } you're doing the following: You add 3 rows with each 9 slots. Every time i increases it goes 18 pixels down (slots are 18 big, 2 pixels around the 16 width item.) and every time j increases it goes 18 pixels to the right for the same reasons. The second value is the index, this is increased by 1 for every new slot basically. So every i adds 9, every j adds 1. addSlotToContainer(new Slot(inventoryToUse, slotIndex, xCoordinate, yCoordinate)); basically the slotindex is the index of the slot within the inventory. Vanilla inventory uses 0-35 for the items with 0-8 being the hotbar. slots 35-38 are armour. the xCoordinate is the spot within your GUI where you want to put your slot. The y Coordinate is the height from the top where your slot is. When you draw your Container the point '0' in x and y are the top left corner. in the GuiContainer (client side) you want to make your own 0 point, since 0 is the top left corner of the screen, not the gui. You have already declared the two variables for x and y in your gui using the following code however : int x = (width - xSize) / 2; int y = (height - ySize) / 2; so if you want something in the GuiContainer to be 15 pixels to the right and 10 pixels down(From the top left corner of your gui) you want to use drawTexturedModalRect(x+15, y+10, startOfTextureX, startOfTextureY, rectWidth, rectHeight); obviously if you want something to be in the corner of the screen you can just use 0 instead of x+number To clarify. the Container is your class extending container. the GuiContainer is the class extending GuiContainer. You probably know this. I'm just clarifying.
-
An inventory or GUI consists out of two things. The main Client side GuiContainer and the server side container. These are bound together with a guiHandler With the handler you're basically connecting the two. The way to add 'slots' to your GUI is to add slots to the container. You're using SlotItemHandler for your custom inventory .Which is the proper way to do it. Your problem might be that you haven't implemented an IGuiHandler. At least I can't find it in your GitHub. I might be blind. Anyway, to draw the bar you'll want to pass a variable with the percentage done to the client side guiContainer. Then use a drawTexturedModalRect(xPosition, yPosition, xStart, yStart, x, y); to draw the arrow. The way you do this is to set the 'start' of the draw texture to the left top corner of your texture. Then make the x the 'percentage' of your arrow. If the arrow is 50 pixels long and your machine is 50% done you set the x to 50*percentage where the double percentage is equal to 0.5 I'm writing from my phone. But I think that should be enough to get you going. Edit: When you pass a variable as '50' instead of a value with decimals and divide it by 100 to get a multiplier. Make sure you're using a double and casting one of the numbers to double so you actually GET a double. I know you probably already know this since it's basic. But I made the mistake once and when you do, you only get 1 or 0, don't be a dummy.
-
1.11.2 Armor that makes itself and the player invisible
oldcheese replied to darthvader45's topic in Modder Support
I believe you can still set a player invisible through conventional means (Potions, setInvisible()) while a player isn't being rendered. This should help having people track the player while he's invisible. That should save a good bit of work. Edit: It also will take other things, like telling other players that the player is rendered invisible (Using packets), sending packets after using the hotkeys. -
1.11.2 Armor that makes itself and the player invisible
oldcheese replied to darthvader45's topic in Modder Support
Check out the RenderLivingEvent (which is cancelable) and the forge documents on how to use Event.