Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Eiachh

Members
  • Posts

    37
  • Joined

  • Last visited

Everything posted by Eiachh

  1. Well I only used forge for 1.12 but this would be the import. Otherwise sorry no idea. import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
  2. public class DeathEventHandler { @SubscribeEvent public void onLivingDeath(LivingDeathEvent event){ Entity e = event.entity; if (e instanceof EntityPlayer) { EntityPlayer killedplr = (EntityPlayer) e; if (event.source.getSourceOfDamage() instanceof EntityPlayer) { EntityPlayer plr = (EntityPlayer) event.source.getEntity(); plr.playSound("dig.stone", 1000.0f, 1.0f); } } } } use @subscribe event on top of the event and register This class"DeathEventHandler" in the preInit @EventHandler public void preInit(FMLPreInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new DeathEventHandler()); } I swear this site refuses to register what i write normally
  3. Well to be fair it is possibly without any bug AS FAR AS THEY DONT INTERRACT WITH THE PLAYER I remember the old minecraft beta version had the "animal mod" with horses etc and they spawned on servers for me because i had the mode. But they wont be able to interract with anything in any form. So basically just rendered graphics. Also I was into proxies and other weird stuff in mmorpg's so I am sure you could even make them be interractable for you if they would use Only vanilly packets towards the sever to communicate but that is complicated as hell and would need way too much research. If you don't even have an idea how would that work i would just abandone the idea of this paragraph.(also it can go into the direction when it is considered as hacking sooo :shrug: )
  4. I don't know if you still need it but yes with that code you could exactly get this effect. The 64x64 or any resolution would stay this just simply stretches the image like you would do inpaint or something. The "scale" tag scales up the picture on XYZ axis. That is the .json file of that item particullar that you have to modify to this. But the parent tag has to be "item/handheld" just realized now
  5. So basically documentation says: /** * This event is fired on both sides before the player triggers {@link net.minecraft.item.Item#onItemRightClick}. * Note that this is NOT fired if the player is targeting a block {@link RightClickBlock} or entity {@link EntityInteract} {@link EntityInteractSpecific}. * * Let result be the return value of {@link net.minecraft.item.Item#onItemRightClick}, or {@link #cancellationResult} if the event is cancelled. * If we are on the client and result is not {@link EnumActionResult#SUCCESS}, the client will then continue to other hands. */ @Cancelable public static class RightClickItem extends PlayerInteractEvent Note that this is NOT fired if the player is targeting a block Note that this is NOT fired if the player is targeting a block Note that this is NOT fired if the player is targeting a block Meanwhile me targetting a block guess what happens? It does triggers. My code public class EventHandlingForPortalRodTool { @SubscribeEvent public void catchPlayerInterract(PlayerInteractEvent.RightClickBlock event) { if (event.getEntityPlayer().world.isRemote == false) { if (event.getEntityPlayer().getHeldItemMainhand().getItem() instanceof PortaRodTool) { if (event.getEntityPlayer().isSneaking()) { PortaRodTool temp = (PortaRodTool) event.getEntityPlayer().getHeldItemMainhand().getItem(); temp.placePlaceholderAt(event.getEntityPlayer().world, event.getPos()); } } } } @SubscribeEvent public void catchPlayerRightclick(PlayerInteractEvent.RightClickItem event) { if (event.getEntityPlayer().getHeldItemMainhand().getItem() instanceof PortaRodTool) { if (event.getEntity().isSneaking()) { if (event.getEntityPlayer().world.isRemote == false) { PortaRodTool temp = (PortaRodTool) event.getEntityPlayer().getHeldItemMainhand().getItem(); System.out.println("wat"); temp.teleportEntity(event.getEntity()); } else{ PortaRodTool temp = (PortaRodTool) event.getEntityPlayer().getHeldItemMainhand().getItem(); System.out.println("true"); temp.teleportEntity(event.getEntity()); } } } } How do you separate/(tell them apart) the events or did i just use them wrong? The base idea: when shift rightclicking on a block Locking the coordinates when shift rightclicking NOT on a block teleport to the locked coords result: shift rightclick on a block places a "placeholderblock" but also teleports me to the previous selected coords the goal would be not to teleport if i shift rightclick on a block only to lock the coords If the PlayerInteractEvent.RightClickItem would contain something that "event.targettedBlock" that would be gread as well.
  6. I assume you mean this { "parent": "builtin/generated", "textures": { "layer0": "yourmodid:items/the_picture_name" }, "display": { "ground": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 2, 0], "scale":[ 9, 9, 9 ] //<--- this scales it up thats it }, "head": { "rotation": [ 0, 180, 0 ], "translation": [ 0, 13, 7], "scale":[ 9, 9, 9] }, "thirdperson_righthand": { "rotation": [ 0, -90, 55 ], "translation": [ 0, 4.0, 0.5 ], "scale": [ 9, 9, 9 ] }, "thirdperson_lefthand": { "rotation": [ 0, 90, -55 ], "translation": [ 0, 4.0, 0.5 ], "scale": [ 9, 9, 9 ] }, "firstperson_righthand": { "rotation": [ 0, -90, 25 ], "translation": [ 1.13, 3.2, 1.13 ], "scale": [ 9, 9, 9 ] }, "firstperson_lefthand": { "rotation": [ 0, 90, -25 ], "translation": [ 1.13, 3.2, 1.13 ], "scale": [ 9, 9, 9 ] }, "fixed": { "rotation": [ 0, 180, 0 ], "scale": [ 9, 9, 9 ] } } }
  7. I think even I can help here so I will try so basically to make everything simpler for you First you want a registry_handler which registers the items through Forge( no not the textures just the item "unlocalizedname" and "registryName") and it should look something similar to this @EventBusSubscriber public class RegistryHandler { @SubscribeEvent //for @SubscribeEvent you would have to register your class BUT because of the @EventbusSubscriber you don't have to if i am correct public static void registerItemsasdasd(Register<Item> event) { final Item[] items = { new ItemBasic("BasicStar","basic_star_item"), //the item that you are making (you have the same class in your git so this should be ok }; event.getRegistry().registerAll(items); //this will use the register to tell the game that this thing even exceists } } Then if you registered your items you need some way to tell that you want a model or picture or whatever for your item so you do this @EventBusSubscriber(Side.CLIENT) public class ModelRegistryHandler { @SubscribeEvent public static void registerModels(ModelRegistryEvent event) { registerModel(TutorialItems.BASIC_STAR_ITEM); //here comes the problem. You need a reference for your item(basically you could use just a "registryName" without getting the item reference but you will need later anyways } private static void registerModel(Item item) { ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); } } To get your item reference one way is to do this: @ObjectHolder(MainModpls.MODID) public class TutorialItems { public static final Item BASIC_STAR_ITEM = null; //This will just simply look through items thats in the namespace of MainModpls.MODID and if it finds a match it fills the value of your variable in more easier way: you I constructed the basicItem with the registryName=basic_star_item(small letters and theese things _ ) and if it finds that name here with CAPITALS then it sets the value } To be honest if you implement theese things it should work just be aware from here for the "picture" of your item it will look for a .json file in: assets.yourMODID.models.item.registryNameofyouritem.json json contains this: { "parent": "item/generated", "textures": { "layer0": "yourMODID:items/name_of_the_picture_without_the_.png_at_the_and" } } and it looks for the picture which is .png here: assets.yourMODID.textures.items.yourpicture.png YES ITEMS NOT ITEM AND IN MODELS YES ITEM NOT ITEMS I hope from here you can decode what jumps to where and what happens cause I am sure nobody will give a more detailed explanation here
  8. This! I am not saying that everything is documented there or up to date but if you don't need the full documentation of every part of the class it helped for me.
  9. Well that works but isn't it marked with @Deprecated And crossed out straight forward not to use it?
  10. I know its a basic question but if i have a block which is not filling the whole 1x1x1 tile i would like to turn on render under the block so there wont be a hole under it unrendered. There should be some value as "isFullCube" if I seen correctly in the Block class. Basically the question is is this what i am looking for if yes how do I use that IBlock state can someone explain them or give a link please?(i know that it stores values by tags somehow with magic)
  11. Nvm I just figured out that you have to actually register the @subcribe annotation so it works. But then why don't you have to register the @EventHandler ?
  12. Hi! First of all if I am just simply stupid sorry but I just can't get the LootTableLoadEven. I got to the point that I just copied a tutorial line and it still misses it please help or link something to read about it package com.eiachh.mainmod; import org.apache.logging.log4j.Logger; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.world.storage.loot.LootTableList; import com.eiachh.mainmod.proxy.IProxy; import com.eiachh.mainmod.recipes.My_Recipes; import com.eiachh.mainmod.tabs.NewTab; import net.minecraftforge.event.LootTableLoadEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @Mod(modid = MainModpls.MODID, name = MainModpls.NAME, version = MainModpls.VERSION, acceptedMinecraftVersions = MainModpls.MC_VERSION) public class MainModpls { public static final String MODID = "cutsiemod"; public static final String NAME = "Cutsiemod yaas"; public static final String VERSION = "1.0"; public static final String MC_VERSION = "[1.12.2]"; public static final String CLIENT = "com.eiachh.mainmod.proxy.ClientProxy"; public static final String SERVER = "com.eiachh.mainmod.proxy.ServerProxy"; public static final CreativeTabs TUTORIAL_TAB = new NewTab("mainTab"); String asd ="LULULULLULULULULULULULLULULULULLULULULULULULU"; @SidedProxy(clientSide = MainModpls.CLIENT, serverSide=MainModpls.SERVER) public static IProxy proxy; public static Logger logger; @SubscribeEvent public void onLootTablesLoaded(LootTableLoadEvent event) { System.out.println("GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG"); this.asd="kecske"; if (event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) { } } @EventHandler public void preInit(FMLPreInitializationEvent event) { logger = event.getModLog(); proxy.preInit(event); //this.asd="RTRTRTRTRTRTTTRT"; } @EventHandler public void init(FMLInitializationEvent event) { logger.info(MainModpls.NAME + "says hi!"); proxy.init(event); My_Recipes.initSmelting(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { proxy.postInit(event); logger.info(asd); } } It just comletly ignoring the fact that I am trying to catch it. I also tried to put the @subscribe... to a different class but i don't have a better bet than before Init()
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.