Hey, I'd love to help code MineFantasy. It's been awhile since I've worked on something as a team.
Also, I know how to setup github for the centralized source
Hi there!
If you would like, I could make the basics on the mods on 1.7.2 with forge (most mods use forge anyway) and you could see if there's anything you like, don't like, etc. So uh, post back when you miss your not-so-lovesick boyfriend
Username (Or name you prefer to be called):Age: 17Professions (Programming, Graphics, Modeling, etc.): ProgrammingDevelopment Position: Availability: After the 26th of July, daily until Crew Practice starts, and then every other more or lessTime Zone: ESTDid actually you read this entire thread?: Yes, the amazing models intrigued me.On a scale of 1-10, how much do you want this to become a reality?:42
It seem's I've necro'd because I didn't look at the date, but I'll still gladly help with modding
Hi,
I was looking through the code for Tinkers Construct and I noticed that method that the hammer uses to determine which direction to mine in. I am slightly confused as how it works. What is the first part, up through the first if statement doing?
Thanks for the help
Jay
Hey nachtmahr66,
For this to work for all chests, modded and vanilla, you would have to edit the base TileEntity Chest and then assume that the modded chest use TileEntity Chest too. Maybe a new chest with a slightly harder recipe (Chest + Slime?)would be easier to implement and use.
Hey everybody, back for another episode of "Why does everything but this work!?!"
Todays problem :
I've made a new Block that requires a special renderer. And it all works! Right up until I try to add a texture to it. Does anyone see where I went wrong?
public class BlockWorkstation extends BlockContainer {
private static final String NAME = "test";
private static final String TEXTUREPATH = NAME;
private static final StepSound SOUND = Block.soundStoneFootstep;
private static final float HARDNESS = 3.0F;
private static final int XP_DROP = 4;
private static final int ENCHANT_MODIFIER = 2;
public BlockWorkstation(int par1) {
super(par1, Material.rock);
setCreativeTab(DMI.TAB_CREATIVE);
setStepSound(SOUND);
setHardness(HARDNESS);
}
public int idDropped(int par1, Random par2Random, int par3)
{
return this.blockID;
}
/**
* The type of render function that is called for this block
*/
public int getRenderType()
{
return -2;
}
/**
* Is this block (a) opaque and (B) a full 1m cube? This determines whether or not to render the shared face of two
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
*/
public boolean isOpaqueCube()
{
return false;
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving)
{
int rotation = MathHelper.floor_double((double)((entityliving.rotationYaw * 4F) / 360F) + 2.5D) & 3;
world.setBlock(i, j, k, this.blockID, rotation-1, 2);
}
public TileEntity createNewTileEntity(World par1World)
{
return new TileEntityWorkStationBlockEntity();
}
public void registerIcons(IconRegister ir) {
}
public class TileEntityWorkStationRenderer extends TileEntitySpecialRenderer {
private final ModelWorkStationBlock model;
protected ResourceLocation tileent;
public TileEntityWorkStationRenderer() {
this.model = new ModelWorkStationBlock();
}
private void adjustRotatePivotViaMeta(World world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
GL11.glPushMatrix();
GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);
GL11.glPopMatrix();
}
Hey everybody, I decided to make this tutorial because I got stuck here for around two days. It sucked. Anyway, so have you ever wanted to make a custom furnace or custom crafting table? Well there are tons of tutorials out there for that, but when you're done, there's a chance that your going to get stuck with you can't actually pick up the items in the inventory. The secret is in your Guihandler class or your proxy class, depending on where you register Gui's. As per usual you have the
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
switch (ID) {
case 0:
return new GuiLiquidator(player.inventory, (TileEntityLiquidator)world.getBlockTileEntity(x, y, z));
}
return null;
}
But due to the fact that it's a container aswell, you have to have this
package siramnot.mods.dmi;
import siramnot.mods.dmi.blocks.tileeents.TileEntityLiquidator;
import siramnot.mods.dmi.gui.ContainerLiquidator;
import siramnot.mods.dmi.gui.GuiLiquidator;
import net.minecraft.client.gui.inventory.GuiFurnace;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import net.minecraft.tileentity.*;
public class GuiHandler implements IGuiHandler {
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
switch (ID) {
case 0:
return new ContainerLiquidator(player.inventory, (TileEntityLiquidator)world.getBlockTileEntity(x, y, z));
}
// TODO Auto-generated method stub
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
switch (ID) {
case 0:
return new GuiLiquidator(player.inventory, (TileEntityLiquidator)world.getBlockTileEntity(x, y, z));
}
return null;
}
}
/**
* Returns the villager type to spawn in this component, based on the number of villagers already spawned.
*/
protected int getVillagerType(int par1)
{
return 2;
}
}
public class BlockLiquidator extends BlockContainer
{
/**
* Is the random generator used by furnace to drop the inventory contents in random directions.
*/
private final Random furnaceRand = new Random();
/** True if this is an active furnace, false if idle */
private final boolean isActive;
/**
* This flag is used to prevent the furnace inventory to be dropped upon block removal, is used internally when the
* furnace block changes from idle to active and vice-versa.
*/
private static boolean keepFurnaceInventory;
@SideOnly(Side.CLIENT)
private Icon furnaceIconTop;
@SideOnly(Side.CLIENT)
private Icon furnaceIconFront;
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer ep, int par6, float par7, float par8, float par9) {
ep.openGui(DMI.instance, 0, world, x, y, z);
return true;
}
@Override
public TileEntity createNewTileEntity(World world) {
// TODO Auto-generated method stub
return new TileEntityLiquidator();
}
}
0
Also, I know how to setup github for the centralized source
0
If you would like, I could make the basics on the mods on 1.7.2 with forge (most mods use forge anyway) and you could see if there's anything you like, don't like, etc. So uh, post back when you miss your not-so-lovesick boyfriend
0
It seem's I've necro'd because I didn't look at the date, but I'll still gladly help with modding
0
I was looking through the code for Tinkers Construct and I noticed that method that the hammer uses to determine which direction to mine in. I am slightly confused as how it works. What is the first part, up through the first if statement doing?
Thanks for the help
Jay
0
For this to work for all chests, modded and vanilla, you would have to edit the base TileEntity Chest and then assume that the modded chest use TileEntity Chest too. Maybe a new chest with a slightly harder recipe (Chest + Slime?)would be easier to implement and use.
0
0
Todays problem :
I've made a new Block that requires a special renderer. And it all works! Right up until I try to add a texture to it. Does anyone see where I went wrong?
Block :
package siramnot.mods.dmi.blocks;
import java.util.Random;
import siramnot.mods.dmi.DMI;
import siramnot.mods.dmi.DMIItemManager;
import siramnot.mods.dmi.blocks.tileeents.TileEntityLiquidator;
import siramnot.mods.dmi.blocks.tileeents.TileEntityWorkStationBlockEntity;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.StepSound;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.EntityLiving;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class BlockWorkstation extends BlockContainer {
private static final String NAME = "test";
private static final String TEXTUREPATH = NAME;
private static final StepSound SOUND = Block.soundStoneFootstep;
private static final float HARDNESS = 3.0F;
private static final int XP_DROP = 4;
private static final int ENCHANT_MODIFIER = 2;
public BlockWorkstation(int par1) {
super(par1, Material.rock);
setCreativeTab(DMI.TAB_CREATIVE);
setStepSound(SOUND);
setHardness(HARDNESS);
}
public int idDropped(int par1, Random par2Random, int par3)
{
return this.blockID;
}
/**
* The type of render function that is called for this block
*/
public int getRenderType()
{
return -2;
}
/**
* Is this block (a) opaque and (B) a full 1m cube? This determines whether or not to render the shared face of two
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
*/
public boolean isOpaqueCube()
{
return false;
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving)
{
int rotation = MathHelper.floor_double((double)((entityliving.rotationYaw * 4F) / 360F) + 2.5D) & 3;
world.setBlock(i, j, k, this.blockID, rotation-1, 2);
}
public TileEntity createNewTileEntity(World par1World)
{
return new TileEntityWorkStationBlockEntity();
}
public void registerIcons(IconRegister ir) {
}
}
TileEntityRenderer
package siramnot.mods.dmi.blocks.tileeents;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import siramnot.mods.dmi.DMI;
public class TileEntityWorkStationRenderer extends TileEntitySpecialRenderer {
private final ModelWorkStationBlock model;
protected ResourceLocation tileent;
public TileEntityWorkStationRenderer() {
this.model = new ModelWorkStationBlock();
}
private void adjustRotatePivotViaMeta(World world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
GL11.glPushMatrix();
GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);
GL11.glPopMatrix();
}
public void renderAModelAt(TileEntityWorkStationBlockEntity tile, double d, double d1, double d2, float f) {
int rotation = 0;
if(tile.worldObj != null)
{
rotation = tile.getBlockMetadata();
}
tileent = new ResourceLocation("test");
this.func_110628_a(tileent);
GL11.glPushMatrix();
GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.5F, (float)d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
GL11.glRotatef(rotation*90, 0.0F, 1.0F, 0.0F);
model.renderAll();
GL11.glPopMatrix(); //end
}
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
renderAModelAt((TileEntityWorkStationBlockEntity) te, x, y, z, scale);
}
private void adjustLightFixture(World world, int i, int j, int k, Block block) {
Tessellator tess = Tessellator.instance;
float brightness = block.getBlockBrightness(world, i, j, k);
int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
int modulousModifier = skyLight % 65536;
int divModifier = skyLight / 65536;
tess.setColorOpaque_F(brightness, brightness, brightness);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);
}
}
Thanks for the help!
0
type /join #DMI
0
I'm there <3
0
0
But due to the fact that it's a container aswell, you have to have this
0
hint : net.minecraft.world.gen.structure;
In addcomponentparts ():
this.spawnVillagers(par1World, par3StructureBoundingBox, 2, 1, 2, 1);
/**
* Returns the villager type to spawn in this component, based on the number of villagers already spawned.
*/
protected int getVillagerType(int par1)
{
return 2;
}
}
0
Instead try this
public static void registerBlock(Block block, String name, String unlocalizedname){
GameRegistry.registerBlock(block, voxcraft.modID + unlocalizedname);
if (block.blockID == 800)
LanguageRegistry.addName(block, "Aunik Block");
if (block.blockID == 801)
LanguageRegistry.addName(block, "Copper Ore");
if (block.blockID == 802)
LanguageRegistry.addName(block, "Copper Block");
if (block.blockID == 803)
LanguageRegistry.addName(block, "Uranium Ore");
}
0
I have more issues with those stupid GuiContainers.
So I can get the gui to show up, and there are slots are shown, but I can't move anything in the inventory like you can with a furnace.
Here's the code
Block :
package siramnot.mods.dmi.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random;
import siramnot.mods.dmi.DMI;
import siramnot.mods.dmi.blocks.tileeents.TileEntityLiquidator;
import siramnot.mods.dmi.gui.ContainerLiquidator;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class BlockLiquidator extends BlockContainer
{
/**
* Is the random generator used by furnace to drop the inventory contents in random directions.
*/
private final Random furnaceRand = new Random();
/** True if this is an active furnace, false if idle */
private final boolean isActive;
/**
* This flag is used to prevent the furnace inventory to be dropped upon block removal, is used internally when the
* furnace block changes from idle to active and vice-versa.
*/
private static boolean keepFurnaceInventory;
@SideOnly(Side.CLIENT)
private Icon furnaceIconTop;
@SideOnly(Side.CLIENT)
private Icon furnaceIconFront;
public BlockLiquidator(int par1, boolean par2)
{
super(par1, Material.rock);
this.isActive = par2;
setCreativeTab(DMI.TAB_CREATIVE);
}
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer ep, int par6, float par7, float par8, float par9) {
ep.openGui(DMI.instance, 0, world, x, y, z);
return true;
}
@Override
public TileEntity createNewTileEntity(World world) {
// TODO Auto-generated method stub
return new TileEntityLiquidator();
}
}
Gui
package siramnot.mods.dmi.gui;
import org.lwjgl.opengl.GL11;
import siramnot.mods.dmi.blocks.tileeents.TileEntityLiquidator;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
public class GuiLiquidator extends GuiContainer {
private TileEntityLiquidator RefinerInventory;
protected static final ResourceLocation gui = new ResourceLocation("Block/FurnaceGui.png");
public GuiLiquidator(InventoryPlayer par1IP, TileEntityLiquidator par2TileEntityRefiner){
super(new ContainerLiquidator(par1IP, par2TileEntityRefiner));
RefinerInventory = par2TileEntityRefiner;
}
int xSizeOfTexture = 235;
int ySizeOfTexture = 75;
int posX = (this.width + xSizeOfTexture) / 2;
int posY = (this.height + ySizeOfTexture) / 2;
protected void drawGuiContainerBackgroundLayer(int par1, int par2) {
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0xffffff);
}
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.func_110434_K().func_110577_a(gui);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
}
Container
package siramnot.mods.dmi.gui;
import siramnot.mods.dmi.blocks.tileeents.TileEntityLiquidator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotFurnace;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace;
public class ContainerLiquidator extends Container {
public ContainerLiquidator(InventoryPlayer player, TileEntityLiquidator entity) {
this.addSlotToContainer(new Slot(entity, 0, 54, 56));
this.addSlotToContainer(new Slot(entity, 1, 90, 56));
this.addSlotToContainer(new SlotFurnace(player.player, entity, 2, 51, 17));
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer) {
// TODO Auto-generated method stub
return false;
}
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
{
Slot slot = (Slot)this.inventorySlots.get(par2);
return slot != null ? slot.getStack() : null;
}
}
I use a GuiHandler class to handle gui's instead of proxies if that helps
Thanks for the help =)
0
Updated code in first post