Jump to content

Recommended Posts

Posted

So if I have a weapon, like a sword... How can I visually scale it up in game so it looks bigger when you hold it? (hitbox doesn't need to change)

 

edit: Scaling is working, but it's at the wrong angle. Is there a way to rotate or flip it?

Posted

Ok I would use a custom item renderer. Make a new class and make it implement the IItemRenderer.

 

Example:


package godis_apan.thedecorationpack.medieval.client.render.item;

import godis_apan.thedecorationpack.medieval.client.model.ModelOrnateTable;
import godis_apan.thedecorationpack.medieval.client.model.ModelTable;
import godis_apan.thedecorationpack.medieval.lib.Reference;
import godis_apan.thedecorationpack.medieval.lib.Textures;
import godis_apan.thedecorationpack.medieval.tileentity.TileEntityTable;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;

import org.lwjgl.opengl.GL11;

import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class RenderItem implements IItemRenderer
{

    public RenderItemTable()
    {
    }

    @Override
    public boolean handleRenderType(ItemStack stack, ItemRenderType renderType)
    {
        return true;
    }

    @Override
    public boolean shouldUseRenderHelper(ItemRenderType renderType, ItemStack stack, ItemRendererHelper renderHelper)
    {
        return true;
    }

    @Override
    public void renderItem(ItemRenderType renderType, ItemStack stack, Object... data)
    {
    }
}

 

Thats the basic class. Now in the renderItem() method you want to check the item render type. If it's in the inventory, first/third person or rendered as an entity item on the ground.

 

if (renderType == renderType.EQUIPPED)

{

    GL11.glPushMatrix();

    GL11.glScalef(1.5F, 1.5F, 1,5F);

    GL11.glPopMatrix();

}

 

The you scale it up using the glScalef(). If you scale it alot you will have to translate the item in a correct position (GL11.glTranlatef(x, y, z)).

 

Lastly you want to register the item renderer using:

 

MinecraftForgeClient.registerItemRenderer(myItem, new myRenderer());

 

I'm suggesting you do that in the client proxy.

 

 

Posted

Ok I would use a custom item renderer. Make a new class and make it implement the IItemRenderer.

 

Example:


package godis_apan.thedecorationpack.medieval.client.render.item;

import godis_apan.thedecorationpack.medieval.client.model.ModelOrnateTable;
import godis_apan.thedecorationpack.medieval.client.model.ModelTable;
import godis_apan.thedecorationpack.medieval.lib.Reference;
import godis_apan.thedecorationpack.medieval.lib.Textures;
import godis_apan.thedecorationpack.medieval.tileentity.TileEntityTable;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;

import org.lwjgl.opengl.GL11;

import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class RenderItem implements IItemRenderer
{

    public RenderItemTable()
    {
    }

    @Override
    public boolean handleRenderType(ItemStack stack, ItemRenderType renderType)
    {
        return true;
    }

    @Override
    public boolean shouldUseRenderHelper(ItemRenderType renderType, ItemStack stack, ItemRendererHelper renderHelper)
    {
        return true;
    }

    @Override
    public void renderItem(ItemRenderType renderType, ItemStack stack, Object... data)
    {
    }
}

 

Thats the basic class. Now in the renderItem() method you want to check the item render type. If it's in the inventory, first/third person or rendered as an entity item on the ground.

 

if (renderType == renderType.EQUIPPED)

{

    GL11.glPushMatrix();

    GL11.glScalef(1.5F, 1.5F, 1,5F);

    GL11.glPopMatrix();

}

 

The you scale it up using the glScalef(). If you scale it alot you will have to translate the item in a correct position (GL11.glTranlatef(x, y, z)).

 

Lastly you want to register the item renderer using:

 

MinecraftForgeClient.registerItemRenderer(myItem, new myRenderer());

 

I'm suggesting you do that in the client proxy.

When I put in the line:

MinecraftForgeClient.registerItemRenderer(HawkshotRifle.class, new RenderRifle());

 

I am told that registerItemRenderer isn't applicable for the arguments and it gives an error.

 

Very helpful! But having same problem as above.

 

Posted

That's because it takes an Item, not a Class. Just look at the method arguments and you will see that.

Ah yes, so no errors and the game loads, but now my weapon appears invisible.

 

My render file:

 

 

 

package com.darkMod.item;

 

import net.minecraft.client.renderer.Tessellator;

import net.minecraft.item.ItemStack;

import net.minecraft.util.ResourceLocation;

import net.minecraftforge.client.IItemRenderer;

 

import org.lwjgl.opengl.GL11;

 

import cpw.mods.fml.client.FMLClientHandler;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

@SideOnly(Side.CLIENT)

public class RifleRender implements IItemRenderer

{

 

    public void RenderItemTable()

    {

    }

 

    @Override

    public boolean handleRenderType(ItemStack stack, ItemRenderType renderType)

    {

        return true;

    }

 

    @Override

    public boolean shouldUseRenderHelper(ItemRenderType renderType, ItemStack stack, ItemRendererHelper renderHelper)

    {

        return true;

    }

 

    @Override

    public void renderItem(ItemRenderType renderType, ItemStack stack, Object... data)

    {

    if (renderType == renderType.EQUIPPED)

    {

        GL11.glPushMatrix();

        GL11.glScalef(1.5F, 1.5F, 1.5F);

        GL11.glPopMatrix();

    }

    }

}

 

 

 

My main file related stuff:

 

 

public static Item HawkshotRifle = new HawkshotRifle(StartingItemID+6, Gun).setUnlocalizedName("hawkshotRifle").setTextureName("eternisles:hawkShot");

 

private final static RifleRender rifleRender = new RifleRender();

 

@EventHandler

  public void load(FMLInitializationEvent event) {

    addItemsToRegistries();

  }

 

private void addItemsToRegistries() {

MinecraftForgeClient.registerItemRenderer(HawkshotRifle, new GunRender());

}

 

 

 

Posted

Render type EQUIPPED is for 3rd person, and EQUIPPED_FIRST_PERSON is for 1st person (which I'm guessing is where you noticed it's invisible). You need to account for both cases in your render class.

 

If you need a further example, take a look at my RenderBigItem class that I used for my hammers and big swords.

That makes it appear, however it is at the wrong angle. Is there a way to rotate/flip it?

Posted

GL11.glRotatef();

 

The params it takes are:

 

GL11.glRotatef(float angle, float x, float y, float z);

 

So if you want to rotate it on the y axis 90 degress the code should be:

 

 

GL11.glRotatef(90F, 0F, 1.0F, 0F);

 

The most simple way is to play around with it 'til it works!

Posted

Ohh and a important thing is the order the GL11 codes comes in, so here is the order:

 

GL11.glPushMatrix();

GL11.glTranslatef();

GL11.glScalef();

GL11.glRotatef();

 

Here your model goes!!!

 

GL11.glPopMatrix();

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hey all, I've been working a lot with datapacks lately, and I'm wondering what the most efficient way to get said data from server to client is.  I'm currently using packets, but given that a lot of the data I'm storing involves maps along the lines of Map<ResourceLocation, CustomDataType>, it can easily start to get messy if I need to transmit a lot of that data all at once. Recently I started looking into the ReloadableServerResources class, which is where Minecraft stores its built-ins.  I see you can access it via the server from the server's resources.managers, and it seems like this can be done even from the client to appropriately retrieve data from the server, unless I'm misunderstanding.  However, from what I can tell, this only works via built-in methods such as getRecipeManager() or getLootTables(), etc.  These are all SimpleJsonResourceReloadListeners, just like my datapack entries are, so it seems like it could be possible for me to access my datapack entries similarly?  But I don't see anywhere in ReloadableServerResources that stores loaded modded entries, so either I'm looking in the wrong place or it doesn't seem to be a thing. Are packets really the best way of doing this, or am I missing a method that would let me use ReloadableServerResources or something similar?
    • Im trying add to block a hole in center, just a usual block and in center of it on up side, there is should be a hole. I tried to add it via BlockModelBuilder, but its not working. Problem is that it only can change block size outside. I tried it to do with VoxelShape and its working, but its has been on server side and looks like its just changed collision shape, but for client, there is a texture covering this hole. I tried to use: base.renderType("cutout"); and removed some pixels from texture. I thought its should work, but game optimization makes block inside looks transparent. So, only custom model?
    • I Made this modpack myself and When i Open a world with embeddium enabeld no chuncks are loading in and when i have the mod brute force rendering culling eanbled the game will not start     This is the Modlist:   Chef's Delight [Forge] (by redstone3game) Yung Structures Addon for Loot Integrations (by someaddon) Macaw's Paths and Pavings (by sketch_macaw) My Nether's Delight (by soytutta) Client Crafting (by someaddon) Integrated Stronghold (by CraisinLord) Delightful (by brnbrd) Immersive Aircraft [Fabric/Forge] (by Conczin) Mysterious Mountain Lib (by sz0999312) Infinity Buttons (by LarsMans) SuperMartijn642's Core Lib (by SuperMartijn642) Clumps (by Jaredlll08) Embeddium (by FiniteReality) Cosmetic Armor Reworked (by LainMI) Creeper Overhaul (by joosh_7889) Balm (by BlayTheNinth) HT's TreeChop (by hammertater) Fastload (by StockiesLad) ImmediatelyFast (by RaphiMC) Integrated Dungeons and Structures (by CraisinLord) Mobtimizations - Entity Performance Fixes (by Corosus) Handcrafted (by terrariumearth) SuperMartijn642's Config Lib (by SuperMartijn642) Dramatic Doors (by FizzWare) Allurement (by TeamAbnormals) Xaero's World Map (by xaero96) Panda's Extra Details (by ThePandaOliver) Geophilic – Vanilla Biome Overhauls (by bebebea_loste) Auroras (by Verph) Naturalist (by Starfish_Studios) Iron Chests (by ProgWML6) Corpse (by henkelmax) FastSuite (by Shadows_of_Fire) Controlling (by Jaredlll08) Ash API (by Trikzon) Eating Animation [Neo/Forge] (by matyrobbrt) Macaw's Doors (by sketch_macaw) ForgeEndertech (by EnderLanky) Philip's Ruins (by philipmoddev) Resourceful Config (by ThatGravyBoat) ModernFix (by embeddedt) Quark (by Vazkii) Illager Invasion [Forge & Fabric] (by Fuzs) Integrated API (by CraisinLord) Redirector [Modern] (by pOtAto__bOy) Macaw's Fences and Walls (by sketch_macaw) Diagonal Windows [Forge & Fabric] (by Fuzs) Waystones (by BlayTheNinth) [EMF] Entity Model Features [Fabric & Forge] (by Traben) FerriteCore ((Neo)Forge) (by malte0811) CodeChicken Lib 1.8.+ (by covers1624) Macaw's Roofs (by sketch_macaw) Server Country Flags (by khajiitos) Bookshelf (by DarkhaxDev) Comforts (Fabric/Forge/Quilt) (by TheIllusiveC4) Enchantment Descriptions (by DarkhaxDev) Entity Culling Fabric/Forge (by tr7zw) Embeddium++ (by SrRapero720) Embeddium (Rubidium) Extra (by dimadencep) Smooth Boot (Reloaded) (by AbdElAziz333) Dungeons and Taverns (by Nova_Wostra) Placeables (by ItzSkay) CoroUtil (by Corosus) Small Ships [Fabric & Forge] (by talhanation) Trade Cycling (by henkelmax) Better Fps - Render Distance[Forge] (by someaddon) Better Villages - Forge (by jtl_elisa) PandaLib (by ThePandaOliver) Curios API (Forge/NeoForge) (by TheIllusiveC4) Stoneworks [Forge & Fabric] (by Fuzs) Pastel Shaders (by ElocinDev) Integrated Villages (by CraisinLord) More Axolotl Variants API (by AkashiiKun69) Potato Shader (by RRe36) Better Archeology (by Pandarix) Block Runner [Forge & Fabric] (by Fuzs) Cloth Config API (Fabric/Forge/NeoForge) (by shedaniel) Kiwi 🥝 (Neo/Forge) (by Snownee) Macaw's Lights and Lamps (by sketch_macaw) Loot Integrations (by someaddon) Farmers Structures (by BlackAuresArt) Wilderness (by ketok) Corpse x Curios API Compat (by Project8gbDeRam) Friends&Foes (Forge/NeoForge) (Copper Golem,Glare,Crab,Moobloom,Iceologer,Rascal,Tuff Golem,Wildfire,Illusioner) (by Faboslav) More Mob Variants (by nyuppo) Better Than Mending (by legobmw99) Remove Reloading Screen (by dimadencep) Simply Swords [Fabric & Forge] (by sweenuss) Better Brightness Slider (by LaidBackSloth) Krypton Reforged (by Txni) AppleSkin (by squeek502) Supplementaries Squared (by plantspookable) Horse Expert (by Fuzs) YUNG's Menu Tweaks (Forge) (by YUNGNICKYOUNG) Pet Cemetery (by TeamAbnormals) Leaky - Item Lag Fix[Forge/Fabric] (by someaddon) Tectonic (by Apollo) Saturn (by AbdElAziz333) Searchables (by Jaredlll08) Inventory HUD+ (by dmitrylovin) Moonlight Lib (by MehVahdJukaar) Explorify – Dungeons & Structures (by bebebea_loste) Placebo (by Shadows_of_Fire) Overflowing Bars [Forge & Fabric] (by Fuzs) Citadel (by sbom_xela) Alex's Mobs - Naturalist Compat (by Kanadeyoru) Forge CIT (by tfarecnim) Create (by simibubi) Starlight (Forge) (by Spottedleaf) [ETF] Entity Texture Features - [Fabric & Forge] (by Traben) Advanced Chimneys (by EnderLanky) Corn Delight[Forge] (by sz0999312) Trials Chambers [1.20.1 Backport] (by Jusey1z) MVS - Moog's Voyager Structures (by finndog_123) Macaw's Paintings (by sketch_macaw) Alternate Current (by SpaceWalkerRS) Hopo Better Ruined Portals (Fabric/Forge/NeoForge) (by hoponopono) Alex's Delight (by Baisylia) Macaw's Biomes O' Plenty (by Samlegamer_) Resourceful Lib (by ThatGravyBoat) FindMe (by Buuz135) Macaw's Bridges (by sketch_macaw) YUNG's Better Witch Huts (Forge) (by YUNGNICKYOUNG) MNS - Moog's Nether Structures (by finndog_123) Mowzie's Mobs (by bobmowzie) FastWorkbench (by Shadows_of_Fire) Transparent (by Trikzon) Artifacts (by ochotonida) Passable Foliage 🌳 (Neo/Forge) (by Snownee) Supplementaries (by MehVahdJukaar) Atmospheric (by TeamAbnormals) Alex's Caves (by sbom_xela) Alex's Caves Delight (by FixerLink1) Ocean's Delight (by scouter567) Brute force Rendering Culling (by RogoShum) fix GPU memory leak[Forge/Fabric] (by someaddon) Burnt: Better Vanilla Fire (by pxlbnk) YDM's Weapon Master (by YourDailyModderx) Curios Compat Layer for Accessories (by Blodhgarm) MES - Moog's End Structures (by finndog_123) Pale Garden and Creaking (by MinoBanana) YUNG's Better Jungle Temples (Forge) (by YUNGNICKYOUNG) AddonsLib (by Samlegamer_) Athena (by CodexAdrian) MakeUp - Ultra Fast | Shaders (by XavierFST) Xaero's Minimap (by xaero96) Macaw's Trapdoors (by sketch_macaw) Translocators 1.8.+ (by covers1624) Additional Structures (by XxRexRaptorxX) AI Improvements (by QueenOfMissiles) Autochef's Delight (by Snownee) Iron Furnaces (by XenoMustache) Iris/Oculus & GeckoLib Compat (by ElocinDev) Connectivity (by someaddon) Easy Magic [Forge & Fabric] (by Fuzs) Blueprint (by TeamAbnormals) VillagersPlus (FORGE) (by finallion_13) Panda's Falling Tree's (by ThePandaOliver) Xaero's Minimap & World Map - Waystones Compatibility [Forge] (by ArcaneAlloy) ServerCore (by Wesley8081) MrCrayfish's Furniture Mod: Refurbished (by MrCrayfish) Just Enough Items (JEI) (by mezz) Farmer's Delight (by vectorwing) Old fisherman swamp house (by SuperWarioModTeam) YUNG's Better Nether Fortresses (Forge) (by YUNGNICKYOUNG) Lithostitched (by Apollo) FastFurnace (by Shadows_of_Fire) DrDestens MCShaders (by DrDesten) Server Performance - Smooth Chunk Save[Forge/Fabric] (by someaddon) Noisium (by Steveplays28) Puzzles Lib [Forge & Fabric] (by Fuzs) YUNG's Bridges (Forge) (by YUNGNICKYOUNG) Alex's Mobs (by sbom_xela) Regions Unexplored (forge/fabric) (by UHQ_GAMES) Architectury API (by shedaniel) Radium Reforged (by Asek3) Separated Leaves (by LarsMans) CullLessLeaves Reforged (Unofficial) (by ccr4ft3r) Just Enough Effect Descriptions (JEED) (by MehVahdJukaar) FastBoot (by dnlayu) Framework (by MrCrayfish) Chipped (by terrariumearth) MSS - Moog's Soaring Structures (by finndog_123) GeckoLib (by Gecko) CB Multipart (by covers1624) GlitchCore (by TheAdubbz) Realm RPG: Fallen Adventurers (by nocubeyt) Zume (by Nolij) Library Ferret - Forge (by jtl_elisa) Recipe Essentials[Forge/Fabric] (by someaddon) Macaw's Stairs (by sketch_macaw) Accessories (by Blodhgarm) What Are They Up To (Watut) (by Corosus) GroovyModLoader (GML) (by matyrobbrt) Fruits Delight (by lcy0x1) Just Enough Breeding (JEBr) (by Christofmeg) Farmer's Respite (by lumpazl) YUNG's API (Forge) (by YUNGNICKYOUNG) Underground Villages (by Mrbysco) Easy Anvils [Forge & Fabric] (by Fuzs) Cupboard (by someaddon) Diagonal Walls (by Fuzs) Large Ore Deposits (by EnderLanky) More Axolotl Variants Mod (by AkashiiKun69) Zeta (by Vazkii) TerraBlender (Forge) (by TheAdubbz) Biomes O' Plenty (by Forstride) Bocchium (by pOtAto__bOy) FramedBlocks (by XFactHD) Patchouli (by Vazkii) Quark Delight (by nocubeyt) Just Enough Resources (JER) (by way2muchnoise) Amendments (by plantspookable) Simple Hats (by fonnymunkey) Oculus (by Asek3) OpenBlocks Elevator (by vsngarcia) YUNG's Better Mineshafts (Forge) (by YUNGNICKYOUNG) Skin Layers 3D (Fabric/Forge) (by tr7zw) Mouse Tweaks (by YaLTeR) YUNG's Extras (Forge) (by YUNGNICKYOUNG)
    • After removing shieldexpansion it wont let me join the server because it's included in the server's modpack. is there a way to bypass that?  
  • Topics

×
×
  • Create New...

Important Information

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