Everything posted by poopoodice
-
Getting the IFactory of an entity for registry
You have to have a constructor that takes EntityType<?> and World as argument.
-
[1.16.5] Get World instance from Event Instance
https://sites.google.com/site/simplestjava/java-object-casting
-
[1.16.5] Get World instance from Event Instance
All worlds implements IWorld, so you can cast it.
-
Execute command from within mod
Check Commands#handleCommand
-
[1.16] Obtaining Potion Effects From Arrow Entity
You might need to use reflection for this.
-
[1.16.4] How do I prevent items from being placed in certain slots?
Maybe just drop the item before shrinking it?
-
1.16.5 Is there a possibility to get string i.e "FARMLAND" from string? from Block object?
Personally I use IForgeRegistryEntry#getRegistryName and then ResourceLocation#getNameSpace to get the id of the object.
-
[1.16.5] My Entity Is Just A Shadow!
Show your model as well.
-
Container Problem [1.16.5]
Call trackIntArray and pass the IIntArray in the constructor of your container.
-
[1.16.5] NullPointerException when Spawning in Entity
You have to assign your entity attributes, there's a EntityAttributeCreationEvent or something named similar in the latest version. In older versions you can register them in GlobalEntityTypeAttributes through common setup event.
-
Stun effect, cancel entity from moving
You can replace their AI tasks with your own one.
-
[1.16] BlockStateProvider is registered, but not called
Have you rerun task genXXXRuns?
-
Best way to go about creating a Monster List
List<EntityType<?>> MONSTERS = new ArrayList<>(); void summonRandomMonster() { if (MONSTERS.isEmpty()) MONSTERS.addAll(ForgeRegistries.ENTITIES.getValues().filter((type) -> is type classification monster)) Entity entity = (random EntityType from MONSTERS).create(world); if (entity != null) { entity.setPosition(x, y, z); world.addEntity(entity); } }
-
Register ReloadListener
Is the event being triggered? What's in your reload listener?
-
Register ReloadListener
There's an AddReloadListenerEvent
-
Is it possible to custom the particle when player destroying blocks?
I'm pretty sure the particle can be defined in the blockmodel.json.
-
Event "setSecondsOnFire" won't connect to SwordItem
Well.. I have no idea why it doesn't work, and I don't see any problems except you should set a max damage (durability) in your item properties, and your entity2 is in fact the attacker. Entity1 is the target.
-
Event "setSecondsOnFire" won't connect to SwordItem
All parts that are related to the item.
-
Event "setSecondsOnFire" won't connect to SwordItem
Post your code.
-
Event "setSecondsOnFire" won't connect to SwordItem
Why do you have your "on-hit effect" code located in the lambda? It will only be triggered upon item break. Also the easiest way to do it is just set the target on fire and then return super, two lines of code.
-
Event "setSecondsOnFire" won't connect to SwordItem
Override hitEntity() in your item class and set target on fire there.
-
finishUsingItem not triggering
You need to call LivingEntity#setActiveHand() in use() for the player to start "using".
-
Event "setSecondsOnFire" won't connect to SwordItem
In the Item class, (Item#hitEntity seems to be better than IForgeItem#onLeftClickEntity) @Override is just an annotation that is not necessary, but highly recommended to make sure you are actually overriding the method. DamageSource is a class that contains the information of the attack, such as the type of the attack (fire? explosion? where blast protection checks for this), the attacker, and even the direct attacker like arrows (IndirectDamageSource). Therefore the DamageSource will never match to a single item, where you can only obtain the information of the weapon from the attacker stored.
-
Best way to go about creating a Monster List
Create an instance of the entity (iirc there's a method in EntityType called create() or something), and then add it through world.addEntity.
-
Missing Sound
If I understand this correctly, that indicates the "key" of the sound, and then the game will search in sounds.json for further information such as volume, file location...etc. So as long as the directory https://github.com/BananaSquares/Forge-Mod/blob/master/src/main/resources/assets/mcore/sounds.json#L5 is correct and sound file is under assets/modid/sounds it should work.
IPS spam blocked by CleanTalk.