Jump to content

Exo594

Members
  • Posts

    23
  • Joined

  • Last visited

Everything posted by Exo594

  1. Up until now, I've been testing my mods by using "Run->client" in the NetBeans alt-click menu. What do I need to do to properly simulate a client-server situation? I've seen the "run->server" option used several times, but no tutorials I've found have demonstrated how to set it up. When I've clicked "run->server" previously, it tells me I need to agree to the EULA, but I can't find where that's located in my files.
  2. Well, there's this: FMLNetworkEvent.ServerConnectionFromClientEvent Fired at the server when a client is about to connect Which MAY work. The server would store the list, and if the client is "owned" by a non-whitelisted identity, then you may be able to kick said person using this event.
  3. Okay, thank you. I had suspected it was something like that, but a lot of this network stuff is pretty head-spinning for me.
  4. I'm trying to use TGG's MinecraftByExample code to figure out some things for 1.7.10. Right now, I'm having trouble with some of the code in the network messages content. https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/mbe60_network_messages/MessageHandlerOnClient.java#L50 Above is his class, and when I pull it into a 1.7.10 environment, it doesn't like line 50. What should I be using there for a 1.7.10 version of his code? The rest of the code in the class doesn't show any errors at the moment.
  5. Try this: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-creating-custom.html
  6. Update: I've managed to "solve" the problem. I figured out that it was only affecting blocks that had defined light values, so by removing those traits from my blocks, I've managed to fix the rendering problem in regards to my blocks. At that point, it was still bugging OTHER lit blocks like Glowstone and Redstone Lamps, so I eventually managed to figure it out by removing the luminosity trait from the liquid itself. This is a pretty annoying way to have to "fix" this problem, I'd really like for those values to NOT cause rendering issues.
  7. It only does it to 3 of my own blocks: "BasicBlock", "Tutorium Furnace", and "Mining Charge". It doesn't appear to do it with vanilla blocks, at least not the ones I tested. Each has their own class, but the BasicBlock class was from a tutorial on making generic blocks without specific functions. I've only messed around with the specific overrides for the fluid and for the BasicBlock class, thinking resolving that case would make it a bit more obvious what to do. And yes, that is the custom fluid, I'm just stealing the water texture for now. All of the fluid is source-blocks, the error disappears when the fluid is running, IE, a flowing fluid will not cause the same glitch, only faces of the particular blocks that are in contact with source-blocks will render invisibly. http://i1200.photobucket.com/albums/bb321/Exo594/2015-09-21_19.58.50_zpsypwmph2b.png[/img] I've tested it with a lot of other random vanilla (and Thaumcraft) blocks, but none of them suffer the same glitch. I've got "my" two ores there, the Mining Charge block, the Tutorium Furnace block, "my" 2-input machine, the one block made from "my" Basic Block class, and a sampling of vanilla blocks. Those are all the blocks I've made for this "mod", too. In this screenshot, I've got code in my Basic Block class for overriding the OpaqueCube, NormalBlock, RenderType, and even the shouldSideBeRendered and isBlockSolid functions. I believe my current GitHub push has those shown, but I've been fiddling around with those specifics without updating GitHub. I hope this gives you enough to go on.
  8. It's been a week now, is it fair to bump this?
  9. I've attempted to create a custom fluid following the tutorial given at the wiki for 1.7.2: http://www.minecraftforge.net/wiki/Create_a_Fluid I'm having an issue where placing my fluid source block next to certain other of my blocks will cause the solid blocks to render with the sides touching the liquid invisible, causing an x-ray glitch. I've attempted to solve this problem by explicitly calling some of the rendering functions in my "BasicBlock" class, which didn't work. Changing the extension on the fluid block from "BlockFluidClassic" to "BlockLiquid" fixes the rendering issue, but I want a flowing liquid, not a motionless goo. Here's the code for my custom fluid: https://github.com/Exo594/TutorialWork/blob/master/src/src/main/java/com/exo594/tutorial/block/BlockTutoriumSolution.java And here's the code for my custom block, attempted overrides and all. https://github.com/Exo594/TutorialWork/blob/master/src/src/main/java/com/exo594/tutorial/block/BasicBlock.java
  10. IntelliJ's probably #2 most common when it comes to modding IDEs. I'm using NetBeans, ffs. http://www.minecraftforge.net/forum/index.php?topic=21354.0
  11. Wow, a whole hour at just above min. wage. Look at boats or see if Archimedes Ships has a public source code.
  12. I am unable to get the entity associated with my TNT-like block to render in-world. I've looked at tons of examples on how it's been done previously and an equivalent number of "Help Me" topics, but nothing's worked for me yet. I've even attempted to use the vanilla TNT rendering code in the registry, to no avail. I know the entity is "alive", because it's dropping due to gravity and is exploding properly. Here's my code bits: Rendering Class, mostly copied over from vanilla RenderTNTPrimed Class. https://github.com/Exo594/TutorialWork/blob/master/src/src/main/java/com/exo594/tutorial/ExplosiveRender.java Entity for the TNT-clone. https://github.com/Exo594/TutorialWork/blob/master/src/src/main/java/com/exo594/tutorial/entities/EntityMiningChargePrimed.java ClientProxy Class, register for Rendering the entity is on line 33. https://github.com/Exo594/TutorialWork/blob/master/src/src/main/java/com/exo594/tutorial/ClientProxy.java Main class, Entity registry for TNT entity is on line 85. https://github.com/Exo594/TutorialWork/blob/master/src/src/main/java/com/exo594/tutorial/Main.java Block Class, just in case you need that. https://github.com/Exo594/TutorialWork/blob/master/src/src/main/java/com/exo594/tutorial/block/MiningCharge.java At time of edit: I've placed systemout statements in my doRender and RenderPrimedTNT methods, and it appears that they're not being triggered at all. I had assumed from the examples I'd seen that doRender was called by some skeleton class in Forge or FML, or even in Vanilla code, but I guess not. I've attempted to call it from my Entity class when the entity updates, but it bitches at me about static and non-static contexts.
  13. After changing out the recipe locations, shifting around the way my ArrayLists were called to ensure the HashMap was constructed properly, and implementing the .getItem() bits, I am pleased to say that everything works properly now. Thank you both for your help.
  14. This might be totally obvious, but how do I get around that issue? If I put these: addMashingRecipeWithTwoItems(ModItems.tutorialItem, Items.bread, new ItemStack(ModItems.tutoriumLoaf)); addMashingRecipeWithTwoItems(Items.iron_ingot, ModItems.tutorialItem, new ItemStack(ModItems.craftingPendulum)); addMashingRecipeWithOneBlock(Blocks.glowstone, Items.diamond, new ItemStack(ModItems.tutoriumGrenade, 1)); inside another method, and then call that method in the same place that I call my shaped, shapeless, and smelting recipes from, would that take care of the issue?
  15. Line 33 of IngotMasherRecipes is this: addMashingRecipeWithTwoItems(ModItems.tutorialItem, Items.bread, new ItemStack(ModItems.tutoriumLoaf)); Which is part of this: private IngotMasherRecipes() { addMashingRecipeWithTwoItems(ModItems.tutorialItem, Items.bread, new ItemStack(ModItems.tutoriumLoaf)); addMashingRecipeWithTwoItems(Items.iron_ingot, ModItems.tutorialItem, new ItemStack(ModItems.craftingPendulum)); addMashingRecipeWithOneBlock(Blocks.glowstone, Items.diamond, new ItemStack(ModItems.tutoriumGrenade, 1)); }
  16. I've got a custom machine (a two-input, one output "machine") that I cobbled together out of a tutorial series, starting with this video: I managed to get everything working (even better than the tutorial demonstrated), and I had the machine's recipes working on a list-based system, which was functional, but ugly. I wanted to make it a bit more elegant, so I copied over the vanilla furnace's recipe system and changed it around a bit so that it would accept ArrayLists instead of ItemStacks as the key for the HashMap that the recipes are stored in. It no longer works, and will crash the game when attempting to cook any valid recipes. I don't know if the Vanilla FurnaceRecipes class has anything special done to make it work properly OUTSIDE of that class, but I have a feeling that there's something like that. I'd link you to GitHub for this, as these classes already have tons of code, but I don't actually have that set up yet. Recipe "Handler" Class package com.exo594.tutorial; import com.exo594.tutorial.item.ModItems; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public final class IngotMasherRecipes { public static final IngotMasherRecipes mashingBase = new IngotMasherRecipes(); private static Map mashingList = new HashMap(); ArrayList<ItemStack> addingKeyList = new ArrayList<ItemStack>(); private static final Item[] ITEMS = new Item[]{Items.bread, ModItems.tutorialItem}; //ArrayList<ItemStack> addingValueList = new ArrayList<ItemStack>(); public static IngotMasherRecipes mashing() { return mashingBase; } private IngotMasherRecipes() { this.addMashingRecipeWithTwoItems(ModItems.tutorialItem, Items.bread, new ItemStack(ModItems.tutoriumLoaf)); this.addMashingRecipeWithTwoItems(Items.iron_ingot, ModItems.tutorialItem, new ItemStack(ModItems.craftingPendulum)); this.addMashingRecipeWithOneBlock(Blocks.glowstone, Items.diamond, new ItemStack(ModItems.tutoriumGrenade, 1)); } //used to tell transferItemInStack to play nice with items, apparantly not quite working properly public static Boolean itemCanBeMashed(ItemStack itemstack) { if (Arrays.asList(ITEMS).contains(itemstack.getItem())) { return true; } else { return false; } } public void addMashingRecipeWithOneBlock(Block blockIn, Item itemIn, ItemStack itemOut) { this.addMashingRecipeWithTwoItems(Item.getItemFromBlock(blockIn), itemIn, itemOut); } public void addMashingRecipeWithTwoBlocks(Block blockOneIn, Block blockTwoIn, ItemStack itemOut) { this.addMashingRecipeWithTwoItems(Item.getItemFromBlock(blockOneIn), Item.getItemFromBlock(blockTwoIn), itemOut); } public void addMashingRecipeWithTwoItems(Item itemOneIn, Item itemTwoIn, ItemStack itemOut) { this.addRecipeFinal(new ItemStack(itemOneIn, 1, 0), new ItemStack(itemTwoIn, 1, 0), itemOut); } public void addRecipeFinal(ItemStack itemOneIn, ItemStack itemTwoIn, ItemStack itemOut) { addingKeyList.add(itemOneIn); addingKeyList.add(itemTwoIn); //addingValueList.add(itemOut); IngotMasherRecipes.mashingList.put(addingKeyList, itemOut); addingKeyList.clear(); //addingValueList.clear(); } public static ItemStack getMashingResult(ArrayList<ItemStack> list) //restructure to take ArrayLists, not ItemStacks { Iterator iterator = mashingList.entrySet().iterator(); Map.Entry entry; do { if (!iterator.hasNext()) { return null; } entry = (Map.Entry)iterator.next(); } while (!func_151397_a(list, (ArrayList<ItemStack>)entry.getKey())); return (ItemStack)entry.getValue(); } private static boolean func_151397_a(ArrayList<ItemStack> list, ArrayList<ItemStack> keyBeingChecked) { return (keyBeingChecked.get(0) == list.get(0) && keyBeingChecked.get(0) == list.get(0)) || (keyBeingChecked.get(1) == list.get(0) && keyBeingChecked.get(0) == list.get(1)); } public Map getMashingList() { return this.mashingList; } /* //list-based methods for determining recipe outputs, read off of now-deleted lists. public static ItemStack getMashingResult(Item item, Item item2) { return getOutput(item, item2); } public static ItemStack getOutput(Item item, Item item2) { for (int i = 0; i < recipeList.length; ++i) { int j = 0; if (item == recipeList[i][j] && item2 == recipeList[i][j + 1] || item == recipeList[i][j+1] && item2 == recipeList[i][j]) { return new ItemStack(recipeList[i][j + 2], amountList[i]); } else { return null; } } return null; }*/ } TileEntity for this machine package com.exo594.tutorial.tileentities; import com.exo594.tutorial.IngotMasherRecipes; import com.exo594.tutorial.block.IngotMasher; import java.util.ArrayList; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; public class TileEntityIngotMasher extends TileEntity implements ISidedInventory { ArrayList<ItemStack> mashingResultsList = new ArrayList<ItemStack>(); public ItemStack slots[]; public int dualPower; public int dualCookTime; public static final int maxPower = 10000; public static final int mashingSpeed = 100; private static final int[] slots_top = new int[]{0, 1}; private static final int[] slots_bottom = new int[]{3}; private static final int[] slots_side = new int[]{2}; private String customName; public ItemStack result; public TileEntityIngotMasher() { slots = new ItemStack[4]; } @Override public int getSizeInventory() { return slots.length; } @Override public ItemStack getStackInSlot(int i) { return slots[i]; } @Override public ItemStack getStackInSlotOnClosing(int i) { if (slots[i] != null) { ItemStack itemstack = slots[i]; slots[i] = null; return itemstack; } else { return null; } } @Override public void setInventorySlotContents(int i, ItemStack itemstack) { slots[i] = itemstack; if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { itemstack.stackSize = getInventoryStackLimit(); } } @Override public int[] getAccessibleSlotsFromSide(int i) { return i == 0 ? slots_bottom : (i == 1 ? slots_top : slots_side); } @Override public int getInventoryStackLimit() { return 64; } @Override public boolean isUseableByPlayer(EntityPlayer player) { if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) { return false; } else { return player.getDistanceSq((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D) <= 64; } } @Override public void openInventory() { } @Override public void closeInventory() { } @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { return i == 3 ? false : (i == 2 ? hasItemPower(itemstack) : true); } public static boolean hasItemPower(ItemStack itemstack) { return getItemPower(itemstack) > 0; } private static int getItemPower(ItemStack itemstack) { if (itemstack == null) { return 0; } else { Item item = itemstack.getItem(); if (item == Items.apple) { return 1000; } else { return 0; } } } @Override public ItemStack decrStackSize(int i, int j) { if (slots[i] != null) { if (slots[i].stackSize <= j) { ItemStack itemstack = slots[i]; slots[i] = null; return itemstack; } ItemStack itemstack1 = slots[i].splitStack(j); if (slots[i].stackSize == 0) { slots[i] = null; } return itemstack1; } else { return null; } } @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); NBTTagList list = nbt.getTagList("Items", 10); slots = new ItemStack[getSizeInventory()]; for (int i = 0; i < list.tagCount(); i++) { NBTTagCompound nbt1 = (NBTTagCompound) list.getCompoundTagAt(i); byte b0 = nbt1.getByte("Slot"); if (b0 >= 0 && b0 < slots.length) { slots[b0] = ItemStack.loadItemStackFromNBT(nbt1); } } dualPower = nbt.getShort("PowerTime"); dualCookTime = nbt.getShort("CookTime"); } @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setShort("PowerTime", (short) dualPower); nbt.setShort("CookTime", (short) dualCookTime); NBTTagList list = new NBTTagList(); for (int i = 0; i < slots.length; i++) { if (slots[i] != null) { NBTTagCompound nbt1 = new NBTTagCompound(); nbt1.setByte("Slot", (byte) i); slots[i].writeToNBT(nbt1); list.appendTag(nbt1); } } nbt.setTag("Items", list); } @Override public String getInventoryName() { return "container.ingotMasher"; } @Override public boolean canInsertItem(int var1, ItemStack itemstack, int var3) { return this.isItemValidForSlot(var1, itemstack); } @Override public boolean canExtractItem(int i, ItemStack itemstack, int j) { return j != 0 || i != 1 || itemstack.getItem() == Items.bucket; } @Override public boolean hasCustomInventoryName() { return this.customName != null && this.customName.length() > 0; } public int getMasherProgressScaled(int i) { return (dualCookTime * i) / this.mashingSpeed; } public int getPowerRemainingScaled(int i) { return (dualPower * i) / maxPower; } private boolean canMash() { if (slots[0] == null || slots[1] == null) { return false; } if (slots[0] != null && slots[1] != null) { mashingResultsList.add(new ItemStack(this.slots[0].getItem())); mashingResultsList.add(new ItemStack(this.slots[1].getItem())); result = IngotMasherRecipes.getMashingResult(mashingResultsList); mashingResultsList.clear(); }else{ result = null; } if (result == null) { return false; } if (slots[3] == null) { return true; } if (!slots[3].isItemEqual(result)) { return false; } if (slots[3].stackSize < getInventoryStackLimit() && slots[3].stackSize < slots[3].getMaxStackSize()) { return true; } else { return slots[3].stackSize < result.getMaxStackSize(); } } private void mashItem() { if (canMash()) { if (slots[0] != null && slots[1] != null) { mashingResultsList.add(new ItemStack(this.slots[0].getItem())); mashingResultsList.add(new ItemStack(this.slots[1].getItem())); ItemStack itemstack = IngotMasherRecipes.getMashingResult(mashingResultsList); mashingResultsList.clear(); if (slots[3] == null) { slots[3] = itemstack.copy(); } else if (slots[3].isItemEqual(itemstack)) { slots[3].stackSize += itemstack.stackSize; } for (int i = 0; i < 2; i++) { if (slots[i].stackSize <= 0) { slots[i] = new ItemStack(slots[i].getItem().setFull3D()); } else { slots[i].stackSize--; } if (slots[i].stackSize <= 0) { slots[i] = null; } } } } } public boolean hasPower() { return dualPower > 0; } public boolean isMashing() { return this.dualCookTime > 0; } @Override public void updateEntity() { boolean flag = this.hasPower(); boolean flag1 = false; if (hasPower() && this.isMashing()) { this.dualPower--; } if (!worldObj.isRemote) { if (this.hasItemPower(this.slots[2]) && this.dualPower < (this.maxPower - this.getItemPower(this.slots[2]))) { this.dualPower += getItemPower(this.slots[2]); if (this.slots[2] != null) { flag1 = true; this.slots[2].stackSize--; if (this.slots[2].stackSize == 0) { this.slots[2] = this.slots[2].getItem().getContainerItem(this.slots[2]); } } } if (hasPower() && canMash()) { dualCookTime++; if (this.dualCookTime == this.mashingSpeed) { this.dualCookTime = 0; this.mashItem(); flag1 = true; } } else { dualCookTime = 0; } if (flag != this.isMashing()) { flag1 = true; IngotMasher.updateBlockState(this.dualCookTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); } } if (flag1) { this.markDirty(); } } } Container Class package com.exo594.tutorial.containers; import com.exo594.tutorial.IngotMasherRecipes; import com.exo594.tutorial.slot.SlotIngotMasher; import com.exo594.tutorial.tileentities.TileEntityIngotMasher; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class ContainerIngotMasher extends Container { private TileEntityIngotMasher masher; private int dualCookTime; private int dualPower; private int lastItemBurnTime; public static final int INPUT_1 = 0, INPUT_2 = 1, FUEL = 2, OUTPUT = 3; public ContainerIngotMasher(InventoryPlayer invPlayer, TileEntityIngotMasher teIngotMasher) { dualCookTime = 0; dualPower = 0; lastItemBurnTime = 0; masher = teIngotMasher; this.addSlotToContainer(new Slot(teIngotMasher, INPUT_1, 45, 17)); this.addSlotToContainer(new Slot(teIngotMasher, INPUT_2, 45, 49)); this.addSlotToContainer(new Slot(teIngotMasher, FUEL, 8, 56)); this.addSlotToContainer(new SlotIngotMasher(invPlayer.player, teIngotMasher, OUTPUT, 113, 33)); //Inventory for (int i = 0; i < 3; i++) { for (int j = 0; j < 9; j++) { this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } //ActionBar for (int i = 0; i < 9; i++) { this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142)); } } @Override public void addCraftingToCrafters(ICrafting crafting) { super.addCraftingToCrafters(crafting); crafting.sendProgressBarUpdate(this, 0, this.masher.dualCookTime); crafting.sendProgressBarUpdate(this, 1, this.masher.dualPower); } @Override public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { ItemStack itemstack = null; Slot slot = (Slot) this.inventorySlots.get(par2); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); // If itemstack is in Output stack if (par2 == OUTPUT) { // try to place in player inventory / action bar; add 36+1 because mergeItemStack uses < index, // so the last slot in the inventory won't get checked if you don't add 1 if (!this.mergeItemStack(itemstack1, OUTPUT + 1, OUTPUT + 36 + 1, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); } // itemstack is in player inventory, try to place in appropriate furnace slot else if (par2 != FUEL && par2 != INPUT_1 && par2 != INPUT_2) { // if it can be smelted, place in the input slots if (IngotMasherRecipes.itemCanBeMashed(itemstack1)) { //DOES NOT LIKE SOME PART OF THIS LINE // try to place in either Input slot; add 1 to final input slot because mergeItemStack uses < index if (!this.mergeItemStack(itemstack1, INPUT_1, INPUT_2 + 1, false)) { return null; } } // if it's an energy source, place in Fuel slot else if (TileEntityIngotMasher.hasItemPower(itemstack1)) { if (!this.mergeItemStack(itemstack1, FUEL, FUEL + 1, false)) { return null; } } // item in player's inventory, but not in action bar else if (par2 >= OUTPUT + 1 && par2 < OUTPUT + 28) { // place in action bar if (!this.mergeItemStack(itemstack1, OUTPUT + 28, OUTPUT + 37, false)) { return null; } } // item in action bar - place in player inventory else if (par2 >= OUTPUT + 28 && par2 < OUTPUT + 37 && !this.mergeItemStack(itemstack1, OUTPUT + 1, OUTPUT + 28, false)) { return null; } } // In one of the infuser slots; try to place in player inventory / action bar else if (!this.mergeItemStack(itemstack1, OUTPUT + 1, OUTPUT + 37, false)) { return null; } if (itemstack1.stackSize == 0) { slot.putStack((ItemStack) null); } else { slot.onSlotChanged(); } if (itemstack1.stackSize == itemstack.stackSize) { return null; } slot.onPickupFromSlot(par1EntityPlayer, itemstack1); } return itemstack; } @Override public boolean canInteractWith(EntityPlayer player) { return masher.isUseableByPlayer(player); } @Override public void detectAndSendChanges() { super.detectAndSendChanges(); for (int i = 0; i < this.crafters.size(); i++) { ICrafting icrafting = (ICrafting) this.crafters.get(i); if (this.dualCookTime != this.masher.dualCookTime) { icrafting.sendProgressBarUpdate(this, 0, this.masher.dualCookTime); } if (this.dualPower != this.masher.dualPower) { icrafting.sendProgressBarUpdate(this, 1, this.masher.dualPower); } } this.dualCookTime = this.masher.dualCookTime; this.dualPower = this.masher.dualPower; } @SideOnly(Side.CLIENT) @Override public void updateProgressBar(int slot, int newValue) { if (slot == 0) { this.masher.dualCookTime = newValue; } if (slot == 1) { this.masher.dualPower = newValue; } } } Block Class package com.exo594.tutorial.block; import com.exo594.tutorial.Main; import com.exo594.tutorial.tileentities.TileEntityIngotMasher; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class IngotMasher extends BlockContainer { private Random rand; private final boolean isActive; private static boolean keepInventory = true; @SideOnly(Side.CLIENT) private IIcon iconFront; public IngotMasher(String unlocalizedName, boolean blockState) { super(Material.iron); rand = new Random(); isActive = blockState; this.setBlockName(unlocalizedName); } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon(Main.MODID + ":" + ("tutoriumFurnaceOther")); this.iconFront = iconRegister.registerIcon(Main.MODID + ":" + (this.isActive ? "IngotMasherFrontOn" : "IngotMasherFrontOff")); } @SideOnly(Side.CLIENT) @Override public IIcon getIcon(int side, int metadata) { return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon); } @Override public void onBlockAdded(World world, int x, int y, int z) { super.onBlockAdded(world, x, y, z); this.setDefaultDirection(world, x, y, z); } private void setDefaultDirection(World world, int x, int y, int z) { if (!world.isRemote) { Block block1 = world.getBlock(x, y, z - 1); Block block2 = world.getBlock(x, y, z + 1); Block block3 = world.getBlock(x - 1, y, z); Block block4 = world.getBlock(x + 1, y, z); byte b0 = 3; if (block1.func_149730_j() && !block2.func_149730_j()) { b0 = 3; } if (block2.func_149730_j() && !block1.func_149730_j()) { b0 = 2; } if (block3.func_149730_j() && !block4.func_149730_j()) { b0 = 5; } if (block4.func_149730_j() && !block3.func_149730_j()) { b0 = 4; } world.setBlockMetadataWithNotify(x, y, x, b0, 2); } } @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityPlayer, ItemStack itemstack) { int i = MathHelper.floor_double((double) (entityPlayer.rotationYaw * 4.0F / 360F) + 0.5D) & 3; if (i == 0) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } if (i == 1) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } if (i == 2) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } if (i == 3) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } if (itemstack.hasDisplayName()) { //((TileEntityIngotMasher)world.getTileEntity(x, y, z)).setCustomName(itemstack.getDisplayName()); } } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (world.isRemote) { return true; } else if (!player.isSneaking()) { TileEntityIngotMasher entity = (TileEntityIngotMasher) world.getTileEntity(x, y, z); if (entity != null) { FMLNetworkHandler.openGui(player, Main.modInstance, Main.guiIDIngotMasher, world, x, y, z); } return true; } else { return false; } } @Override public TileEntity createNewTileEntity(World var1, int var2) { return new TileEntityIngotMasher(); } public static void updateBlockState(boolean isMashing, World world, int xCoord, int yCoord, int zCoord) { int i = world.getBlockMetadata(xCoord, yCoord, zCoord); TileEntity entity = world.getTileEntity(xCoord, yCoord, zCoord); keepInventory = true; if (isMashing) { world.setBlock(xCoord, yCoord, zCoord, ModBlocks.blockIngotMasherActive); } else { world.setBlock(xCoord, yCoord, zCoord, ModBlocks.blockIngotMasherIdle); } keepInventory = false; world.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, i, 2); if (entity != null) { entity.validate(); world.setTileEntity(xCoord, yCoord, zCoord, entity); } } @Override public void breakBlock(World world, int x, int y, int z, Block oldblock, int oldMetadata) { if (!keepInventory) { TileEntityIngotMasher tileentity = (TileEntityIngotMasher) world.getTileEntity(x, y, z); if (tileentity != null) { for (int i = 0; i < tileentity.getSizeInventory(); i++) { ItemStack itemstack = tileentity.getStackInSlot(i); if (itemstack != null) { float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; while (itemstack.stackSize > 0) { int j = this.rand.nextInt(21) + 10; if (j > itemstack.stackSize) { j = itemstack.stackSize; } itemstack.stackSize -= j; EntityItem item = new EntityItem(world, (double) ((float) x + f), (double) ((float) y + f1), (double) ((float) z + f2), new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage())); if (itemstack.hasTagCompound()) { item.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); } world.spawnEntityInWorld(item); } } } world.func_147453_f(x, y, z, oldblock); } } super.breakBlock(world, x, y, z, oldblock, oldMetadata); } } HerpaDerp, crashlog.
  17. I tried that, but it put some of my parts' textures outside the space. I did manage to solve this, though. I moved the map-areas for the head's added "horn" blocks down, and left the top 64*32 as a plain "Biped" map. After re-loading Techne, it worked. http://i1200.photobucket.com/albums/bb321/Exo594/Screenshot%2011_zpsrizbtg4y.png[/img] Thank you for your input, though. I'll be attempting to make use of some of your tutorials for the next step.
  18. I'm attempting to make an armor model in Techne by roughly following this tutorial: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2175721-1-7-10-coding-custom-3d-armor-models-video-series, and I've got an issue when I attempt to import the textures. I've attempted to look up answers online, but I'm not able to find anything significant aside from one very poorly described answer and a handful of unanswered topics. http://i1200.photobucket.com/albums/bb321/Exo594/Screenshot%209_zps0oedmf0v.png[/img] Here's the model as is. I started off with a re-sized texturemap (64*64), and used the Bipedal Model Base. http://i1200.photobucket.com/albums/bb321/Exo594/Screenshot%2010_zpsllapaiqa.png[/img] Here's the result I get when I import the texture-map back in. http://i1200.photobucket.com/albums/bb321/Exo594/TutorialArmorModelTexture_Part1_zps07woliuf.png[/img] http://i1200.photobucket.com/albums/bb321/Exo594/TutorialArmorModelTexture_Part2_zpsk34s0qcv.png[/img] These are the texture-maps, I've not moved the base Biped parts from that map. What's causing this? Would it be the blocks I've added to the base model? Is it "legal" to add blocks to the base models? What can I try to fix this? Does this error even matter? I've yet to attempt this in code, is it likely that this would resolve itself in code?
  19. Would it be more approachable if you were to have multiple "material" types that you could convert to? I imagine you could right-click the SWORD and consume a soul item, then swap materials, or even swap entire swords, removing the one clicked from your inventory and placing the new one in its place. If you had multiple "types" of swords, then you could use a series of "if" statements to determine which souls would be prioritized for consumption. I don't know enough about your ideal game-mechanics to flesh this idea out, but this is how I would do it.
  20. Thank you. After swapping the "tickEvent" for onArmorTick, it's working properly and appropriately. Now, I just need to remove creative flight with the removal of armor, but I can certainly handle that. I'm back using tickEvents, but I passed "EntityPlayer player" inside the "private void tickEvent(PlayerTickEvent evt)", which seems to have solved the original issue. Using onArmorTick wasn't working properly, I ran into a few issues shortly after posting.
  21. I've got an enchantment that is supposed to allow a player to have creative flight. I've got the program to register the enchantment already, got it specified for what it can be applied to and all that. All that works, and what's below is the bits that are supposed to check the armor for the enchantment and allow the player to have flight. Problem is, NetBeans refuses to realize the "player" part of "player.capabilities.allowFlight" as a package. I've got the proper import for this (I believe, I spent a lot of time looking at similar code), and this statement should be legal, so I have no idea what's going on here. Is this actually the correct way to do this? This statement is the only way I've seen it done. And a secondary question: Overall, is this code structure an efficient way to do this? I didn't see any "onEquip" events in the lists I've read. package com.exo594.tutorial.enchantment; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent; import net.minecraft.enchantment.Enchantment; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.entity.player.EntityPlayer; //<<<NetBeans claims this import is unused<<< public class ModEnchantments { public static Enchantment addFlight; public static int ADDFLIGHT_ID = 100; public static boolean hasAddFlight = false; public static void init() { addFlight = new EnchantmentAddFlight(); Enchantment.addToBookList(addFlight); } @SubscribeEvent private void tickEvent(PlayerTickEvent evt) { Item chestplate = null; ItemStack stackChestplate = evt.player.inventory.armorItemInSlot(2); if (stackChestplate != null) { chestplate = stackChestplate.getItem(); } if (stackChestplate.stackTagCompound != null) { if (stackChestplate.stackTagCompound.getTag("ench") != null) { NBTTagList enchants = (NBTTagList) stackChestplate.stackTagCompound.getTag("ench"); for (int i = 0; i < enchants.tagCount(); i++) { NBTTagCompound enchant = ((NBTTagList) enchants) .getCompoundTagAt(i); if (enchant.getInteger("id") == 100) { hasAddFlight = true; player.capabilities.allowFlying = true; //<<<NetBeans does't like this line here, tooltip says "package player does not exist" <<< break; } } } } } } And yes, I am aware I need a tick handler in my proxies.
  22. I'm REALLY not sure where to put this type of question, but because I'm writing a mod, and the question pertains to the writing of that mod, and you all are modders, I figured this would be roughly appropriate to place here. I also saw only one other similar question, which appeared more focused on how the vanilla materials were balanced against each other, so I guess no one's posted something like this before. Actual question(s): 1. What defines "Overpowered" in relation to other mods? Almost every mod's weapons and armor are severely underpowered when held up against Draconic Evolution, for example, but mod-players get to diamonds in just a few hours without notably trying, so vanilla weapons and armor are really cheap for what they do. 2. What do YOU, dear reader, do in attempts to balance your tools and armor, if anything at all? Do you prefer crafting costs or unusual crafting mechanics, energy costs, durability costs, or making use of arbitrarily expensive materials that require arbitrarily complex manufacturing methods to create? 3. How much does this really matter? Should I just throw these in a config file and let the player/admins determine what's a fair tool for each pack?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.