SCAREX
Members-
Posts
28 -
Joined
-
Last visited
Converted
-
Gender
Male
-
URL
http://scarex.fr/
-
Location
Lyon (Grenoble too), France
-
Personal Text
"Take that France"
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
SCAREX's Achievements
Tree Puncher (2/8)
2
Reputation
-
Your instance annotation should have the modid inside, not the name
-
You can download all the mods you want using gradle : just use the dev version (de-obfuscated) or add the code chicken core (/code chicken lib) in your dev workspace to play with obfuscated mods without de-deobfuscating the mod, I've made a tutorial for this here : http://www.minecraftforgefrance.fr/showthread.php?tid=2689 (in french sorry) There is 3 types of jars : the obfuscated (the one used to play), the de-obfuscated (to use in your dev environment), the source (uncompiled files). the API seems to be only the files to use to make your classpath happy
-
Correction : it seems to work, before I tested it no particles appeared. EDIT : no particles appeared because I was using world.spawnParticle.
-
Before I used if (this.worldObj.isRemote) but no particles appeared. I think it's because the particles are entities, and entities need to be spawned from the server.
-
Recently I had to create a smoke grenade. In order to do this, I used particles but the problem was that the player could deactivate them in the options so I used another way to do it. All were fine during a time but after my game crashes with different crash reports : My class : (EntityGrenade.class) public void performAction(MovingObjectPosition mop) { switch (this.metadata) { case 1: if (this.fuse > 0) { for (int i = 0; i < 4; i++) { Minecraft mc = Minecraft.getMinecraft(); if (mc.renderViewEntity != null && mc.effectRenderer != null) { float multi = 1.6F; double x = this.posX + this.rand.nextGaussian() * multi; double y = this.posY + ((this.rand.nextDouble() - 0.2D) * 3) * multi; double z = this.posZ + this.rand.nextGaussian() * multi; double d = mc.renderViewEntity.posX - x; double d1 = mc.renderViewEntity.posY - y; double d2 = mc.renderViewEntity.posZ - z; if (d * d + d1 * d1 + d2 * d2 <= 1024.0D) mc.effectRenderer.addEffect(new EntitySmokeFX(this.worldObj, x, y, z, 0.0D, 0.0D, 0.0D, 2.0F)); // Particles are created here } } if (this.fuse >= 20) this.setDead(); } break; default: if (!this.worldObj.isRemote && this.fuse >= 40 || (mop != null && mop.entityHit != null)) { this.setDead(); this.worldObj.createExplosion(this, this.posX, this.posY + 1.0D, this.posZ, 3.4F, this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")); } break; } } The crash report is not always the same : the entity type change every time. Once it was an EntityItem and another time a particle. But the NPE is in these loops : List list = this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.addCoord(p_70091_1_, p_70091_3_, p_70091_5_)); for (int i = 0; i < list.size(); ++i) { p_70091_3_ = ((AxisAlignedBB)list.get(i)).calculateYOffset(this.boundingBox, p_70091_3_); // here (Entity.class:692) } this.boundingBox.offset(0.0D, p_70091_3_, 0.0D); if (!this.field_70135_K && d7 != p_70091_3_) { p_70091_5_ = 0.0D; p_70091_3_ = 0.0D; p_70091_1_ = 0.0D; } boolean flag1 = this.onGround || d7 != p_70091_3_ && d7 < 0.0D; int j; for (j = 0; j < list.size(); ++j) { p_70091_1_ = ((AxisAlignedBB)list.get(j)).calculateXOffset(this.boundingBox, p_70091_1_); // Or here (Entity.class:709) } this.boundingBox.offset(p_70091_1_, 0.0D, 0.0D); if (!this.field_70135_K && d6 != p_70091_1_) { p_70091_5_ = 0.0D; p_70091_3_ = 0.0D; p_70091_1_ = 0.0D; } for (j = 0; j < list.size(); ++j) { p_70091_5_ = ((AxisAlignedBB)list.get(j)).calculateZOffset(this.boundingBox, p_70091_5_); // Or here (Entity.class:723) } The only thing that can cause a NPE is the method "calculateYOffset" / "calculateXOffset" / "calculateZOffset". But when I see the code when the list comes from : public List getCollidingBoundingBoxes(Entity p_72945_1_, AxisAlignedBB p_72945_2_) { this.collidingBoundingBoxes.clear(); int i = MathHelper.floor_double(p_72945_2_.minX); int j = MathHelper.floor_double(p_72945_2_.maxX + 1.0D); int k = MathHelper.floor_double(p_72945_2_.minY); int l = MathHelper.floor_double(p_72945_2_.maxY + 1.0D); int i1 = MathHelper.floor_double(p_72945_2_.minZ); int j1 = MathHelper.floor_double(p_72945_2_.maxZ + 1.0D); for (int k1 = i; k1 < j; ++k1) { for (int l1 = i1; l1 < j1; ++l1) { if (this.blockExists(k1, 64, l1)) { for (int i2 = k - 1; i2 < l; ++i2) { Block block; if (k1 >= -30000000 && k1 < 30000000 && l1 >= -30000000 && l1 < 30000000) { block = this.getBlock(k1, i2, l1); } else { block = Blocks.stone; } block.addCollisionBoxesToList(this, k1, i2, l1, p_72945_2_, this.collidingBoundingBoxes, p_72945_1_); } } } } double d0 = 0.25D; List list = this.getEntitiesWithinAABBExcludingEntity(p_72945_1_, p_72945_2_.expand(d0, d0, d0)); for (int j2 = 0; j2 < list.size(); ++j2) { AxisAlignedBB axisalignedbb1 = ((Entity)list.get(j2)).getBoundingBox(); if (axisalignedbb1 != null && axisalignedbb1.intersectsWith(p_72945_2_)) // NullPointerCheck with "axisalignedbb1 != null" { this.collidingBoundingBoxes.add(axisalignedbb1); } axisalignedbb1 = p_72945_1_.getCollisionBox((Entity)list.get(j2)); if (axisalignedbb1 != null && axisalignedbb1.intersectsWith(p_72945_2_)) // Same here { this.collidingBoundingBoxes.add(axisalignedbb1); } } return this.collidingBoundingBoxes; } So it can't be the source of the crash. If you know why, tell me, it's been 4 days since I'm looking for an answer but it seems impossible for me. Forge version : tested in 1.7.10-10.13.4.1448 and 1.7.10-10.13.4.1481.
-
[1.7.10] Entity mountable not working (problem with synchronization)
SCAREX replied to SCAREX's topic in Modder Support
I can get it to work by implementing IEntityAdditionalSpawnData, but it takes a bit of time to update the y offset : After a bit of time : -
[1.7.10] Entity mountable not working (problem with synchronization)
SCAREX replied to SCAREX's topic in Modder Support
Now, I can sit on thee block but the mounted Y offset is correct only for the server : package fr.scarex.hilium.block; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import fr.scarex.hilium.Hilium; import fr.scarex.hilium.entity.EntitySit; import fr.scarex.hilium.tileentity.TileEntitySit; /** * @author SCAREX * */ public class BlockSit extends Block { protected BlockSit(Material material) { super(material); } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (this.canSit(world, x, y, z, player, side, hitX, hitY, hitZ)) { EntitySit entity = new EntitySit(world, x + 0.5D, y + 0.5D, z + 0.5D, this.getOffsetY(world, x, y, z)); world.spawnEntityInWorld(entity); entity.interactFirst(player); return true; } return false; } public boolean canSit(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { return true; } public double getOffsetY(World world, int x, int y, int z) { return 0.5D; } } package fr.scarex.hilium.block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import cpw.mods.fml.common.registry.GameRegistry; import fr.scarex.hilium.Hilium; import fr.scarex.hilium.client.ClientProxy; import fr.scarex.hilium.tileentity.TileEntitySit; import fr.scarex.hilium.tileentity.TileEntityUseless; /** * @author SCAREX * */ public class BlockToilet extends BlockSit { public static final String NAME = "toilet"; protected BlockToilet() { super(Material.glass); this.setHardness(0.5F); this.setResistance(5.0F); this.setStepSound(this.soundTypeGlass); this.setCreativeTab(CreativeTabs.tabDecorations); this.setBlockName(Hilium.MODID + "_" + NAME); this.setBlockTextureName(Hilium.MODID + ":" + NAME); this.register(); } private void register() { GameRegistry.registerBlock(this, NAME); GameRegistry.registerTileEntity(TileEntitySit.class, Hilium.MODID + ":" + NAME); } @Override public boolean renderAsNormalBlock() { return false; } @Override public int getRenderType() { return ClientProxy.RENDER_ID; } @Override public boolean isOpaqueCube() { return false; } @Override public boolean hasTileEntity(int metadata) { return true; } @Override public TileEntity createTileEntity(World world, int metadata) { return new TileEntitySit(); } @Override public void setBlockBoundsForItemRender() { this.setBlockBounds(0.05F, 0.0F, 0.05F, 0.95F, 0.88F, 0.95F); } @Override public void registerBlockIcons(IIconRegister register) { this.blockIcon = register.registerIcon("glass"); } @Override public boolean canPlaceBlockAt(World world, int x, int y, int z) { return super.canPlaceBlockAt(world, x, y, z) && World.doesBlockHaveSolidTopSurface(world, x, y - 1, z); } @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) { int direction = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, direction == 3 ? 0 : direction + 1, 2); } @Override public double getOffsetY(World world, int x, int y, int z) { return 0.3D; } } package fr.scarex.hilium.entity; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import fr.scarex.hilium.Hilium; import fr.scarex.hilium.block.BlockSit; /** * @author SCAREX * */ public class EntitySit extends Entity { protected double offsetY; public EntitySit(World world) { super(world); this.noClip = true; this.preventEntitySpawning = true; this.setSize(0.0F, 0.0F); this.offsetY = 0.0F; } public EntitySit(World world, double x, double y, double z, double offsetY) { this(world); this.setPosition(x, y, z); this.offsetY = offsetY; } @Override protected void entityInit() {} @Override protected void readEntityFromNBT(NBTTagCompound comp) {} @Override protected void writeEntityToNBT(NBTTagCompound comp) {} @Override public void onEntityUpdate() { if (this.riddenByEntity == null || this.riddenByEntity.isDead) this.setDead(); super.onEntityUpdate(); } @Override public boolean interactFirst(EntityPlayer p) { if (this.riddenByEntity != null) return true; if (!this.worldObj.isRemote) p.mountEntity(this); return true; } @Override public double getMountedYOffset() { return this.offsetY; } } -
[1.7.10] Entity mountable not working (problem with synchronization)
SCAREX replied to SCAREX's topic in Modder Support
I found out that the method onBlockAdded is fired only on the server, And when I spawn the entity, the client doesn't know that the entity is actually there : I will put the spawn of the mob in another method to see if there is a difference. -
The name of the event is InitGuiEvent, but you can also use the postInitializationEvent
-
Minecraft.getMinecraft().thePlayer.getGameProfile()
-
You can replace the block with GameRegistry.addSubstitute (or something like that).
-
The break event gives you all the parameters you need to get the block metadata, new ItemStack(evt.block, 1, evt.blockMetadata)
-
Attack animation not working [1.7.10]
SCAREX replied to BoonieQuafter-CrAfTeR's topic in Modder Support
File corruption with techne example : LegR = new ModelRenderer(this, 46, 0); LegR.addBox(0F, 0F, 0F, 4, 16, 4); // The variables names should begin with a lower case letter LegR.setRotationPoint(1F, 8F, -2F); LegR.setTextureSize(64, 64); LegR.mirror = true; // Miror texture should be after the initialization setRotation(LegR, 0F, 0F, 0F); The reason that your animation doesn't work is because your event is fired once, but the method setLivingAnimation is fired every render tick. -
[SOLVED][1.8] Crash when placing underwater plant
SCAREX replied to JimiIT92's topic in Modder Support
You are using a liquid material : super(Material.water); try with a correct Material. -
I tested what you said, and I confirm : this is a bug. Another thing I found is that when you shift click, the event is fired 4 times but a simple click fires it 2 times (client and server I suppose).