Jump to content

Recommended Posts

Posted (edited)

is there a way to scale with blit, or do I need to use something else?

 

here's what I'm trying to scale:

minecraft.getTextureManager().bindTexture(new ResourceLocation("textures/item/gold_ingot.png"));
blit(10, 10, 0, 0, 256, 256);

 

 

[SOLUTION]

 

  On 11/2/2019 at 8:38 PM, andGarrett said:

here's a version of blit that makes the most sense to me and works perfectly for what I'm doing:
 

blit(
int xPos,		// x position relative to the screen image below it (not the entire screen).
int yPos,		// y position relative to the screen image below it (not the entire screen).
int blitOffset,		// z position (blitOffSet)
float textureX,		// x position on the texture image to draw from
float textureY,		// y position on the texture image to draw from
int imgSizeX,		// x image size to display (like crop in PS)
int imgSizeY,		// y image size to display (like crop in PS)
int scaleY,		// y image size (will scale image to fit)
int scalex)		// x image size (will scale image to fit)

 

it's still a little confusing to use the first time. if you have something like:

blit(10, 10, 10, 0F, 0F, 64, 64, 64, 64);

you will end up with an image that is 64x64 that contains the entire image scaled to fit 64x64

 

of you do something like:

blit(10, 10, 10, 0F, 0F, 64, 64, 32, 32);

you get an image that is 64x64 but that contains 4 copies of your image in a 2x2 grid that are all 32x32.

Expand  

 

Edited by andGarrett
Posted
  On 10/30/2019 at 2:46 AM, andGarrett said:
new ResourceLocation("textures/item/gold_ingot.png"));

 

Expand  

First I hope you're not doing new ResourceLocation in your actual code because you should just create it once in a static field.

 

  On 10/30/2019 at 2:46 AM, andGarrett said:

blit(10, 10, 0, 0, 256, 256);

Expand  

If I'm not mistaken there are other versions of blit that take more parameters and let you change more things. If that isn't true or satisfactory you could always use GLStateManager.scale

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
  On 10/30/2019 at 4:06 PM, Animefan8888 said:

First I hope you're not doing new ResourceLocation in your actual code because you should just create it once in a static field.

Expand  

this is currently for testing purposes. once I get things working would this not be acceptable for something that would change? would I need to create a non-static field to store the changing data?

 

  On 10/30/2019 at 4:06 PM, Animefan8888 said:

If I'm not mistaken there are other versions of blit that take more parameters and let you change more things. If that isn't true or satisfactory you could always use GLStateManager.scale

Expand  

you mentioned other versions of blit in another post of mine, but I have been unable to figure out how they work.

Posted
  On 10/30/2019 at 4:31 PM, andGarrett said:

once I get things working would this not be acceptable for something that would change?

Expand  

No because you are constructing an object every frame in that case. While a ResourceLocation isn't all that taxing in terms of creation it is a bad practice and shouldn't be done.

  On 10/30/2019 at 4:31 PM, andGarrett said:

would I need to create a non-static field to store the changing data?

Expand  

I would create a static array of ResourceLocation and index the value I want to use when I want to use it.

  On 10/30/2019 at 4:31 PM, andGarrett said:

but I have been unable to figure out how they work. 

Expand  

Yeah even with the most up to date mcp snapshot they don't have proper parameter names. But if you take a look at the execution order. It all leads into innerBlit which deals with Tessellator and BufferBuilder. From there you can figure out what each parameter is:

