Everything posted by WOTBLITZ
-
[1.12.2][Solved]Forge Custom entity nbt resets after player is killed
Thanks
-
[1.12.2][Solved]Forge Custom entity nbt resets after player is killed
I tried to save an int to player.getEntityData().setInteger("test", 1); and it would save after closing the game but not if the player is killed then it resets. I have made sure it's added in server side and not client.
-
Texture not working[1.12.2][Solved]
@Mod(modid = "redc", name = "RedC", version = "1.0Alpha") public class RedC { @Mod.EventHandler public void Init(FMLInitializationEvent ee) { MinecraftForge.EVENT_BUS.register(new RedCEventHandler()); InitItems.init(); } public static void registerRenderItems() { ModelLoader.setCustomModelResourceLocation(InitItems.dirtPickaxe, 0, new ModelResourceLocation("redc:" + InitItems.dirtPickaxe.getRegistryName(), "inventory")); } } public class InitItems{ public static ItemPickaxe dirtPickaxe; public static ToolMaterial dirtToolMaterial; public static void init() { dirtToolMaterial = EnumHelper.addToolMaterial("DirtToolMaterial", 10, 1000, 10, 35, 30); dirtPickaxe = (ItemPickaxe) new ItemPickaxe().setUnlocalizedName("dirt_pickaxe").setRegistryName("itemdirtpickaxe"); ForgeRegistries.ITEMS.register(dirtPickaxe); } } public class RedCEventHandler{ @SubscribeEvent public void registryRenderItem(ModelRegistryEvent e) { RedC.registerRenderItems(); } }
-
Texture not working[1.12.2][Solved]
Nope no diffrent
-
Texture not working[1.12.2][Solved]
I'm not sure what am doing wrong. There are no errors on the console, I tried to remove the model .json file and only then there where errors. ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation("redc:" + item.getUnlocalizedName().substring(5), "inventory")); Is being called by the clientproxy after item Initialization and registering. json file(Removed all items for now but one): { "parent": "builtin/generated", "textures": { "layer0": "redc:items/dirt_pickaxe" } } btw the texture size is 64x64.
-
[1.12.2]How to update player inventory
And Singaplayer only.
-
[1.12.2]How to update player inventory
Like adding an item to the inventory.
-
[1.12.2]How to update player inventory
I might be stupid but how do you update the player inventory? I'm making a client-side mod only. I couldn't find while googling and the only thing I found while looking on the source of mc was CPacketCreativeInventoryAction which didn't work. And I only want it to work in singleplayer.
-
[1.12.2]Set mouse itemstack in gui
FMLCommonHandler.instance().getMinecraftServerInstance() seems to work. I can't see the item but closing the inventory will drop the item. Just a note.
-
[1.12.2]Set mouse itemstack in gui
No, it is not null. Did this work on an older version of mc? And as I said before "The code was based on an old discontinued mod" and that did not use packets. However, I will use packets.
-
[1.12.2]Set mouse itemstack in gui
I was making a mod that sets an item on the mouse and I was testing everything in creative mode. When I tested it on survival mode the item stack was like it was only added in client side(you can't use the item it would disappear) but it worked just fine in creative. Here is the code*: public static void setMouseItem(ItemStack stack) { getPlayerServer().inventory.setItemStack(stack); getPlayerClient().inventory.setItemStack(stack); } public static EntityPlayer getPlayerClient() { return Minecraft.getMinecraft().player; } public static EntityPlayer getPlayerServer() { return FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerByUsername(getPlayerClient().getName()); } *The code was based on an old discontinued mod.
-
Gui textured rect
I once used RenderGameOverlayEvent to add things to the game overlay. One thing was a textured rect with custom size on the game overlay that worked like this method this.drawTexturedModalRect(x, y, textureX, textureY, width, height); But now I don't remember what I did. Now I can make custom size textured rect but not which part of the sprite I want to use(Set the textureX and textureY), I tried other methods but it seems that only the above one you can set the textureX and textureY . I might be stupid and just forgot how to use gui's but either way I need help.
-
Potion Color
Ok sorry, I'm new to this.
-
Potion Color
I found out how. No need to respond.
-
Potion Color
I have created an ItemStack with one potion type and I want to change the color of the bottle. How do I do that? I know that since 1.9 the system on how to set the color on potion has changed. I know in 1.8 that you set the color by changing the metadata. Is it even possible(I found out that you couldn't change it via commands. Is it the same for modding)?
-
AttributeModifier Crash
using onUpdate did fix it.
-
AttributeModifier Crash
Wait, There one thing I can try. Fixing this : Most of Minecraft's code is not threadsafe, you cannot just spawn a 2nd thread and then start mocking around with game elements like entities inside it, you will get unspecified behavior at best and crashes at worse. (thats the only thing I can change)
-
AttributeModifier Crash
The code that created in order to attack except the new thread was from a tutorial.(I don't know forge and Minecraft code so well)
-
I cant port forward :(
Did you open the port both for TCP and UDP?
-
AttributeModifier Crash
So, there is nothing I can do?
-
I cant port forward :(
Which site? And you might have done a mistake. Which ip did did give? (ipv4 or public?)
-
I cant port forward :(
If you are in linux, use the screenshot application. If I'm right.
-
AttributeModifier Crash
Does it make any difference if I say that when I'm not resetting the speed it works just fine?
-
AttributeModifier Crash
public BullEntity(World p_i1683_1_) { super(p_i1683_1_); clearTasks(); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); this.tasks.addTask(3, new EntityAITempt(this, 1.25D, Items.wheat, false)); this.tasks.addTask(4, new EntityAIFollowParent(this, 1.25D)); this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(7, new EntityAILookIdle(this)); } public void clearTasks() { this.tasks.taskEntries.clear(); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D); } @Override public boolean attackEntityFrom(final DamageSource p_70097_1_, float p_70097_2_) { if(p_70097_1_.getEntity() instanceof EntityLivingBase) { this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).applyModifier(new AttributeModifier("speed", 0.299999997D, 0)); this.tasks.addTask(0, new EntityAIAttackOnCollide(this, p_70097_1_.getEntity().getClass(), 1.0D, false)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, p_70097_1_.getEntity().getClass(), 0, true)); final BullEntity b = this; Thread t = new Thread(){ @Override public void run() { super.run(); while(true) { if(p_70097_1_.getEntity().isDead) { b.targetTasks.taskEntries.clear(); b.clearTasks(); } } } }; t.start(); t.setName("Bull-Thread"); } return super.attackEntityFrom(p_70097_1_, p_70097_2_); } @Override public void onUpdate() { if(this.targetTasks.taskEntries.size() == 0 && this.tasks.taskEntries.size() != 7) { this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).applyModifier(new AttributeModifier("speed", - 0.299999997D, 0)); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); this.tasks.addTask(3, new EntityAITempt(this, 1.25D, Items.wheat, false)); this.tasks.addTask(4, new EntityAIFollowParent(this, 1.25D)); this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(7, new EntityAILookIdle(this)); } super.onUpdate(); } @Override public boolean attackEntityAsMob(Entity p_70652_1_) { float f = (float)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); int i = 0; if (p_70652_1_ instanceof EntityLivingBase) { f += EnchantmentHelper.getEnchantmentModifierLiving(this, (EntityLivingBase)p_70652_1_); i += EnchantmentHelper.getKnockbackModifier(this, (EntityLivingBase)p_70652_1_); } boolean flag = p_70652_1_.attackEntityFrom(DamageSource.causeMobDamage(this), f); if (flag) { if (i > 0) { p_70652_1_.addVelocity((double)(-MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F)); this.motionX *= 0.6D; this.motionZ *= 0.6D; } int j = EnchantmentHelper.getFireAspectModifier(this); if (j > 0) { p_70652_1_.setFire(j * 4); } if (p_70652_1_ instanceof EntityLivingBase) { EnchantmentHelper.func_151384_a((EntityLivingBase)p_70652_1_, this); } EnchantmentHelper.func_151385_b(this, p_70652_1_); } return flag; }
-
AttributeModifier Crash
I was working on an bull entity that attacks an entity that attacked the bull, but the game crashes when I try to apply an AttributeModifier to reset the speed. Error: net.minecraft.util.ReportedException: Ticking entity at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:709) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) ~[MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] Caused by: java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(Unknown Source) ~[?:1.8.0_131] at java.util.ArrayList$Itr.next(Unknown Source) ~[?:1.8.0_131] at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(EntityAITasks.java:70) ~[EntityAITasks.class:?] at net.minecraft.entity.EntityLiving.updateAITasks(EntityLiving.java:613) ~[EntityLiving.class:?] at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:1983) ~[EntityLivingBase.class:?] at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:431) ~[EntityLiving.class:?] at net.minecraft.entity.EntityAgeable.onLivingUpdate(EntityAgeable.java:138) ~[EntityAgeable.class:?] at net.minecraft.entity.passive.EntityAnimal.onLivingUpdate(EntityAnimal.java:56) ~[EntityAnimal.class:?] at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1816) ~[EntityLivingBase.class:?] at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:250) ~[EntityLiving.class:?] at com.wotmod.mod.entity.BullEntity.onUpdate(BullEntity.java:111) ~[BullEntity.class:?] at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298) ~[World.class:?] at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:684) ~[WorldServer.class:?] at net.minecraft.world.World.updateEntity(World.java:2258) ~[World.class:?] at net.minecraft.world.World.updateEntities(World.java:2108) ~[World.class:?] at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515) ~[WorldServer.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) ~[MinecraftServer.class:?]
IPS spam blocked by CleanTalk.