-
Posts
523 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Matryoshika
-
[1.11] TileEntity: adding an enum value to the NBTTagCompound?
Matryoshika replied to Kander16's topic in Modder Support
You can save the Enum as a string. Call enum#name() , to get a String representation of the enum. To convert back, use Enum__.valueOf(String) . Example: String estr = EnumHand.MainHand.name(); Reverse: EnumHand hand = EnumHand.valueOf(estr); Of course, if an enum is not found for that string, it will be null, so be sure to null-check. All you really need to do then is save the string to NBT. -
[1.11] [SOLVED] Spawn particles faster than randomDisplayTick
Matryoshika replied to Kander16's topic in Modder Support
Or you can just have your TileEntity call a custom method in your proxy, with the required variables. Common Proxy: Do nothing Client Proxy: Spawns the particle This way, particles will only spawn client-side, no matter from where, when or how. -
I usually just register the event inside my item's constructor. To quote SapphireSun over at StackOverflow: "A static method belongs to the class itself and a non-static (aka instance) method belongs to each object that is generated from that class. If your method does something that doesn't depend on the individual characteristics of its class, make it static (it will make the program's footprint smaller). Otherwise, it should be non-static."
-
[Solved][1.10.2] Select World Generation
Matryoshika replied to abused_master's topic in Modder Support
You would need to override the method calculateCelestialAngle in your custom WorldProvider. -
[Solved][1.10.2] Select World Generation
Matryoshika replied to abused_master's topic in Modder Support
You will need to register a custom WorldProvider with DimensionManager#registerDimension . The custom WorldProvider needs to reference a custom WorldType , a custom Chunkgenerator and possibly also a custom BiomeProvider . I have a config that pretty much sums up the "force specific worldgen no matter what you chose" quota, in my mod Underworld. -
What? How.... Do you know how Minecraft rendering works? Cause that answer infers the opposite... Basic runthrough: for every registered block (& item, but skipping that) the ModelLoaderRegistry calls getModel() , which goes through all ModelLoaders (Obj, B3d, DynBucket are forge added ones, then there's custom modelloaders as well of course.) Last resort is the vanilla modelloader. This calls SimpleReloadableResourceManager#getResource() which, when eventually here, calls FallbackResourceManager#getResource() , which is what is printing the FileNotFoundException . All of these classes, are vanilla Minecraft or Forge coded. Literally outside of my domain. Hmmm... Now that I think about it, I should be able to intercept it in FallbackResourceManager. It is getting all IResourcePack and iterating over them. Seems that I am registering my own IResourcePack a wee bit too late. Gonna see if I can add it earlier in the process.
-
{SOLVED} [1.10.2] Simple Registry Problem...
Matryoshika replied to EscapeMC's topic in Modder Support
You are telling him that commenting out his Block-registry will solve all his issues.... @EscapeMC Take a look here, from your Reference class JONAHJOE2002_ORE("jonahjoe2002_ore", "jonahjoe2002_ore"), EPICBUDDER22_ORE("epicbudder22_ore", "epicbudder22_ore"), MUSHRROMSTEW_ORE("mushrromstew_ore", "epicbudder22_ore"), "One of these things does not belong here" -
Minecraft.getMinecraft() only exists on the client. Any usage server-side will cause a NoClassDefFoundError error. Heck even just importing Minecraft can cause the crash, due to how java loads imports. @Dado42 Haven't touched 1.11 yet, but I'm sending a message to the player in 1.10 with cheater.addChatComponentMessage(new TextComponentString(cheater.getName()+" "+I18n.format("death."+Saligia.MODID+".creative"))); Where cheater is an instance of EntityPlayer . If you also want to use I18n, be sure to get the one from the net.minecraft.client.resources.I18n package. There are like 4 different I18n you can import. Be sure to get the correct one.
-
Hello! I'm making a mod that allows one to create blocks (so far) completely from json files. Very basic, nothing fancy, but valid blocks. Models & blockstates are also handled "outside" the mod, in the config folder. I've implemented IResourcePack, and throwing it into the List<IResourcePack> inside the Minecraft.class, during preInit. Everything works just fine, except that between Block registration (the new RegistryEvent way) & preInit, the ModelLoaderRegistry calls for "modid:models/item/<name>.json" which of course, due to the nature of this whole mod, will return a FileNotFoundException. This spams the client-side console, and that, in essence, is my issue. Unnecessary information in logs, especially when it is "fixed" just moments afterward, is detrimental. What would one need to do, to stop the model from registering so soon? Or can I stop the ModelLoader from calling modid:models/item/<block> altogether, as that is handled separately by the ResourcePack? Source-code can be found here: https://github.com/Matryoshika/Fabrica Solved Had to manually call Minecraft#refreshResources() to reload the IResourcePacks, before the ModelLoaderRegistry tries to load my models.
-
./gradlew build is failing with duplicate entry
Matryoshika replied to kitsushadow's topic in Modder Support
The jar-file with sources is a decompiled version; It is there for easier developement reasons. The sources version is what should be used for addons, or even given out to other modders who want to use your mod as a dependency. Look in your gradle file. There should be a comment telling you how to disable this feature, if you do not want it. -
Potion Effects Applying Oddly (Entitythrowable.) 1.11 (solved)
Matryoshika replied to gurujive's topic in Modder Support
[b]if (result.entityHit instanceof EntityLivingBase == false)[/b] { i = 0; ((EntityPlayer)result.entityHit).addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 200, 1)); ((EntityPlayer)result.entityHit).addPotionEffect(new PotionEffect(MobEffects.INSTANT_HEALTH, 10, 3)); ((EntityPlayer)result.entityHit).addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 200, 5)); ((EntityPlayer)result.entityHit).addPotionEffect(new PotionEffect(MobEffects.JUMP_BOOST, 200, 7)); ((EntityPlayer)result.entityHit).addPotionEffect(new PotionEffect(MobEffects.SPEED, 200, 2)); } If the entity is not EntityLivingBase, then magically it is an EntityPlayer? That's not type-safe casting. Not to mention, guess what class EntityPlayer extends... Well look at that, EntityLivingBase, which means Entityplayer IS an instance of EntityLivingBase, because it extends it. -
Container ArrayIndexOutOfBoundsException: 9
Matryoshika replied to gmod622's topic in Modder Support
int slotNumber = TE_INVENTORY_SLOT_COUNT + y * TE_INVENTORY_SLOT_COUNT_COLUMN + x; (3+0)*(3+0) = 9 (3+0)*(3+1) = 12 (3+0)*(3+2) = 15 .... (3+3)*(3+3) = 36 I don't think your implementation & your expectation of what should happen are the same. -
Why In The World Does This Happen!?!??!? (Weird teleportation?)
Matryoshika replied to gurujive's topic in Modder Support
Don't change the player's position. EntityThrowable has a method called setPosition(x, y, z) . After you create your entity, but before you spawn it, use said method to change it's y-level. Don't mess with the player's position for something like this. -
Why In The World Does This Happen!?!??!? (Weird teleportation?)
Matryoshika replied to gurujive's topic in Modder Support
You might be teleporting to Y=6... Because you specifically make your code teleport to Y=6... playerIn.posY = 6.8; You know.. Just possibly -
Trying to create an event where a player holds a custom item
Matryoshika replied to RBHB16's topic in Modder Support
if(p.inventory.getCurrentItem() == new ItemStack(_Items.cell_phone)) Sorry, but that will never be true, because ItemStacks are not singletons like items or blocks. You can draw parallels with this: If [this pebble from here] is [this pebble from over there]... They can never be the same, be cause they -aren't- the same. To get the item from an itemstack, use ItemStack#getItem . Never create a new instance to compare. -
As Draco just pointed out, you can bone-meal it. You cannot however really "fast forward" ticks However, for example, BlockStem (Melons & Pumpkins) has a method called updateTick which you can call, to make it, shockingly enough, tick again. Coupled with it's own scheduled tick, it in effect, ticked twice. Once by you, once by itself. You need to find the equivalent classes for saplings etc.
-
How Do I Use Custom Reddust Particle Colors For Something?
Matryoshika replied to gurujive's topic in Modder Support
The system it uses to determine colour, is called RGB... One of the most well-known colour-schemes there is.... You can use this website to determine the RGB-values of colours, and even hex if you ever need that instead: http://htmlcolorcodes.com/ You can use any value between 0-1 as far as I know. Yellow is not "invisible" [spoiler=As seen here] Spoiler also shows how much the colour can shift due to the randomness. I would recommend that you create your own copy of the ParticleRedstone and remove the randomness, for exact colours. The screenshot in the image used 0-1-1 (which is also not yellow as I said, and Draco pointed out, but cyan/teal. Yellow would be 1-1-0. It's hard to keep track on pure numbers) -
How Do I Use Custom Reddust Particle Colors For Something?
Matryoshika replied to gurujive's topic in Modder Support
The reddust particles, are a bit special, in that instead of a standard velocity in all axii, the 5th, 6th & 7th arguments in the World#spawnParticle are used to define the particle's colours. Of course, there is some randomness to the colours, but summoning a particle with xpos, ypos, zpos, 1,0,0 would make it red. Switching the colours out for 0,1,0 would turn it green, 0,1,1 would be yellow, and so forth. -
Show all of your block's code. Likely (because you didn't explicitly state whether or not it is), your block's volume is less than 1³, because you can "see" the sides of the block facing this block. If so, your block is not a full block, and you should thus override isFullBlock(IBlockState) .
-
[1.8] Make a link open on GUI button click
Matryoshika replied to IAmDrinkingLemonade's topic in Modder Support
You need to back-trace the steps. Take a look at GuIScreen#handleComponentClick . It gets the URI from the click-event, checks if it has protocal, checks if the protocol is supported, and at last, calls the "confirm open link"(OR just opens the link directly if it is disabled) -
[1.8] Make a link open on GUI button click
Matryoshika replied to IAmDrinkingLemonade's topic in Modder Support
Not sure if 1.8 is different, but in 1.10, GuiScreen#openWebLink is what vanilla MC uses. Have a look and see if it exists in the 1.8 version. -
Don't copy code from vanilla minecraft. When you do copy, copy the whole thing. You missed the inverse-operator "!" in front of the blockAccess, leaving your code to return false instead of true, if the block next to your block is the same type. Do you know how the ternary operator (statement ? true : default/false) works?
-
[solved]Getting a certain part of the player skin
Matryoshika replied to nexusrightsi's topic in Modder Support
What? He's working with Entities, not Tile-Entities. You cannot even attach a TESR to a regular entity, as far as I know, not to speak of, entities already have access to the Tessellator & VertexBuffer, through their renderers (RenderLiving, here). I'd have 2 textures: 1 for the body, which all entities would use. During PlayerLoggedInEvent, get the player's skin (there should be a couple threads already in this forum how to, believe I saw a thread about it a week or two ago). Because all "faces" are in the same area for every player, you should be able to "cut-out"* () his face, and use that as texture #2 for your entity. *Very likely will require some pure java ImageIO techniques.