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

Tree Puncher (2/8)
1
Reputation
-
Hi, I'm mainly looking for a bit of direction because I'm sorta stumped. Essentially, I'm trying to replace the renderer for the minecraft:nether_portal block without affecting any of the generation or utility code surrounding it. So far, I've registered a `BlockEntityRenderer` bound to a `BlockEntityType` which is built from `Blocks.NETHER_PORTAL` but this doesn't seem to work (or at least the `BlockEntityRenderer.render` function isn't being hit) Has anyone got a guide or some suggestions that could point me in the right direction?
-
If you're going to do this, I would suggest just removing client side configs entirely and depend solely upon server side configs since singleplayer runs it's own server, causing two sets of configs to be necessary.
-
I've been working on homing arrows for ProjectE and I have the homing part working. However, after finding the entity to attack, the arrow doesn't change it's yaw or pitch and I have no clue about how to work this out. Does anybody know how I'd go about this? The class of code is below: package moze_intel.projecte.gameObjs.entity; import moze_intel.projecte.utils.WorldHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import java.util.List; public class EntityHomingArrow extends EntityArrow { EntityLiving target; World world; private void init(World world) { this.world = world; } public EntityHomingArrow(World world) { super(world); init(world); } public EntityHomingArrow(World world, EntityLivingBase par2, float par3) { super(world, par2, par3); init(world); } @Override public void onUpdate() { //TODO Create proper custom arrow. This one is duplicating because of the super call for onUpdate(); super.onUpdate(); AxisAlignedBB box = this.boundingBox; if (target == null && !WorldHelper.isArrowInGround(this)) { System.out.println("TARGET == NULL"); AxisAlignedBB bBox = box.expand(8, 8, ; List<EntityLiving> list = this.worldObj.getEntitiesWithinAABB(EntityLiving.class, bBox); double distance = 100000; double disToEnt1 = 1000; for (EntityLiving entity : list) { double toIt = distanceTo(entity); double disToEnt2 = distanceTo(entity); if(disToEnt2 < disToEnt1){ disToEnt1 = disToEnt2; target = entity; } // if (distance > toIt) // { // distance = toIt; // target = entity; // } } if (target == null) { return; } double xyz[] = checkDistance(target, this.posX, this.posY, this.posZ); double x = xyz[0]; double y = xyz[1]; double z = xyz[2]; this.setThrowableHeading(x, y, z, 2.0F, 0.0F); } else if (!WorldHelper.isArrowInGround(this)) { System.out.println("TARGET != NULL"); if (target.getHealth() == 0) { target = null; return; } world.spawnParticle("flame", box.maxX, box.maxY, box.maxZ, 0.0D, 0.0D, 0.0D); this.setPositionAndRotation(target.posX, target.posY, target.posZ, target.rotationYaw, target.rotationPitch); double xyz[] = checkDistance(target, this.posX, this.posY, this.posZ); double x = xyz[0]; double y = xyz[1]; double z = xyz[2]; this.setThrowableHeading(x, y, z, 2.0F, 0.0F); } } private double distanceTo(EntityLiving entity) { double [] ds = new double [] { this.posX - entity.posX, this.posY - entity.posY, this.posZ - entity.posZ }; double d = 0; for (int i = 0; i < 3; i++) d += ds[i] * ds[i]; return Math.sqrt(d); } private double[] checkDistance(EntityLiving entity, double x, double y, double z){ double rX, rY, rZ; System.out.println("LOCATION OF ENTITY: " + entity.posX + ", " + entity.posY + ", " + entity.posZ); rX = x; rY = y; rZ = z; if(entity.posX != x){ if(entity.posX > x){ rX =+ entity.posX; } else{ rX--; } } if(entity.posY != y){ if(entity.posY > y){ rY =+ entity.posY; } } if(entity.posZ != z){ if(entity.posZ > z){ rZ =+ entity.posZ; } else{ rZ--; } } double rValues[] = {rX, rY, rZ}; for(int i = 0; i < rValues.length; i++){ if(i == 0){System.out.println("x " + rValues[i]);} if(i == 1){System.out.println("y " + rValues[i]);} if(i == 2){System.out.println("z " + rValues[i]);} } return rValues; } }
-
Check Line 26 of your VillagerKing file. You're missing a ; as seen by
-
[1.7.10] NullPointerException when editing guiButton.displayText
artman41 replied to artman41's topic in Modder Support
I'm adding a button to allow the search bar in ProjectE to interface with the NEI search bar. Here's the code: package moze_intel.projecte.gameObjs.gui; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.network.simpleimpl.IMessage; import moze_intel.projecte.PECore; import moze_intel.projecte.gameObjs.container.TransmuteContainer; import moze_intel.projecte.gameObjs.tiles.TransmuteTile; import moze_intel.projecte.network.PacketHandler; import moze_intel.projecte.network.packets.ClientSyncTabletLinkPKT; import moze_intel.projecte.network.packets.SearchUpdatePKT; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiTextField; import org.lwjgl.opengl.GL11; public class GUITransmute extends GuiContainer { private static final ResourceLocation texture = new ResourceLocation(PECore.MODID.toLowerCase(), "textures/gui/transmute.png"); private TransmuteTile tile; private GuiTextField textBoxFilter; private GuiButton neiLink; int xLocation; int yLocation; int neiLinkID = 1; int neiLinkWidth = 15; int neiLinkHeight = 10; private static int isLinkEnabled = 0; public GUITransmute(InventoryPlayer invPlayer, TransmuteTile tile) { super(new TransmuteContainer(invPlayer, tile)); this.tile = tile; this.xSize = 228; this.ySize = 196; } @Override public void initGui() { tile.setPlayer(Minecraft.getMinecraft().thePlayer); super.initGui(); this.xLocation = (this.width - this.xSize) / 2; this.yLocation = (this.height - this.ySize) / 2; this.textBoxFilter = new GuiTextField(this.fontRendererObj, this.xLocation + 88, this.yLocation + 8, 45, 10); this.textBoxFilter.setText(tile.filter); drawButton(true, isLinkEnabled); } protected void actionPerformed(GuiButton guiButton) { super.actionPerformed(guiButton); switch(guiButton.id) { case 1: System.out.println("Button clicked"); if(this.isLinkEnabled == 0){ System.out.println("Disabled"); PacketHandler.sendToServer(new ClientSyncTabletLinkPKT(1)); drawButton(false, isLinkEnabled); } else{ System.out.println("Enabled"); PacketHandler.sendToServer(new ClientSyncTabletLinkPKT(0)); drawButton(false, isLinkEnabled); } break; } } public static int getLinkEnabled(){ return isLinkEnabled; } public static void setLinkEnabled(int i){ isLinkEnabled = i; } private void drawButton(boolean firstRun, int enabled){ if(firstRun){ this.buttonList.clear(); //id, x, y, width, height, text this.buttonList.add(new GuiButton(neiLinkID, this.textBoxFilter.xPosition, (this.textBoxFilter.yPosition + 10) + 2, neiLinkWidth, neiLinkHeight, "A")); this.isLinkEnabled = 0; }else{ try{ switch(enabled){ case 0: this.neiLink.displayString = "A"; break; case 1: this.neiLink.displayString = "B"; break; } } catch(NullPointerException e){ e.printStackTrace(); } } } @Override public void drawScreen(int par1, int par2, float par3) { super.drawScreen(par1, par2, par3); this.textBoxFilter.drawTextBox(); } @Override protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) { GL11.glColor4f(1F, 1F, 1F, 1F); Minecraft.getMinecraft().renderEngine.bindTexture(texture); this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); } @Override protected void drawGuiContainerForegroundLayer(int var1, int var2) { this.fontRendererObj.drawString("Transmutation", 6, 8, 4210752); String emc = String.format("EMC: %,d", (int) tile.getStoredEmc()); this.fontRendererObj.drawString(emc, 6, this.ySize - 94, 4210752); if (tile.learnFlag > 0) { this.fontRendererObj.drawString("L", 98, 30, 4210752); this.fontRendererObj.drawString("e", 99, 38, 4210752); this.fontRendererObj.drawString("a", 100, 46, 4210752); this.fontRendererObj.drawString("r", 101, 54, 4210752); this.fontRendererObj.drawString("n", 102, 62, 4210752); this.fontRendererObj.drawString("e", 103, 70, 4210752); this.fontRendererObj.drawString("d", 104, 78, 4210752); this.fontRendererObj.drawString("!", 107, 86, 4210752); tile.learnFlag--; } } @Override public void updateScreen() { super.updateScreen(); this.textBoxFilter.updateCursorCounter(); } @Override protected void keyTyped(char par1, int par2) { if (this.textBoxFilter.isFocused()) { this.textBoxFilter.textboxKeyTyped(par1, par2); String srch = this.textBoxFilter.getText().toLowerCase(); if (!tile.filter.equals(srch)) { PacketHandler.sendToServer(new SearchUpdatePKT(srch)); tile.filter = srch; tile.updateOutputs(); } } if (par2 == 1 || par2 == this.mc.gameSettings.keyBindInventory.getKeyCode() && !this.textBoxFilter.isFocused()) { this.mc.thePlayer.closeScreen(); } } @Override protected void mouseClicked(int x, int y, int mouseButton) { super.mouseClicked(x, y, mouseButton); int minX = textBoxFilter.xPosition; int minY = textBoxFilter.yPosition; int maxX = minX + textBoxFilter.width; int maxY = minY + textBoxFilter.height; if (mouseButton == 1 && x >= minX && x <= maxX && y <= maxY) { PacketHandler.sendToServer(new SearchUpdatePKT("")); tile.filter = ""; tile.updateOutputs(); this.textBoxFilter.setText(""); } this.textBoxFilter.mouseClicked(x, y, mouseButton); } @Override public void onGuiClosed() { super.onGuiClosed(); tile.learnFlag = 0; } } -
As said in the title, I'm getting a NullPointerException when I edit the guiButton.displayText. I'm doing this while the gui is open and I'm not sure of any other way of doing it. Any help? protected void actionPerformed(GuiButton guiButton) { super.actionPerformed(guiButton); switch(guiButton.id) { case 1: System.out.println("Button clicked"); if(this.isLinkEnabled == 0){ System.out.println("Disabled"); this.isLinkEnabled = 1; drawButton(false, isLinkEnabled); } else{ System.out.println("Enabled"); this.isLinkEnabled = 0; drawButton(false, isLinkEnabled); } break; } //Packet code here //PacketDispatcher.sendPacketToServer(packet); //send packet } private void drawButton(boolean firstRun, int enabled){ if(firstRun){ this.buttonList.clear(); //id, x, y, width, height, text this.buttonList.add(new GuiButton(neiLinkID, this.textBoxFilter.xPosition, (this.textBoxFilter.yPosition + 10) + 2, neiLinkWidth, neiLinkHeight, "A")); this.isLinkEnabled = 0; }else{ try{ switch(enabled){ case 0: this.neiLink.displayString = "A"; break; case 1: this.neiLink.displayString = "B"; break; } } catch(NullPointerException e){ e.printStackTrace(); } } }
-
[1.7.10] [solved] Teleports 10 block lower than than the given Y value
artman41 replied to artman41's topic in Modder Support
This fixed it thanks -
[1.7.10] [solved] Teleports 10 block lower than than the given Y value
artman41 replied to artman41's topic in Modder Support
I'd still be in the floor about 7-8 blocks lower than I teleported to though -
Any help? I've been adding 10 to the newY value, but that causes unnecessary fall damage. here's the code: private static void teleportPlayer(EntityPlayerMP player){ int newX = (rand.nextInt(65536)-32768); int newY = 60; int newZ = (rand.nextInt(65536)-32768); boolean safe = safetyCheck(player.worldObj, newX, newY, newZ); while(!safe){ newY++; safe = safetyCheck(player.worldObj, newX, newY, newZ); //System.out.println("BlockExists: " + safe); } player.playerNetServerHandler.setPlayerLocation(newX, newY + 13, newZ, player.rotationYaw, player.rotationPitch); afterCheck(player, newX, newY, newZ); } --EDIT-- If you have the same problem as me, the code you need to use is player.setPositionAndUpdate(newX, newY, newZ);
-
If you're going to be using models a lot, I would suggest adding Tabula by Ichun to your develpoment workspace. It's almost exactly the same as techne except that it's updated, the exported code works for 1.7 and there's some other features. It also runs in your mc client so there's no need to have another program open
-
I'm trying to check to see if a block at some co-ords is equal to either air or to water. However, even if it is air, it still returns true. Any help please? I'm a bit confused. private static boolean doesBlockExist(int x, int y, int z){ if(Minecraft.getMinecraft().theWorld.getBlock(x, y, z) == Blocks.air){ System.out.println("Block: " + Minecraft.getMinecraft().theWorld.getBlock(x, y, z)); return false; }else if(Minecraft.getMinecraft().theWorld.getBlock(x, y, z) == Blocks.water){ System.out.println("Block: " + Minecraft.getMinecraft().theWorld.getBlock(x, y, z)); return false; }else{ System.out.println("Block: " + Minecraft.getMinecraft().theWorld.getBlock(x, y, z)); return true; } } -- EDIT -- I have fixed the code thanks! For anyone who is having the same problems, you need to use the server side world, which you can get from the EntityPlayerMP via player.worldObj
-
[1.8] How to check when a player has levelled up
artman41 replied to artman41's topic in Modder Support
Thanks for the idea will get on it -
What he means is you need to learn simple coding in general. For example, when reading the pastebin Diesieben made, I noticed that your public method didn't have a closing brace (}) you opened two braces and only close one. You need to learn how to use simple code like diesie said before tackling things like this. If I were you, I would try a simpler language or learn how IF, AND and NOT functions work and watch a tutorial about how to use them. Learn the language and the general rules about them. 9 times out of 10, indentation WILL help identify a problem. To identify a problem, follow the code; it's a piece of text that should do what you want when you read it in your head and indentation will help you read it. Copying and Pasting is also not learning how to code. It's cheating and you'll learn nothing that way. Try to achieve somethings on your own. For example, create a java app that calls a method that checks if a boolean is true or false and then outputs something to the console, WITHOUT googling for help and copying. Training yourself with exercises like this is what will help you learn how to code.
-
If you're looking to get an item from right-clicking on bushes, check the code for Tinkers' Construct: https://github.com/SlimeKnights/TinkersConstruct/blob/master/src/main/java/tconstruct/world/blocks/OreberryBush.java <-- is a bush similar to yours from the sounds of it https://github.com/SlimeKnights/TinkersConstruct/tree/master/src/main/java/tconstruct <-- the link to all the code
-
I want to perform a method when the player levels up but I can't see a method I can override inside of EntityPlayer to do this, is there sn event I can hook into that will let me trigger a method when the player levels up?