-
Posts
2638 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Ernio
-
Anyone has opinion on this? Right now anything will be probably better than stuff I am thinking about ;p If not by some smart way, additional question: If I'd go with ProGuard (normal) Forge.jar and MC.jar as lib will be enough to get working obf file? Also I noticed this might not be right sub forum
-
Go to "Run Configurations..." (drop down in your RUN icon), open Arguments and add: --gameDir=C:\... --assetsDir=C:\... Depending what you want to archieve, use this or diesieben's way.
-
[1.7.10] Problem with detecting armor and setting walk speed.
Ernio replied to Alex_Richard's topic in Modder Support
http://www.minecraftforge.net/wiki/Creating_NBT_for_items Should get you the idea. Everything else is just matter of logic, plan and code -
You need to create new class extending Slot and use it as stack holder. Have look at SlotFurnace (i think it's right name). Note: ItemStack can have only 1-64 size. Anything bigger need custom handling. In Slot there is #getMaxSlotSize() (again, idk if it's right name, i am not in IDE).
-
[1.7.10] Problem with detecting armor and setting walk speed.
Ernio replied to Alex_Richard's topic in Modder Support
BAD: private EntityPlayer player; GOOD: event.player / event.entity EDIT: Also you design is kinda "static". I'd suggest making weigh values in NBT. Always keep in mind that items and block are singletons and there is only one instance per game (client/server). EDIT 2 For speed look at potion and AttributeModifier. I'd stay with base value of speed and if you are wearing something heavy add slowing Modifier with value of x in every beggining of a tick for one tick. Many ways to do that actually. You could just add PotionEffect ;p -
Not. Possible. public CreativeTabs(String label) { this(getNextID(), label); } public CreativeTabs(int index, String label) { if (index >= creativeTabArray.length) { CreativeTabs[] tmp = new CreativeTabs[index + 1]; for (int x = 0; x < creativeTabArray.length; x++) { tmp[x] = creativeTabArray[x]; } creativeTabArray = tmp; } this.tabIndex = index; this.tabLabel = label; creativeTabArray[index] = this; } 1st one is used to add next CT, 2nd allows you to override tab with index. public class MyTab extends CreativeTabs { public MyTab(String label) { super(label); } ... }
-
[1.7.10] Not all Item/blocks have their own classes
Ernio replied to whitephoenix's topic in Modder Support
I am not being rude here, but this forum is not for Java-begginers. You have lack of exp with Java, not just modding. Short response: Class is just a "structure" which you can use to define new Objects (Item) that will use this class as a template. Simpliest way I can explain. Please before getting into moddin you need to understand how objects work in Java and most basic concepts. -
Wrong constructor m8. public CrystalTab(String label) { super(label); this.setBackgroundImageName("crystal.png"); }
-
[1.7.10] Changing mob stats without using IExtendedProperties
Ernio replied to Thornack's topic in Modder Support
I just literally told you Base value of health is defined FOR ALL mobs that are using given class by SharedMonsterAttribute.maxHealth (might not be exact name). You could actually change it, but I don't recommend it (using modifiers to add +x value is better since it auto-synchronizes) public void setEntityHealthPastMax(EntityLivingBase entity, float amount) { entity.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(amount); entity.setHealth(amount); instance.sendHealthPacket(entity, amount); } sendHealthPacket is my method to update client-side data about entitys health. Note that this custom health needs to be stored SEPARATELY and saved as other value than vanilla health and then loaded after mob is constructed. Basically you need to get your health value and set vanilla to yours everytime you want your entity to have not-basic one defined by parent class. That also requres you to send packet to client (every damn time). I am not saying that this is too hard for you, but certainly coding advanced tracking systems is hard. -
[1.7.10] Changing mob stats without using IExtendedProperties
Ernio replied to Thornack's topic in Modder Support
I wouldn't call few fields packed into object a "system". Just to make sure you know: IExtendedEntityProperies is for actual EXTENDED properties, not basic properties. Unless you want to have all mobs have stats (or you just want to have neat code) you wont be using IEEP to code your OWN mobs. As long as mob is your class you can put all stuff in there. As to how vanilla handles attributes: SharedMonsterAttributes is a value assigned to each Entity.class (living) and defines ALL basic stuff for all mobs of this type. Then there are AttributeModifiers. With those you can pretty much do something like this: Use update() method, get entity.stats.extraHp and add Modifier for current tick for hp to be BaseHP+YourExtraHp. Mobs don't have stamina, you would have to make your new AI that will use it. Everything that vanilla has can be manipulated with modifiers. I'd go even further and nuse WorlTickEvent.PRE to make calculations in pre-tick. But that is a wider-look at topic. -
I REALLY don't want to rewrite whole page here. http://greyminecraftcoder.blogspot.co.at/p/list-of-topics.html Have a look at "Block" topic-list. It contains probably best explanation on this stuff you will ever find. As to my comment - every block MUST have: blockstates/blockname.json This file contains link to model and variants for it. Then there are models: models/block/some_model.json Here you can define how model looks like. And finally, since Block is block only in world, and if not it is ItemBlock, you need to add renderer for block as item (totorial on github in previous post's link explains how). That happens in models/items/blockname.json - hre you define how ItemBlock will render as item. My additional note: models/items/blockname.json MUST HAVE SAME FILENAME as blockstates/blockname.json (unless you do something tricky in code). ----- In-game names are not defined by code. They are all in lang files. I sadly have no knowledge about variant-block lang names. It will probably look like: tile.stairsWood.name=Oak Wood Stairs tile.stairsWoodSpruce.name=Spruce Wood Stairs tile.stairsWoodBirch.name=Birch Wood Stairs tile.stairsWoodJungle.name=Jungle Wood Stairs tile.stairsWoodAcacia.name=Acacia Wood Stairs tile.stairsWoodDarkOak.name=Dark Oak Wood Stairs Again - look at vanilla stairs and naming
-
Friend asked if you can obfuscate mod's code on compilation. Is it possible? Simpliest way? I was considering using normal ProGuard with MC as lib, but that takes extra time. Then I though about SRG names. Could you put custom srg to patcher to rename mod's methods on compilation?
-
Answer to your question is "Yes, literally SAME stuff." What is the problem then? The concept is that IBlockState is a wrapped block with its meta to one object from which you can pull info.
-
1.BlockState is just a wrapped block with meta, there is not much to say here. Everything you should know about rendering and json: http://www.minecraftforge.net/forum/index.php/topic,26267.0.html 2. World#setBlockState(...) 3. I don't quite get you, IBlockState is something that holds wrapped info about block (meta and stuff): Have look at vanilla: Block block1 = (new BlockPlanks()).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("wood"); registerBlock(53, "oak_stairs", (new BlockStairs(block1.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.OAK))).setUnlocalizedName("stairsWood"));
-
Have look here on Git (http://www.minecraftforge.net/forum/index.php/topic,26267.0.html). If you can't solve your problem (look deeply), post your code and .json's.
-
event.state will give you IBlockState, from it you can pull block / meta.
-
Extend CommandBase or wider implement ICommand. In execute() you write what should happen. getName() is your command. e.g "test" will give you /test. AS for registering: Server: @EventHandler public void serverLoad(FMLServerStartingEvent event) { event.registerServerCommand(new CommandTest()); } and Client: ClientCommandHandler.instance.registerCommand(new CommandTest()); Note: For client registration MUST be done in ClientProxy. Also: server will NEVER receive client commands (they are totally local). EDIT: Note 2: Registering command for server doesn't require you to ALSO register it for client. You do it either for client only, or for Server (which is server+client)
-
PlayerInteractEvent then. * This event is fired whenever a player interacts in * Minecraft#rightClickMouse(), I used it only once, very long time ago and I remember having problems with certain clicking (the righclick wasnt always calling event). It probably changed now. For certain I know that Client will always get called no matter on what you click since it's called directly from Minecraft#rightClickMouse().
-
Assuming from OP's code he tried to turn water into ice on moon by using PlayerEvent. That is wrong way to go. You will need to use some ChunkEvent (Populate?) or World generator. I sadly have little experience as to second one.
-
2. Do you want your block to be ACTUALLY smaller so in 1.0F space you can fit multiple blocks? If not, you are probably want just different model: http://greyminecraftcoder.blogspot.com.au/2014/12/block-rendering-18.html http://greyminecraftcoder.blogspot.com.au/2014/12/block-models-texturing-quads-faces.html If that is not enough u might be looking for TESR. As for furnace you will need TileEntity and GuiHandler for which client will have Gui and server - container.
-
Not sure what you are talking about. EnumChatFormatting?
-
Question doesn't deserve whole thread and is not even Forge i think: What happens if I'd load 2 virtual texturepacks that have one "same" element. Which one takes priority? Last loaded? (I don't see LinkedMaps or Sets, so idk which one will be "last")
-
Not really. If you want event to be called for EVERY item: PlayerUseItemEvent This event is separated in sub-phase events, make sure you picked right one. Simply check side for event to be launched on client. If you'd have your OWN items, you can @Override Item#onItemRightClick(...)