protected static void innerBlit(int p_innerBlit_0_, int p_innerBlit_1_, int p_innerBlit_2_, int p_innerBlit_3_, int p_innerBlit_4_, float p_innerBlit_5_, float p_innerBlit_6_, float p_innerBlit_7_, float p_innerBlit_8_) {

p_innerBlit_0_ is the x position on the screen.

p_innerBlit_1_ is the x position on the screen with the width added.

p_innerBlit_2_ is the y position on the screen.

p_innerBlit_3_ is the y position on the screen with the height added.

p_innerBlit_4_ is the z position on the screen(use this.blitOffset).

p_innerBlit_5_ is the textures x position in a 0-1.0 scale.

p_innerBlit_6_ is the textures x position with the width added in a 0-1.0 scale.

p_innerBlit_7_ is the textures z position in a 0-1.0 scale.

p_innerBlit_8_ is the textures y position with the height added in a 0-1.0 scale.

  • Thanks 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

here's a version of blit that makes the most sense to me and works perfectly for what I'm doing:
 

blit(
int xPos,		// x position relative to the screen image below it (not the entire screen).
int yPos,		// y position relative to the screen image below it (not the entire screen).
int blitOffset,		// z position (blitOffSet)
float textureX,		// x position on the texture image to draw from
float textureY,		// y position on the texture image to draw from
int imgSizeX,		// x image size to display (like crop in PS)
int imgSizeY,		// y image size to display (like crop in PS)
int scaleY,		// y image size (will scale image to fit)
int scalex)		// x image size (will scale image to fit)

 

it's still a little confusing to use the first time. if you have something like:

blit(10, 10, 10, 0F, 0F, 64, 64, 64, 64);

you will end up with an image that is 64x64 that contains the entire image scaled to fit 64x64

 

of you do something like:

blit(10, 10, 10, 0F, 0F, 64, 64, 32, 32);

you get an image that is 64x64 but that contains 4 copies of your image in a 2x2 grid that are all 32x32.

  • Like 1

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

    • Add the crash-report or latest.log (logs-folder) with sites like https://mclo.gs/ and paste the link to it here  
    • I removed yetanotherchance booster and now it says Invalid player identity
    • Cracked Launchers are not supported
    • After some time minecraft crashes with an error. Here is the log https://drive.google.com/file/d/1o-2R6KZaC8sxjtLaw5qj0A-GkG_SuoB5/view?usp=sharing
    • The specific issue is that items in my inventory wont stack properly. For instance, if I punch a tree down to collect wood, the first block I collected goes to my hand. So when I punch the second block of wood to collect it, it drops, but instead of stacking with the piece of wood already in my hand, it goes to the second slot in my hotbar instead. Another example is that I'll get some dirt, and then when I'm placing it down later I'll accidentally place a block where I don't want it. When I harvest it again, it doesn't go back to the stack that it came from on my hotbar, where it should have gone, but rather into my inventory. That means that if my inventory is full, then the dirt wont be picked up even though there should be space available in the stack I'm holding. The forge version I'm using is 40.3.0, for java 1.18.2. I'll leave the mods I'm using here, and I'd appreciate it if anybody can point me in the right direction in regards to figuring out how to fix this. I forgot to mention that I think it only happens on my server but I'm not entirely sure. PLEASE HELP ME! LIST OF THE MODS. aaa_particles Adorn AdvancementPlaques AI-Improvements AkashicTome alexsdelight alexsmobs AmbientSounds amwplushies Animalistic another_furniture AppleSkin Aquaculture aquamirae architectury artifacts Atlas-Lib AutoLeveling AutoRegLib auudio balm betterfpsdist biggerstacks biomancy BiomesOPlenty blockui blueprint Bookshelf born_in_chaos Botania braincell BrassAmberBattleTowers brutalbosses camera CasinoCraft cfm (MrCrayfish’s Furniture Mod) chat_heads citadel cloth-config Clumps CMDCam CNB cobweb collective comforts convenientcurioscontainer cookingforblockheads coroutil CosmeticArmorReworked CozyHome CrabbersDelight crashexploitfixer crashutilities Create CreativeCore creeperoverhaul cristellib crittersandcompanions Croptopia CroptopiaAdditions CullLessLeaves curios curiouslanterns curiouslights Curses' Naturals CustomNPCs CyclopsCore dannys_expansion decocraft Decoration Mod DecorationDelightRefurbished Decorative Blocks Disenchanting DistantHorizons doubledoors DramaticDoors drippyloadingscreen durabilitytooltip dynamic-fps dynamiclights DynamicTrees DynamicTreesBOP DynamicTreesPlus Easy Dungeons EasyAnvils EasyMagic easy_npc eatinganimation ecologics effective_fg elevatorid embeddium emotecraft enchantlimiter EnchantmentDescriptions EnderMail engineersdecor entityculling entity_model_features entity_texture_features epicfight EvilCraft exlinefurniture expandability explosiveenhancement factory-blocks fairylights fancymenu FancyVideo FarmersDelight fast-ip-ping FastSuite ferritecore finsandtails FixMySpawnR Forge Middle Ages fossil FpsReducer2 furnish GamingDeco geckolib goblintraders goldenfood goodall H.e.b habitat harvest-with-ease hexerei hole_filler huge-structure-blocks HunterIllager iammusicplayer Iceberg illuminations immersive_paintings incubation infinitybuttons inventoryhud InventoryProfilesNext invocore ItemBorders itemzoom Jade jei (Just Enough Items) JetAndEliasArmors journeymap JRFTL justzoom kiwiboi Kobolds konkrete kotlinforforge lazydfu LegendaryTooltips libIPN lightspeed lmft lodestone LongNbtKiller LuckPerms Lucky77 MagmaMonsters malum ManyIdeasCore ManyIdeasDoors marbledsarsenal marg mcw-furniture mcw-lights mcw-paths mcw-stairs mcw-trapdoors mcw-windows meetyourfight melody memoryleakfix Mimic minecraft-comes-alive MineTraps minibosses MmmMmmMmmMmm MOAdecor (ART, BATH, COOKERY, GARDEN, HOLIDAYS, LIGHTS, SCIENCE) MobCatcher modonomicon mods_optimizer morehitboxes mowziesmobs MutantMonsters mysticalworld naturalist NaturesAura neapolitan NekosEnchantedBooks neoncraft2 nerb nifty NightConfigFixes nightlights nocube's_villagers_sell_animals NoSeeNoTick notenoughanimations obscure_api oculus oresabovediamonds otyacraftengine Paraglider Patchouli physics-mod Pillagers Gun PizzaCraft placeableitems Placebo player-animation-lib pneumaticcraft-repressurized polymorph PrettyPipes Prism projectbrazier Psychadelic-Chemistry PuzzlesLib realmrpg_imps_and_demons RecipesLibrary reeves-furniture RegionsUnexplored restrictedportals revive-me Scary_Mobs_And_Bosses selene shetiphiancore ShoulderSurfing smoothboot
  • Topics

×
×
  • Create New...

Important Information

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