-
Posts
1511 -
Joined
-
Last visited
Posts posted by hydroflame
-
-
not really, but were you able to make your hologram block the same size as the carpet ?
-
GameRegistry.TileEntity(crest, "crest");
yeah, thsi method doesnt exists, what are you trying to do ?
-
not sure which part you are talking about,
Icon c = block.getIcon(side, meta);
thsi whole line is inside your renderer
the meta you can get by using world.getMetaAtWtvSomething(x, y, z);
the side you just chose which side you want, when you render your cue you obviously render all 6 sides manualy
the getIcon method itself goes inside your Block class, you can use another method if you want
like create your own method getAllIcon will return an array of all texture you registered insode your Block class
-
public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if(player.getItemInUse() == null) return this.itemIcon;
int Pulling = stack.getMaxItemUseDuration() - useRemaining;
if (Pulling >= 16)
{
return iconArray[2];
Icon[] myIcons = new Icon[5]; myIcons[0] = iconRegister.registerIcon(ModMain.modid+":"+"myItem"); myIcons[1] = iconRegister.registerIcon(ModMain.modid+":"+"myItem2"); myIcons[2] = iconRegister.registerIcon(ModMain.modid+":"+"myItem3"); etc
-
ok .. then whats the problem?
-
thats an array ...
-
*suspicious look*
why 16 model.. just use as much as you need ............
-
this hurts so much
public class TileEntityComputerRenderer extends TileEntitySpecialRenderer {
//The model of your block
public final ModelComputer model;
private static final ResourceLocation resourceloc = new ResourceLocation(Reference.MOD_ID + ":" + "textures/tileentity/computer.png");
public TileEntityComputerRenderer() {
this.model = new ModelComputer();
}
private void adjustRotatePivotViaMeta(World world, int x, int y, int z) {//hydro: never called why does it exists
int meta = world.getBlockMetadata(x, y, z);
//*facepalm*
GL11.glPushMatrix();
GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);
GL11.glPopMatrix();
}
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
//The PushMatrix tells the renderer to "start" doing something. // hydro: correction, tell openGL to "save current matrix transform".
GL11.glPushMatrix();
//This is setting the initial location.//
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
Minecraft.getMinecraft().renderEngine.func_110577_a(resourceloc);
//This is the texture of your block. It's pathed to be the same place as your other blocks here.
//This rotation part is very important! Without it, your model will render upside-down! And for some reason you DO need PushMatrix again!//the reason is because if you dont push you will not see your model, it will be renderered but very far from where you expect it to be
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
//A reference to your Model file. Again, very important.
this.model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
//Tell it to stop rendering for both the PushMatrix's//hydro: tell openGL to restore saved matrix transform has nothing to do with rendering
GL11.glPopMatrix();
GL11.glPopMatrix();
}
//Set the lighting stuff, so it changes it's brightness properly.
private void adjustLightFixture(World world, int i, int j, int k, Block block) {//hydro:copy pasted never called ? ....
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);
}
}
and now clean version:
public class TileEntityComputerRenderer extends TileEntitySpecialRenderer {
//The model of your block
public final ModelComputer model;
private static final ResourceLocation resourceloc = new ResourceLocation(Reference.MOD_ID + ":" + "textures/tileentity/computer.png");
public TileEntityComputerRenderer() {
this.model = new ModelComputer();
}
private void adjustRotatePivotViaMeta(World world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);
}
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
Minecraft.getMinecraft().renderEngine.func_110577_a(resourceloc);
GL11.glPushMatrix();
adjustRotatePivotViaMeta(te.worldObj, te.xCoord, te.yCoord, te.zCoord);//rotation 1
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
//adjustRotatePivotViaMeta(te.worldObj, te.xCoord, te.yCoord, te.zCoord);//comment line "rotation 1" and uncomment this line if it doesnt work.
model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
}
-
minecraft makes 1 glDisplayList per chunk, but i dont think theres any event that is called when a display list is updated, so you might have to make one
-
well for 1 you are not overriding the right method in your block
you are suppose to override:
public boolean hasTileEntity(int metadata)
not
public boolean hasTileEntity()
2, dont blame the TE if you have a problem, the TE obviously work because chest, furnace, beacon, sign load correctly and TE are VANILLA class, not forge
3
your block class name... its ressemble insanelly a song by macklemore "waddup i got a BigClock(Block)" *irrelevant*
-
@gotolink, if a mod ad a ore or a new kind of rare log, youd still need to find a way to price every "base" items
@op, well forge has "forge essentials" but idk how good it is
-
search for "hydroflame guide to textures" on the wiki, the gui tutorial apparently uses 1.5.2 so there are some outdated stuff
-
you didnt reobfuscate your mod run the reobfuscate.bat/.sh program
-
im only gonna print pseudocode
get the player inventory
for each item in the player inventory
check that this item is of type ammo
if it is them damage specificly this item
if you can damage it (it wasnt out of ammo) then cast the spell or wtv
-
not if you dont have a physical block, you can just link the container to the gui and that will be fine
-
yeah ... well just make sure that the item is an instanceof the amo you want
-
you mean the E menu ? the main inventory ?
-
but feel free to come ask question if theres something you dont understand, its just that someone took time to actually write that tutorial
-
i would use like "getItemInSlot" til i find the item i need, then decrease this particular itemStack damage
-
how you even looked at the wiki ?
-
exact signature:
public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4)
-
well for the gui part its pretty straightfoward but here an example of my party gui (theres also a packet send in there)
import java.util.List; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; import org.lwjgl.input.Keyboard; import com.hydroflame.GuiApi.GuiNewList; import com.hydroflame.mod.TheMod; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; /** * The gui for party managing * @author hydroflame * */ @SideOnly(Side.CLIENT) public class PartyGUI extends GuiScreen { public static int GUI_ID = 0; private boolean absorb = false; private GuiNewList<String> newList; private GuiButton[] guiButton; private GuiButton acceptButton; private GuiButton declineButton; private GuiButton leavePartyButton; private GuiButton inviteButton; private GuiTextField userTextField; public PartyGUI() { } // button is (id, x, y, width, height, text) public void initGui() { newList = new GuiNewList<String>(125, this.width/2-200, this.height/2-50, 200, 100); List<String> alist = TheMod.proxy.getList(); for (int i = 0; i < alist.size(); i++) { newList.add(alist.get(i)); } acceptButton = new GuiButton(0, this.width / 2 + 30, this.height / 2 - 50, 60, 20, "accept"); userTextField = new GuiTextField(fontRenderer, this.width / 2 - 130, this.height / 2 - 100, 103, 20); userTextField.setTextColor(-1); userTextField.setEnableBackgroundDrawing(true); userTextField.setMaxStringLength(30); userTextField.setFocused(true); inviteButton = new GuiButton(1, this.width / 2 - 20, this.height / 2 - 100, 50, 20, "invite"); declineButton = new GuiButton(2, this.width / 2 + 30, this.height / 2 - 30, 60, 20, "decline"); leavePartyButton = new GuiButton(3, this.width/2+30, this.height/2 -10, 60, 20, "leave party"); buttonList.add(leavePartyButton); buttonList.add(declineButton); buttonList.add(acceptButton); buttonList.add(inviteButton); buttonList.add(newList); setAvailability(); } protected void mouseClicked(int par1, int par2, int par3) { super.mouseClicked(par1, par2, par3); } protected void keyTyped(char par1, int par2) { if (absorb) { if (this.userTextField.textboxKeyTyped(par1, par2)) { } else if (userTextField.isFocused() && par2 == Keyboard.KEY_RETURN) { sendInvite(); } else { super.keyTyped(par1, par2); } setAvailability(); }else{ absorb = true; } } protected void actionPerformed(GuiButton button) { if (button.id == acceptButton.id) { TheMod.proxy.acceptInvite(newList.getSelectedItem()); TheMod.proxy.decline(newList.getSelected()); newList.remove(newList.getSelected()); } else if (button.id == declineButton.id) { TheMod.proxy.decline(newList.getSelected()); newList.remove(newList.getSelected()); }else if (button.id == inviteButton.id) { sendInvite(); }else if (button.id == leavePartyButton.id) { leaveParty(); } setAvailability(); } private void leaveParty() { TheMod.proxy.leaveParty(); } public void drawScreen(int x, int y, float idk) { this.drawDefaultBackground(); super.drawScreen(x, y, idk); userTextField.drawTextBox(); this.fontRenderer.drawStringWithShadow("invites:", this.width / 2 - 200, this.height / 2 - 60, 0xffffff); } private void sendInvite() { TheMod.proxy.sendInviteToServer(userTextField.getText()); userTextField.setText(""); } private void setAvailability(){ if(TheMod.proxy.isInParty()){ leavePartyButton.enabled = true; }else{ leavePartyButton.enabled = false; } if(!userTextField.getText().equals("")){ inviteButton.enabled = true; }else{ inviteButton.enabled = false; } if(newList.getSelected() == -1){ acceptButton.enabled = false; declineButton.enabled = false; }else{ acceptButton.enabled = true; declineButton.enabled = true; } } }
for the nbt/item part, just open a container with that and you should have no problem figuring out how to manipulate PlayerInventory for you concern
==========================
about the 2nd question, i dont like to encourage anything related to bukkit but...
what i would do is make the mods register their config files to your mod, then reading would be easy if you setup a convention
aka something like
"place all item under the category "ItemFlenix" and place an array of 2 value containing {itemId, price}
then the same for block but under category "BlockFlenix""
but liek i said ... we probably shouldnt be encouraging bukkit
-
yeah i did the complete research on the subject after and made a tutorial on the wiki, just search for "ISimpleBlockRenderingHandler" and you'll find it
i cover texturing in there too
-
description is a method of Item that you need to override
called "addInfo" or something (just goto Item.java and search )
for the item durability, onItemUse check if the player has amunition or wtv and if he does just remove a certain quantity to make it decrease, also dont allow shooting if you dont have enough amo
How to create an instance to hook into a variable from another class
in Modder Support
Posted
your entity truck extends vehicule right ? then you should be able to add a new field inside truck and just use that variable to get the wheel orientation.
did you try printing inside your render method to check that the wheel rotation value was correct ?