-
Posts
197 -
Joined
-
Last visited
-
Days Won
1
Everything posted by That_Martin_Guy
-
My mod will contain a lot of structures, and creating them all from code is quite a headache. Therefore I thought it would be a better idea to try and read and create the structures from a schematic file I got from MCEdit. Sadly, with this code it always prints "Could not spawn structure", even though the file is in the correct location (I copy pasted them to make sure). The code comes from an items onItemUse method. if(world instanceof WorldServer) { WorldServer worldServer = (WorldServer) world; MinecraftServer minecraftServer = worldServer.getMinecraftServer(); TemplateManager templateManager = worldServer.getStructureTemplateManager(); Template template = templateManager.get(minecraftServer, new ResourceLocation(Reference.ID, "templates/scp173")); if(template != null) { template.addBlocksToWorld(worldServer, pos, new PlacementSettings()); } else { System.out.println("Could not spawn structure"); } } EDIT: I also tried with both .nbt and .schematic extensions with no success EDIT 2: Turns out the resource location was wrong. Because of the way the template manager loads files it tried to load "assets/structures/templates/scp173" in the above code. Simply removing "templates/" from the location fixed the error.
-
[1.12.2] Get texture from texture map
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
Don't I have to store the values to retain the coordinates? I can't do it when setting the blockstate to my block AFAIK, and I don't know when to do it otherwise. -
[1.12.2] Get texture from texture map
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
I think a tile entity would suit best here, but I'm not sure how I'd be able to tell which block should have a certain model. I tried making the tile entity store a vector containing its structure position (0,0,0 would be a corner, 1,0,1 would be the top middle etc) and integer block properties storing their values, but I ran into the problem where I don't know how to translate this into json, and I'm not sure how I'd be able to store the values back in the tile entity. -
I am creating a 3x3x3 structure that will have different textures for each block. I think it would be a waste to create 27 blocks and/or blockstates for a single structure, though. So I have a texture map with it's size being a multiple of 16, and I'm wondering if I can take a portion out of it to get the blocks texture (like how textures used to be made back in the modloader days). How would I do this if it is possible?
-
I am creating a block with a tile entity that will spawn a specific enemy after a random amount of time (currently I have it hardcoded to make it easier to debug). A dilemma I had was that since I randomed on both the client and the server there would be two different timers for each side. I tried to solve this by checking if !world.isRemote, but doing this resulted in this being posted in the log whenever I rejoin a world, and the countdown doesn't resume. Another problem is that once the countdown finishes the mob I want to spawn simply doesn't spawn. No crash, no log output, nothing, as if I didn't try and spawn the mob at all. He does spawn if I use a spawn egg however. TileEntity Where I register it (I call registerTileEntities from preInit from my main mod class) EDIT: I found a partial solution. Rather than checking if the world is on the server or not, I am instead sending a packet which syncs the server time with the client. Now my mob spawns! Hooray! Except for I reload the world. If the block is still counting down, then it will stop counting down when I rejoin. If the block has counted down and spawned the mob it will dissapear when I rejoin, and will not count down. In both cases this is a part of what it outputs in the log. Updated Tile Entity
-
(Fair warning, this is going to be a similar post to my last one) I know you should pretty much always create block models in the .json format, but I'm part of a modding team who have created a whole bunch of .java models, and I'd hate to have to ask them to remake them all to convert them to .json. Is it a terrible idea to keep them as java files or is it fine? If so, how do you render the blocks this way?
-
[1.12.2] How to create mobs with java models
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
Could've sworn they were also ported to the json format. I must remember incorrectly though. -
[1.12.2] How to create mobs with java models
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
After some digging I came up with a solution. First of all I created a render class for the mob. Then I created a ModelManager and proceeded to call registerModels from preInit in my client proxy. And now he shows up in game perfectly! -
I know the preferred way of creating models is in the json format, but I've just joined a team that have created a boatload of models in the java format and I'd hate to have to ask them to re-create them all. I am not familiar with this at all though, and don't really know where to start. Any tips?
-
Any mod made for 1.12.1 was compatible with 1.12 (if I understood it correctly). Can the same thing be said about 1.12.2? According to the wiki the server is not compatible with previous versions, but I'm not sure if that's related to modding.
-
[1.12] How to update every tick without events
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
I see. Thank you both for the help! -
[1.12] How to update every tick without events
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
I see how you get the difference, but how do you actually make the game calculate the difference without a tick handler? Do I just query it when my hud updates or what? -
[1.12] How to update every tick without events
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
What method should I use to tell the counter to save/update the time stored? -
[1.12] How to update every tick without events
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
While that would be possible in a normal case I don't want to do this here. I eventually want a HUD which will display the cooldown of the object, as well as change the HUD itself while it is on cooldown. It would be confusing for the player if it was only updated every time you tried to activate it rather than constantly. -
I have a cooldown field which I want to reduce every tick, but I cannot do it with events (or atleast not the standard way of doing it). The reason for this is that the object I am creating (which is a completely different type of object compared to a block/blockstate, item/itemstack etc) needs to this particular object. If I subscribe the class to the event bus it with the annotation the method handling the event needs to be static. If I subscribe the class without the annotation it has to be a new object AFAIK, which is not possible for me. What other possibilities do I have?
-
[1.12] How to get Player entity on multiplayer client-side?
That_Martin_Guy replied to Hanashi's topic in Modder Support
Did you run it in common code? Preferably you should get the object in the ClientProxy. Can't really say much more than that since I'm pretty terrible at explaining things, honestly. -
[1.12] How to get Player entity on multiplayer client-side?
That_Martin_Guy replied to Hanashi's topic in Modder Support
Minecraft.getMinecraft().player, although keep in mind that this will crash if you run it in common code. -
[1.12] Flashing lamp when lifetime is low
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
Night vision works very differently from how I want the block to work though. Night vision visually brightens the players vision periodically without actually making the world brighter. I want my block to randomly become completely dark or get its normal brightness back. Besides, the only night vision related files I can find in IDEA are three fields (two constants from PotionTypes, the other a constant from MobEffects) and a method which is unrelated to what I'm looking for. After trying out the way of doing this I posted earlier I have some problems. The lifetime value in the tile entity decreases more than once per tick, although I don't know how much exactly (log excerpt from the machine posting it once every time update is called, 400 is max). The lamp doesn't blink at all (It's not that I've been unlucky, I've added a print that states when it's triggered, and it's getting triggered correctly). Also when I come back into a world after exiting minecraft with such a lamp already in the world I'm entering I crash with this error. -
[1.12] Flashing lamp when lifetime is low
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
I know that this forum can be vague about things so that the OP can figure parts of what the response meant himself and learn more from it, but could you atleast tell me which block/effect you meant? I was thinking about redstone torch/repeater, but they don't have a lifetime mechanic. -
How to run onItemRightClick one time?
That_Martin_Guy replied to progamergalil's topic in Modder Support
Have you tried checking !world.isRemote before doing any action? -
[1.12] Flashing lamp when lifetime is low
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
In case someone would like it, here are the full TileEntityLamp and BlockLamp classes. -
beginner [1.12] ItemCraftedEvent problems [SOLVED]
That_Martin_Guy replied to TheTrollguy_'s topic in Modder Support
Can't you just check what type the EntityPlayer is with instanceof? -
I have a light bulb block which has a tile entity. The light bulb will work like any other lamp until its lifetime value, which decreases every tick, reaches 25% of its max value, at which point it will start flashing. When the value reaches 0 it will stop glowing completely. My question is how I can track this value effectively, and if I'm using the randomTick method properly. This is how I track the value in my tile entity (bare in mind that a lot of unrelated values are cropped right now) EnergyLevel is an enum that represents a percentage of the energy stored within the tile entity.
-
I am curious on how to only allow spawns if a condition is true. AFAIK EntityRegistry#addSpawn makes an entity you choose always able to spawn, and if you made a condition before it it would not be able to change during gameplay. I do not really have anything to show since I haven't tried this myself yet, but it might be something I need to do in the future.