Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/07/17 in all areas

  1. Basically, you'll collide from some directions and not others and general wonkiness. The only, the only, direction it is safe to extend a collision box outside the 1x1x1 cube is +Y and even then only an extra half-block.
    1 point
  2. Just report it with the "Report post" link, the moderators will delete the posts and probably ban the user when they come online. Unfortunately the spam seems to build up every day when there aren't any moderators online. Side note: The spam is in Korean, not Chinese.
    1 point
  3. Block#dropBlockAsItemWithChance is only called on the server. Block#removedByPlayer is called just before that on both the server and the client, but only the client of the player who broke the block. The clients of other nearby players don't know that a block was broken by a player, the server just tells them to play the breaking effects and set the block to air. Why do you need a numeric ID? Packets can send other data types, including strings. Every IForgeRegistryEntry implementation has a numeric ID, which you can access from the corresponding registry with RegistryNamespaced#getIDForObject. Vanilla implementations store their registry as a static field of the entry class, but mod implementations may not. If you only have the registry as an IForgeRegistry, you can't access the numeric IDs directly. There's nothing limiting SPacketSoundEffect to vanilla SoundEvents, it will work with any SoundEvent. Forge's documentation explains the various methods that play sound here. If you create a SoundType and set it as the Block's SoundType with Block#setSoundType, the SoundEvents will be automatically played at the appropriate times (including when the Block is broken). You can also override Block#addDestroyEffects to add any custom effects (and optionally disable the vanilla particles) when the Block is destroyed.
    1 point
  4. You should only include the item quads for the TRANSLUCENT render layer, this should ensure they're rendered with transparency enabled. You can get the current render layer using MinecraftForgeClient.getRenderLayer. The "flip-v" custom data property (in the blockstates file) is only used by ObjModel, it does nothing for any other type of model.
    1 point
  5. LivingExperienceDropEvent is fired when a living entity (e.g. a player) is about to drop XP on death, you can cancel it to prevent any XP from dropping.
    1 point
  6. I want to spawn some fire particles in my block's onBlockActivated method, when a variable in my tile entity is the right value (basically, you have to "activate" the block 3 times within a small window of time before the particles will spawn, and I'm saving the number of times and time elapsed in my tile entity). I have read about a million posts on this, and everything says that you should be able to spawn vanilla particles from the server. I swear I have seen examples of other mods doing this, too, but I can't get it to work. I know the code is running, because the println statement fires. I also tried sending a packet, but it didn't work. I didn't include that code since I don't really think I should have to do that anyway. Please correct me if I'm wrong. I also tried spawning the particles on the client, but even after grabbing a copy of my tile entity from the BlockPos parameter, I can't seem to access the variables (they don't change like they should). @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { EnumCampfireState campfireState = state.getValue(CAMPFIRE_STATE); TileEntity tileEntity = world.getTileEntity(pos); int stokeTime = ((PrimalTileEntityCampfire) tileEntity).tinderStokeTime; int timesBlown = ((PrimalTileEntityCampfire) tileEntity).tinderTimesBlown; if (world.isRemote) // client { // do stuff } else // server { if (heldItem == null && campfireState == EnumCampfireState.TINDER_STOKED) { if (stokeTime < 40) { ((PrimalTileEntityCampfire) tileEntity).tinderStokeTime = 60; ((PrimalTileEntityCampfire) tileEntity).tinderTimesBlown += 1; PrimalPacketHandler.INSTANCE.sendTo(new PrimalCampfirePacket(player, 0, pos), (EntityPlayerMP) player); } if (timesBlown > 3) { System.out.println("Spawning particle"); world.spawnParticle(EnumParticleTypes.FLAME, (double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), 0.0D, 0.0D, 0.0D, new int[0]); } } } return true; }
    1 point
  7. In your code, you already check if you are on the server side. Because of that, you can cast your world object to a WorldServer object and then use the following method to spawn your particles. It's much easier than the manual packet thing (which I wouldn't have told you about if I'm not oblivious and had read the WorldServer class). Well, knowledge of packets is always good anyways . /** Spawns the desired particle and sends the necessary packets to the relevant connected players. */ public void spawnParticle(EnumParticleTypes particleType, double xCoord, double yCoord, double zCoord, int numberOfParticles, double xOffset, double yOffset, double zOffset, double particleSpeed, int... particleArguments)
    1 point
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.