Jump to content

MinecraftMart

Members
  • Posts

    41
  • Joined

  • Last visited

Everything posted by MinecraftMart

  1. Hey all, I am trying to render a texture I am drawing on fullbright but I cannot figure it out. Fullbright meaning that it is as light in the day as in the night. This gives it the glowing effect. Right now whenever it turns night the texture also seems to darken which is not what I want. Only I have no sufficient knowledge on how to do this. Is someone willing to help me? This is the code for texture drawing. https://pastebin.com/aQnUU5M6 Thanks in advance!
  2. I added a villager, and when that villager is right clicked it should open a custom gui instead of the villager trading gui. I got as far as using AT to get the IMerchant value and now I know when its the villager I added. But the event is uncancelable and if I open my GUI first then the container of the tradegui will just open after it. Is there a way I can do this? I have already looked into GuiOpenEvent but that way I cannot get the container. If I grab either container variable from the player its a ContainerPlayer which is the inventory. Code: @SubscribeEvent public static void onOpenVillagerGUI(PlayerContainerEvent.Open event){ if(event.getContainer() instanceof ContainerMerchant){ ContainerMerchant merchantContainer = (ContainerMerchant) event.getContainer(); InventoryMerchant merchant = merchantContainer.getMerchantInventory(); if(!(merchant.merchant instanceof EntityVillager)){ return; } EntityVillager villager = (EntityVillager) merchant.merchant; if(villager.getProfessionForge().getRegistryName().toString() .equalsIgnoreCase(ModVillage.OLD_PRIEST_PROFESSION.getRegistryName().toString())){ Minecraft.getMinecraft().player.openGui(Solar.instance, GuiHandler.GUIDE_BOOK_ID_GUI, event.getEntityPlayer().getEntityWorld(), 0, 0, 0); } } } How would I stop the opening, or close it and then open my own GUI?
  3. So, either I am blind. But I can not find the method to load a chunk. I am trying to get a block on the onLoad in an tileEntity, but thats in an unloaded chunk. How would I load that chunk first so i can get the block?
  4. I think i kind of figured it out. It was always creating a BlockStateContainer without the Facing property. I overrid the method createStateContainer and added both Properties. Right now it seems to ask me for an updated json with all the faces so it might have worked.
  5. I am getting an error when I try to make a block one which can have rotating sides. This is the error: java.lang.IllegalArgumentException: Cannot get property PropertyDirection{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[north, south, west, east]} as it does not exist in BlockStateContainer{block=null, properties=[type]} at net.minecraft.block.state.BlockStateContainer$StateImplementation.getValue(BlockStateContainer.java:204) at com.mart.solar.common.blocks.BlockMenhir.getMetaFromState(BlockMenhir.java:139) at net.minecraft.block.Block.setHarvestLevel(Block.java:2267) at net.minecraft.block.Block.setHarvestLevel(Block.java:2249) at com.mart.solar.common.blocks.BlockMenhir.<init>(BlockMenhir.java:44) at com.mart.solar.common.registry.ModBlocks.registerBlocks(ModBlocks.java:63) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_15_ModBlocks_registerBlocks_Register.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:143) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179) at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:736) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:603) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:270) at net.minecraft.client.Minecraft.init(Minecraft.java:513) at net.minecraft.client.Minecraft.run(Minecraft.java:421) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) This is the class: https://pastebin.com/L7aVvS3U And this is my BlockEnum https://pastebin.com/2MZpsqwz If there is more info needed. My project: https://github.com/Martacus/Solar I hope someone can help me. I know what lines errors. I just cant figure out how I can give the blockstates the properties it needs before that happens.
  6. I rewrote that post 3 times, saw it, then didnt, then finally did. Thanks
  7. Goddamnit I see... The location variable is the Entity. Thats weird aint it >.> Shouldnt it just be named entity then?
  8. What are the values (the actual integers) i need to set on motionX motionY and motionZ for the items to drop normal like any other item would and not space out like a chicken. Or how do I get those values or where can I find those values.
  9. Hey diesieben, Yeah I know: > I can't find a way to give it motion other than setting it myself. What I am asking is how would I get the value's for the motion. The x y and z. To make it fall like normal items do when they get dropped. Or even, what are they.
  10. For an item I have I create a custom EntityItem like so: @Nullable @Override public Entity createEntity(World world, Entity location, ItemStack itemstack) { return new RuneEntity(world, location.posX, location.posY, location.posZ, itemstack); } But when it spawns it falls to the ground like nothing happens. I can't find a way to give it motion other than setting it myself. But i want the player that has thrown it its direction ofcourse. How would I set the motion so it fals like a normal item. If I look in the EntityPlayer class it sets the thrower and then the motion but it makes no sense to me why it won't do that for my custom item.
  11. I would like to check if an item has been added to the capability or removed from the capability by something. Like an hopper for exactly . Is there an event for it? Or do I have to manually check every tick if they slot has changed. This is my class: Thanks!
  12. Works like a charm! Thanks for pointing out the issue too
  13. I want fences to stop connecting to my blocks. So I override this method: Override public boolean canBeConnectedTo(IBlockAccess world, BlockPos pos, EnumFacing facing) { return false; } But that didnt work. Now I tried this: @Override public boolean isFullCube(IBlockState state) { return false; } Because it was in the glass block class, but that doesnt seem to work either.. This is my whole block class: Hastebin: https://hastebin.com/ugunowidax.java Thanks
  14. Your registry name of the item is null. You have not set it. or at least that it was the error tells us. It seems you are doing registration wrong for 1.12. Look at this: https://mcforge.readthedocs.io/en/latest/concepts/registries/
  15. Damn. I grew a lot in 4 years. Thanks for the help guyz, you helped me become what I am today haha Marked as SOLVED.
  16. Ah, dont use:`pushAttribute` and `popAttribute`
  17. So I have 2 Render classes. But with one of the classes the model that I draw is drawn way too dark. Its using the same code for drawing the model. Its looking like this https://gyazo.com/9f216b1b4ea4e1ecfde4eb41b7e3fb2e It might be the blocks that are doing something to the render? I dont know... Here is the code I am using: public class RenderUtil{ public static void renderItemFloatingOnTileEntity(ItemStack renderItem, TileEntity tileEntity){ RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem(); if (!renderItem.isEmpty()) { GlStateManager.translate(0.5, 2, 0.5); EntityItem entityitem = new EntityItem(tileEntity.getWorld(), 0.0D, 0.0D, 0.0D, renderItem); entityitem.getItem().setCount(1); entityitem.hoverStart = 0.0F; GlStateManager.pushMatrix(); GlStateManager.disableLighting(); float rotation = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL); GlStateManager.rotate(rotation, 0.0F, 1.0F, 0); GlStateManager.scale(0.5F, 0.5F, 0.5F); GlStateManager.pushAttrib(); RenderHelper.enableStandardItemLighting(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); itemRenderer.renderItem(entityitem.getItem(), ItemCameraTransforms.TransformType.FIXED); RenderHelper.disableStandardItemLighting(); GlStateManager.popAttrib(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); } } } And this is the render class: public class RenderAltar extends TileEntitySpecialRenderer<TileAltar> { @Override public void render(TileAltar tileEntity, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { ItemStack renderItem = tileEntity.getHeldItem(); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); RenderUtil.renderItemFloatingOnTileEntity(renderItem, tileEntity); GlStateManager.popMatrix(); } } If you are interested in the tile class: https://github.com/Martacus/Solar/blob/master/src/main/java/com/mart/solar/common/tileentities/TileAltar.java And this is how I bind the models and register the renderers: public class ClientProxy extends CommonProxy { @Override public void registerItemRenderer(Item item, int meta) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), "inventory")); } @Override public void preInit() { ClientRegistry.bindTileEntitySpecialRenderer(TileRuneInfuser.class, new RenderInfuser()); ClientRegistry.bindTileEntitySpecialRenderer(TileAltar.class, new RenderAltar()); } }
  18. It worked! Thank you! And yes i will stop with the hard ones. But i already have some basic ones and will continue making them since their easy. I watch te new boston and we are also learning java in class now so i hope this mod will be cool one day Thank you
  19. Already tried but it didnt work.
  20. Okay as i think about it it is pretty dumb yes. But its just i wanted to do this for a long time and now i finally understand the basics. I am learning java atm and try to understand every single bit of code. I will stop asking stupid questions and asking for basics. If you guyz could just help me finish this code that would be very awsome. Sorry for the trouble i caused or if i anoyed people.
  21. Nope, But is that even important? I do what i like to do and i just need help. I already got a few achievements ready and they work so im already proud of that. Im only 14 years and i am a beginner at java. I dont see the need to know all the stuff when i only need help with the basics. When i have te code i figure out myself how they work and i can make more progress. Im just doin what i like and you can help or you can not. Your decision. But it would be awesome if you could help
  22. Okay i get that but now i need to put it in code it tried some things but wouldnt work. Can you give me a example or show it me?
  23. event.entityPlayer gives you the player, right? What methods are there in EntityPlayer that give you the item the player is holding? There are at least 2, but the easiest one is getHeldItem(), which returns an ItemStack or null if the player is empty-handed. So the steps look like this: 1. Get the ItemStack the player is holding 2. Check if it's null 3. If it's not null, check that the item in the ItemStack is an Ender Pearl 4. Increment the counter for your player But as diesieben already pointed out, you are incrementing a single counter for all players, rather than a counter for each player. Perhaps you can tackle that another day after you have more Java under your belt, but if you're feeling adventurous, look into IExtendedEntityProperties. Thx! But now i got 1 little problem left. package com.mart.achievements; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; public class ThrowingHandler { public int PT = 0; @SubscribeEvent public void onItemThrow(PlayerInteractEvent event, EntityPlayer k){ EntityPlayer player = (EntityPlayer) event.entity; ItemStack heldItem = k.getHeldItem(); if (event.entityPlayer.getHeldItem() == null){ return; } //THIS LINE What to say here? else if(heldItem == Items.ender_pearl){ } if(PT >= 10) { event.entityPlayer.addStat(Achievements.Enderpearl, 1); System.out.println("BRIKT"); } } }
  24. Okay i cant figure this out. Is somebody willing to help me?
  25. No it's not. This is fuckin basic java. Well I aint that good at Java. A bit but i try to learn it. And it would be cool if you wanted to help me a bit. This is really wat i want to do even if i dont know how to.
×
×
  • Create New...

Important Information

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