Everything posted by LogicTechCorp
-
[1.11.2] Loop through Json file
I have it working now. Do you have any suggestions on how I can improve it? https://github.com/LogicTechCorp/NetherEx/blob/715c79aec5b060b52800e8fb9f0cc6f027fcc5e4/src/main/java/nex/trade/TradeListManager.java
-
[1.11.2] Loop through Json file
Are the classes set up correctly? And, how would I best go about writing the TradeOffer class? https://github.com/LogicTechCorp/NetherEx/tree/8de4416e8a453096431417ca4f987b8ee1093c1b/src/main/java/nex/trade
-
[1.11.2] Loop through Json file
I think I have all of the groundwork set up. Here are the classes: https://github.com/LogicTechCorp/NetherEx/tree/091d188907c5bf9fe5889b7fc825d81a294432ee/src/main/java/nex/trade Am I doing it correctly? Also, now how do I fill out the Deserializer classes?
-
[1.11.2] Loop through Json file
I am adding an entity with a trading ability to my mod. The trades are defined using Json and I would like some help trying to figure out how to deserialize the file. I have looked through the Minecraft source to see how they do it and have googled, but I still do not understand how to do it. All help is appreciated. Here is an example of how the Json is structured: { "name": "Example Trade List", "professions": [ { "name": "blacksmith", "careers": [ { "name": "toolsmith", "offers": [ { "output": {"id": "minecraft:golden_pickaxe", "meta": 0, "count": {"min": 1, "max": 4}, "tag": { "ench": [{"id": 34, "level": 3}, {"id": 70, "level": 1}], "display": {"name": "Golden Pickaxe", "color": "FFFF55", "lore": ["A Golden Pickaxe", "Forged with magic"]} } }, "inputA": {"id": "minecraft:gold_ingot", "meta": 0, "count": {"min": 3, "max": 3}}, "inputB": {"id": "minecraft:stick", "meta": 0, "count": {"min": 2, "max": 2}}, "level": 0, "stock": {"min": 2, "max": 4} } ] } ] } ] }
-
[1.11.2] Spawn Mob In Lava
@Choonster Do you have any recommendations on what the event should be? I am going to try and see what I can come up with but would like to know where to start.
-
[1.11.2] Biome Gen
Can anyone help or point me in the right direction?
-
[1.11.2] Biome Gen
Hello, I have a few question about biome generation. First off can anyone help me understand how to only allow certain biomes to spawn next to each other. For example, hot by warm, warm by cool, and cool by cold. I know Vanilla does this but I do not understand it. Second, how do sub-biomes work? Thank you, all help is appreciated. Here is my current biome gen system: Registry https://github.com/LogicTechCorp/NetherEx/blob/71dc6f68dcdca6905617e189956b621a23d9ea0c/src/main/java/nex/init/NetherExBiomes.java GenLayers https://github.com/LogicTechCorp/NetherEx/blob/71dc6f68dcdca6905617e189956b621a23d9ea0c/src/main/java/nex/world/gen/layer/GenLayerAddBiomes.java https://github.com/LogicTechCorp/NetherEx/blob/71dc6f68dcdca6905617e189956b621a23d9ea0c/src/main/java/nex/world/gen/layer/GenLayerNether.java
-
[1.11.2] Block::getStateId and Block::getStateById Use
What are the uses for Block::getStateId and Block::getStateById?
-
[1.11.2] Replace Access Transformer
Thanks, I didn't see that. Also, the size Field wasn't needed after all since the class has a getSize method.
-
[1.11.2] Replace Access Transformer
It seems to be working but I just want to know if I am doing it correctly. https://github.com/LogicTechCorp/NetherEx/blob/60c21b142b38243e2663bb648911fbac8fd56075/src/main/java/nex/util/WorldGenUtil.java https://github.com/LogicTechCorp/NetherEx/blob/60c21b142b38243e2663bb648911fbac8fd56075/src/main/java/nex/world/NetherExTeleporter.java https://github.com/LogicTechCorp/NetherEx/blob/60c21b142b38243e2663bb648911fbac8fd56075/src/main/java/nex/handler/EventHandler.java
-
[1.11.2] Replace Access Transformer
Thank you! I will work on it and come back if I have any issues.
-
[1.11.2] Replace Access Transformer
I have an access transformer that I use for a few different things and I would like to replace it. A while back I had tried using reflection but it did not work correctly. Can I have some help? Here is the AT: https://github.com/LogicTechCorp/NetherEx/blob/9adb4a8f37f0d032c5192d1abad55b46fd12f308/src/main/resources/META-INF/nex_at.cfg Use one: https://github.com/LogicTechCorp/NetherEx/blob/9adb4a8f37f0d032c5192d1abad55b46fd12f308/src/main/java/nex/world/NetherExTeleporter.java#L54 https://github.com/LogicTechCorp/NetherEx/blob/9adb4a8f37f0d032c5192d1abad55b46fd12f308/src/main/java/nex/world/NetherExTeleporter.java#L100 https://github.com/LogicTechCorp/NetherEx/blob/9adb4a8f37f0d032c5192d1abad55b46fd12f308/src/main/java/nex/world/NetherExTeleporter.java#L107-L114 https://github.com/LogicTechCorp/NetherEx/blob/9adb4a8f37f0d032c5192d1abad55b46fd12f308/src/main/java/nex/handler/EventHandler.java#L90 Use two: https://github.com/LogicTechCorp/NetherEx/blob/9adb4a8f37f0d032c5192d1abad55b46fd12f308/src/main/java/nex/util/WorldGenUtil.java#L179-L276
-
[1.11.2] Spawn Structure in Nether
The structure was saved with the air blocks around it to give it some padding. There were blocks where the structure spawned and were removed when it spawned.
-
[1.11.2] Spawn Structure in Nether
I am trying to spawn a structure in the Nether. The structure is supposed to spawn in the air but it does not work correctly. Here is the code I am using: public boolean generate(World world, Random rand, BlockPos pos) { rand = world.getChunkFromBlockCoords(pos).getRandomWithSeed(world.getSeed()); Mirror[] mirrors = Mirror.values(); Rotation[] rotations = Rotation.values(); Mirror mirror = mirrors[rand.nextInt(mirrors.length)]; Rotation rotation = rotations[rand.nextInt(rotations.length)]; MinecraftServer server = world.getMinecraftServer(); TemplateManager manager = world.getSaveHandler().getStructureTemplateManager(); Template template = manager.getTemplate(server, WeightedUtil.getRandomStructure(rand, variants)); PlacementSettings settings = new PlacementSettings().setMirror(mirror).setRotation(rotation).setReplacedBlock(Blocks.STRUCTURE_VOID).setRandom(rand); BlockPos structureSize = template.transformedSize(rotation); BlockPos newPos = new BlockPos(pos.getX() - structureSize.getX(), 96, pos.getZ() - structureSize.getZ()); BlockPos spawnPos = getSuitableAirPos(world, template.getZeroPositionWithTransform(newPos, mirror, rotation), structureSize); if(spawnPos != BlockPos.ORIGIN) { template.addBlocksToWorld(world, spawnPos, settings, 3); return true; } return false; } private static BlockPos getSuitableAirPos(World world, BlockPos pos, BlockPos structureSize) { while(pos.getY() > 32) { float sizeX = structureSize.getX(); float sizeZ = structureSize.getZ(); float sizeY = structureSize.getY(); int airBlocks = 0; for(int x = 0; x <= sizeX; x++) { for(int z = 0; z <= sizeZ; z++) { for(int y = 0; y <= sizeY; y++) { BlockPos newPos = pos.add(x, y, z); if(world.getBlockState(newPos) == Blocks.AIR.getDefaultState()) { airBlocks++; } } } } if(airBlocks == sizeX * sizeY * sizeZ) { return pos; } pos = pos.down(); } return BlockPos.ORIGIN; } } My code is based off of the fossil generation code. Picture of the issue:
-
[1.11.2] Stop Sound
I have an entity that plays a sound when it is moving. The entity has a cooldown between when it moves. If the sound plays right before it stops moving, the sound plays throughout the cooldown. I would like for this sound to stop playing when the entity stops moving. How do I do this?
-
[1.11.2] Best Way To Render Item Above Block
Anyone know how to fix this? Also, how do I get them to spin?
-
[1.11.2] Best Way To Render Item Above Block
I have blocks rendering now. There are a few issues: Blocks are rendered with color on them and the tops of blocks and items are transparent. Current Code: public class RenderSummoningAltar extends FastTESR<TileEntitySummoningAltar> { @Override public void renderTileEntityFast(TileEntitySummoningAltar altar, double x, double y, double z, float partialTicks, int destroyStage, VertexBuffer vertexRenderer) { ItemStack stack = altar.getInventory().getStackInSlot(0); if(!stack.isEmpty()) { World world = altar.getWorld(); float time = (world.getTotalWorldTime() + partialTicks) / 20; IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, world, null); List<BakedQuad> quads; for(EnumFacing facing : EnumFacing.values()) { quads = model.getQuads(null, facing, 0L); for(BakedQuad quad : quads) { vertexRenderer.addVertexData(quad.getVertexData()); vertexRenderer.putPosition(x, y + 1.5D, z); } } quads = model.getQuads(null, null, 0L); for(BakedQuad quad : quads) { vertexRenderer.addVertexData(quad.getVertexData()); vertexRenderer.putPosition(x, y + 1.5D, z); } } } }
-
[1.11.2] Best Way To Render Item Above Block
I have made some progress. Items now render but blocks do not. How would I render blocks and scale/rotate the model? Current code: public class RenderSummoningAltar extends FastTESR<TileEntitySummoningAltar> { @Override public void renderTileEntityFast(TileEntitySummoningAltar altar, double x, double y, double z, float partialTicks, int destroyStage, VertexBuffer vertexRenderer) { ItemStack stack = altar.getInventory().getStackInSlot(0); if(!stack.isEmpty()) { World world = altar.getWorld(); IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, world, null); List<BakedQuad> quads = model.getQuads(null, null, 0L); for(BakedQuad quad : quads) { vertexRenderer.addVertexData(quad.getVertexData()); vertexRenderer.putPosition(x, y + 1, z); } } } }
-
[1.11.2] Best Way To Render Item Above Block
Since you can't use GL calls in a FastTESR how would I go about rendering the item?
-
[1.11.2] Best Way To Render Item Above Block
I looked through the forum and cannot find a thread that discuses how to do that. Just a couple of questions: Would using what Draco suggested allow any item to work with this. Also, will the item be able to spin like a dropped item?
-
[1.11.2] Best Way To Render Item Above Block
What should I be using?
-
[1.11.2] Best Way To Render Item Above Block
I have the Item rendering but it appears dark. What am I doing wrong? public class RenderSummoningAltar extends TileEntitySpecialRenderer<TileEntitySummoningAltar> { @Override public void renderTileEntityAt(TileEntitySummoningAltar altar, double x, double y, double z, float partialTicks, int destroyStage) { if(altar == null) { return; } ItemStack stack = altar.getInventory().getStackInSlot(0); if(!stack.isEmpty()) { GlStateManager.pushMatrix(); GlStateManager.translate(x + 0.5F, y + 1.225F, z + 0.5F); GlStateManager.disableLighting(); GlStateManager.rotate((Minecraft.getSystemTime() / 720.0F) * (180.0F / (float)Math.PI), 0.0F, 1.0F, 0.0F); GlStateManager.scale(0.5F, 0.5F, 0.5F); GlStateManager.pushAttrib(); RenderHelper.enableStandardItemLighting(); Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.FIXED); RenderHelper.disableStandardItemLighting(); GlStateManager.popAttrib(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); } } }
-
[1.11.2] Best Way To Render Item Above Block
The Block has a TileEntity which has an inventory and allows it to store a single item. I would like for this Item to render on top of the Block like an item renders on the ground.
-
[1.11.2] Best Way To Render Item Above Block
I would like to render an Item that turns on top of my Block. I was looking around and saw that there a few different ways to achieve this. Which is the best and less resource intensive way to render the item?
-
[1.11.2] Freeze Player
Thanks, that works. Now, how would I stop the player from using items or placing blocks?
IPS spam blocked by CleanTalk.