aw_wolfe
Members-
Posts
94 -
Joined
-
Last visited
-
Days Won
1
Everything posted by aw_wolfe
-
13.2 LootTableLoadEvent not firing for vanilla loot tables
aw_wolfe replied to aw_wolfe's topic in Modder Support
Thanks. I get that I can put static loot tables in json. I have a set of loot conditions that need to be checked dynamically. So in 1.12, I have my own LootConditions, LootEntry. Therefore, I could easily say "if 'unique item' is not already dropped ever in game, zombies can drop 'unique ite'm on Tuesdays after dark with 60%". My other mods could also add a new item and use this mod as utility to quickly add complex loot conditions. The problem is that in 13.2. LootTableLoadEvent is not being called for vanilla loot tables. It has them as "custom=true" and in 1.12, "custom=false"...so forgehook is NOT called in 13.2, whereas it was in 1.12. If I copy all vanilla loot tables into data/mymod/loot_tables , not all of them are triggering LootTableLoadEvent either...haven't investigated why. I am hoping I am doing something dumb or not seeing an obvious solution. -
13.2 LootTableLoadEvent not firing for vanilla loot tables
aw_wolfe replied to aw_wolfe's topic in Modder Support
Anyone point me in the right direction? The vanilla loot tables are coming in as "custom" and final. So, not able to catch them in LootTableLoadEvent and unable to modify them by getting LootTableManager and modify them after load. In 1.12, vanilla would fire the LootTableLoadEvent and you could modify the pools. In 1.13.2, vanilla is not firing the LootTableLoadEvent because it thinks they are "custom". -
13.2 LootTableLoadEvent not firing for vanilla loot tables
aw_wolfe posted a topic in Modder Support
prior to 13.2, LootTableLoadEvent would fire for vanilla loot tables. ForgeHooks#loadLootTable received a (false) for "custom" parameter. This led to ForgeEventFactory.loadLootTable(name, ret, lootTableManager); being executed. Which in turn led to the LootTableLoadEvent firing. However, in 13.2 : (ForgeHooks) if (!custom) ret = ForgeEventFactory.loadLootTable(name, ret, lootTableManager); Is never called for me (except on my own mod's loot tables) because ForgeHooks#loadLootTable is always passed a true for "custom" parameter for any minecraft loot table. Is this a design change? Is something off with my mod/install? A bug? Is there another way to catch and edit vanilla loot tables (need to do dynamically -- do not want to simply add new json that overwrites)? -
I think it is the issue with you item dye minecraft:pink_dye doesn't exist you need: { "item":"minecraft:dye", "data":9 } each dye has it's own data.
-
in your fire block class, override public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) do any fire resistance checks and set entity on fire. for extinquishing the fire, I don't know exacting where mc code is, but guessing it is using the Blocks.Fire as well. So, you'll probably need to override onBlockClicked in your block to extinquish itself(set itself to an air block)
-
look at... world#public boolean isFlammableWithin(AxisAlignedBB bb) This is what entity uses during update to determine if should set on fire. It uses Blocks.FIRE (which is an id and not checking for instanceof BlockFire). so your derived class won't match. you will have to do your own collision detection or maybe setting block to isburning state will work (see above function)
-
I think you are going to need to implement your own IRecipe. Follow choonsters example of ShapedArmourUpgradeRecipe (from your example you are looking at). Yes, you'll need to add a couple classes, but then you can override the matches and getCraftingResult to match and damage. Choonsters example is nice, because it still allows you to read from the json file....and he gives you all the code you need. To simplify you could hard code it in the IRecipe, but why ?
-
Think it has to do with the recipe json. Crafting will do a check on the item and if not the "same", it won't find it. if the meta or damage are not the same, it will not think it is the same item. Metas are small enough you can add mutliple metas into a recipe json, but if you want damaged items to work, think you'll need to create your own IRecipe to handle the item matching. I'm working on 0 sleep, so if I'm not following your problem, sorry. If you are trying to make your item repairable, then that is different solution
-
Trying to learn blockstates and config files...
aw_wolfe replied to AmeliaLotus's topic in Modder Support
I know. Love to greyghost. -
Trying to learn blockstates and config files...
aw_wolfe replied to AmeliaLotus's topic in Modder Support
https://github.com/TheGreyGhost/MinecraftByExample -
Custom potion that is yellow and doesn't shimmer
aw_wolfe replied to modder819's topic in Modder Support
I think your issue was the time of use of the item was too short and the animation sound didn't play. These 3 overrides from ItemPotion work for me in a new Item. @Override public int getMaxItemUseDuration(ItemStack stack) { return 32; } @Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.DRINK; } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { playerIn.setActiveHand(handIn); return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, playerIn.getHeldItem(handIn)); } -
Custom potion that is yellow and doesn't shimmer
aw_wolfe replied to modder819's topic in Modder Support
If you use the lemonade as a potion, the built in system will add others... I think extended lemonade, splash lemonade, etc. Would it be better to make the lemonade a "normal" item? Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.DRINK; } This will also deal with the shimmer issue. Then you can simply set up a brewing recipe to produce your lemonade. -
you can set the damage directly to the stack stack.setItemDamage(); Are you getting an item in inventory, or just not a damaged item?
-
[1.12.2] Retrive MetaFromState without Directional Meta
aw_wolfe replied to MiKeY_'s topic in Modder Support
Probably better answers out there. But, different blocks could handle direction or facing differently, so I'd say there is no for sure way. You can iterate through the properties of the blockstate and see if any have a "facing" as most directional block will implement similar to vanilla. Problem is they may convert to and from meta differently. You'd have to implement a switch for each type of block to strip of facing...but if using other mods, you may not know how they convert to meta and back. I guess, I'd question your problem and see if there is a different solution. Or if you can ignore blocks with facing, What are you trying to find with meta? -
[1.11.2] {SOLVED} Custom Armour Recipe Issue
aw_wolfe replied to 1Sstudios1's topic in Modder Support
for 11.2, here is a good tutorial... https://shadowfacts.net/tutorials/forge-modding-1112/crafting-smelting-recipes/- 1 reply
-
- 2
-
I think lang file needs to be all lower case . en_us.lang same with your item jsons.
-
if you are setting the position, you could try and set the velocity and add to the y value. Think you also need call velocitychanged to cause an update to the client.
-
one simple way, not sure if works with what you are trying to do, but if you add a levitation potion effect, this should accomplish the slow rise, just set the duration to make the player rise higher. Otherwise, I think you'd have to catch the event PlayerTickEvent and check to see if effect wanted, deal with storing the initial block pos, and storing whether effect is on/off --- should do with capabilities
-
There are tutorials out there. Just put some time into your problem before posting here. People (often the same people) have answered the same questions over and over and over again. If your issue looks like you thought it through and did some research, people will be more helpful (in general). https://shadowfacts.net/tutorials/forge-modding-112/ http://jabelarminecraft.blogspot.com/p/minecraft-modding-containers.html https://github.com/TheGreyGhost/MinecraftByExample
-
look at metamorph on github by mchorse
-
if you are looking for simple rotation, then stairs may not be the best example. Stairs rotate, but also can be placed upside down and their bounding boxes change. 1) add property facing to your block public static final PropertyDirection FACING = BlockHorizontal.FACING; 2) set default blockstate in the block constructor this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); 3) create the proper blockstatecontainer @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] { FACING}); } 4) meta-> blockstate and blockstate->meta. a meta value is store with each blockstate. you have to convert this to and from the blockstate property value (below is taken from one of my blocks with other properties removed manually without testing, but think it is ok) @Override public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getFront(meta); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(FACING, enumfacing); } @Override public int getMetaFromState(IBlockState state) { EnumFacing facing=state.getValue(FACING); int meta=((EnumFacing)state.getValue(FACING)).getIndex(); return meta; } 5)set the property values in the blockstate json. (the "mod" is your modid, the "model" is your model json which should be located in assets/[mod]/models/block. If you wanted different models for different directions, just change here. { "variants": { "facing=north": { "model": "mod:model" }, "facing=east": { "model": "mod:model", "y": 90 }, "facing=south": { "model": "mod:model", "y": 180 }, "facing=west": { "model": "mod:model", "y": 270 }, } } I think that is all you need. Good luck. Don't get discouraged modding, once you get used to looking into the minecraft code, it gets easier.
-
[SOLVED] Sync non-player entity -- how to id proper entity[1.12.1]
aw_wolfe replied to aw_wolfe's topic in Modder Support
awesome. working. 1) used entityID instead of UUID 2) send update from server after spawn...instead of requesting update from entityInit. The ids matched after the constructor finished on the client. So the debug output from the entityInit function wasn't valid yet. fyi: agreed, setData not a great name. Trying some debuggin stuff, was used to package class members into a nbttagcompound for syncing and saving/loading. -
[SOLVED] Sync non-player entity -- how to id proper entity[1.12.1]
aw_wolfe replied to aw_wolfe's topic in Modder Support
Spawning: From server side of item click (for testing) using a 'helper function in the entity class file. ///Item testing class @Override public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { System.out.println("scroll first use"); if(!world.isRemote){ System.out.println("not remote, trying to create magic"); // just testing creating magic EntityMagic em=EntityMagic.spawn(world, player.getPositionVector(), 200, player, true, EnumParticleTypes.SPELL); System.out.println("Created entity with:"+em.getUniqueID().toString()); } return super.onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand); } //ENtity class public static EntityMagic spawn(World worldIn,Vec3d pos,int tduration,EntityLivingBase caster,boolean track_caster,EnumParticleTypes pt){ EntityMagic eeb=new EntityMagic(worldIn,tduration); eeb.tick_duration=tduration; eeb.caster=caster; eeb.track_caster=track_caster; eeb.particleType=pt; eeb.setLocationAndAngles(pos.x, pos.y, pos.z, 0, 0); eeb.setData(); worldIn.spawnEntity(eeb); System.out.println("spawn:Tick duration:"+eeb.tick_duration); return eeb; } My thought on my mod is to have an entity used to create a magic effect, client side just does particle rendering, and server side dealt with performing the effect on other entities/etc. The combination of durations/effects/levels was going to be very large, so rather than create a different entity for each type, I thought I'd create a single entity that would act differently depending on params passed in when created. Starting with the tick_duration (entity kills self after so long). The problem was that on the server it works, but the instantiation on the client is the default parameters (in this case tick duration is 100...instead of the 200 passed in from the click action). Same is true, which makes sense, since the spawn action creates a generic version on the client, the server gets the proper parameters. So, they are out of sync from the beginning. I put a request from the client to the server, so that it would ask for updated data immediately after creation. I don't know why the entityids are 1 off. Creating multiple entities always produces the same result...server x, client x+1. I don't think this is reliable nor supposed to be that way. So don't want to depend on that to get the entity on the client side. -
[SOLVED] Sync non-player entity -- how to id proper entity[1.12.1]
aw_wolfe replied to aw_wolfe's topic in Modder Support
Thanks for the clarification on the UUID and entityID. However, my entityIDs are not matching either. Server: 285 and on the client: 286 . -
I feel I'm missing something easy, so apologies ahead of time. I am trying to sync data from the server to client of an entity (not a tile-entity or playerEntity). In the MessageHandler I have the message object and MessageContext . For tileEntities, you can use the blockpos and dimension passed into the message object to find the correct tileEntity. For players, you can use the MessageContext ctx.getServerHandler().player to identify the proper player to pass the information to. public class PacketRequestUpdateMagicEntity implements IMessage{ private int dimension; private UUID entityMagicUuid; public PacketRequestUpdateMagicEntity(int dimension,UUID em){ this.dimension=dimension; this.entityMagicUuid=em; } public PacketRequestUpdateMagicEntity(EntityMagic em){ this.dimension=em.world.provider.getDimension(); this.entityMagicUuid=em.getUniqueID(); } public PacketRequestUpdateMagicEntity(){ } @Override public void fromBytes(ByteBuf buf) { this.dimension=buf.readInt(); long least=buf.readLong(); long most=buf.readLong(); this.entityMagicUuid=new UUID(most,least); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(dimension); buf.writeLong(entityMagicUuid.getLeastSignificantBits()); buf.writeLong(entityMagicUuid.getMostSignificantBits()); } public static class Handler implements IMessageHandler<PacketRequestUpdateMagicEntity, PacketUpdateMagicEntity>{ @Override public PacketUpdateMagicEntity onMessage(PacketRequestUpdateMagicEntity message, MessageContext ctx) { System.out.println("REquest update"); try{ if(message.entityMagicUuid!=null){ System.out.println("looking for entity with:"+message.entityMagicUuid.toString()); } World world=FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(message.dimension); EntityMagic em=(EntityMagic)FMLCommonHandler.instance().getMinecraftServerInstance().getEntityFromUuid(message.entityMagicUuid); if(em!=null){ System.out.println("Entity Magic is not null"); return new PacketUpdateMagicEntity(em); } } catch(Exception e){ System.out.println("PacketRequestUpdateEntityMagic:Handler:Exception:"+e.toString()); } return null; } } } For a nonplayer entity, I am trying to use the UUID from Entity.getPersistentID() passed into the message object. The problem is that the UUID on the client and server are NOT matching. To test, I spawn a single instance of the entity and get different UUID in the output. //from EntityMagic @Override protected void entityInit() { System.out.println("persistant id:"+this.getPersistentID()); System.out.println("enitty id:"+this.getEntityId()); } from the server I get: uuid:091146a6-36df-4b42-9637-43442687e9ff with entity id:285 from the client I get:8587a3ea-6816-4e35-b011-08fd968dd7aa with entity id:286 I thought the UUIDs should match on the client and server, if correct, then why am I seeing them differently from the entityInit? If the UUIDs won't match, how should I find the proper entity on the client ? Am I doing something dumb(likely)? Thanks, Tony