Jump to content

PJack

Members
  • Posts

    10
  • Joined

  • Last visited

PJack's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. bump (the Problem still remains because i took a long break from modding)
  2. Thanks lupicus for the answer. It helps me with my other entity that have the classfication MONSTER. My Plus is registered as a CREATURE and dont spawn if i do this: spawn.getSpawns().addSpawn(EntityClassification.CREATURE, new MobSpawnInfo.Spawners(ModEntityTypes.PLUS.get(), 14, 0, 1)); WATER_CREATURE and AMBIENT was for testing, to see if my Plus really spawns.
  3. Hello guys, as you can see in the Title, i have a problem with natural spawning of my custom entities. My forge version is currently 1.16.5-36.1.18. For the spawning i use the BiomeLoadingEvent: (This is in my CommonEvents.class) @SubscribeEvent public void registerEntitySpawns(BiomeLoadingEvent spawn) { if(spawn.getCategory() != Biome.Category.NETHER || spawn.getCategory() != Biome.Category.OCEAN || spawn.getCategory() != Biome.Category.THEEND) { spawn.getSpawns().addSpawn(EntityClassification.CREATURE, new MobSpawnInfo.Spawners(ModEntityTypes.PLUS.get(), 14, 0, 1)); spawn.getSpawns().addSpawn(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(ModEntityTypes.DEMI_HOLLOW.get(), 14, 0, 1)); } System.out.println("Spawner: " + spawn.getSpawns().getSpawner(EntityClassification.CREATURE)); } Main.class private void setup(final FMLCommonSetupEvent event) { event.enqueueWork(() -> { //Register .... EntitySpawnPlacementRegistry.register(ModEntityTypes.PLUS.get(), EntitySpawnPlacementRegistry.PlacementType.ON_GROUND, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, EntityPlus::checkGhostSpawnRules); EntitySpawnPlacementRegistry.register(ModEntityTypes.DEMI_HOLLOW.get(), EntitySpawnPlacementRegistry.PlacementType.ON_GROUND, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, EntityDemiHollow::checkGhostSpawnRules); MinecraftForge.EVENT_BUS.register(new CommonEvents()); }); } The problem is: If im using EntityClassification.CREATURE then nothing happens but if im using AMBIENT, WATER_CREATURE or MONSTER than the mob spawn. AMBIENT: My custom Mob spawn when a minecraft:bat should be spawned (A bat is also an AMBIENT) WATER_CREATURE: After 30 - 45 seconds i have an army of Plus (Almost every second a Plus gets spawned) MONSTER: Only when a monster can spawn, my custom entity spawn too (Im using custom SpawnRules without any Lightlevel check but my entities still only spawn at night or thunder) There must be something that i messed up but i cant figure it out myself right now. Thanks in advance for helping out.
  4. Try with: if(button.id == 2 && button.id.isPressed()) { if(world.isRemote) { Minecraft.getMinecraft().player.sendChatMessage("/give @p " + Reference.MOD_ID + ":mystical_ingot 1"); } Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); } Maybe this should fix it
  5. I got the solution. Thanks to a post from diesieben07. Instead of sending the capability, i send the raw data from it and it works now fine in Single and Multiplayer.
  6. Okay, i removed the static. private ICharacterData value; Edit: I found out that my this.value getting null in here, but i still dont know why. @Override public void fromBytes(ByteBuf buf) { System.out.println("Check:" + this.value); if(this.value != null) { value.SetReiPlayer(buf.readInt()); value.SetReiPlayerMax(buf.readInt()); value.PlayerisGhost(buf.readInt()); } }
  7. You mean, it should be like this?: private int GetReiPlayer private int GetReiPlayerMax .... instead private static ICharacterData value;
  8. Hello guys, i have a problem with my network that send Data from Server to Client. This is my Event, where is sending the Packet: @SubscribeEvent public void onPlayerTick(PlayerTickEvent event) { if(event.side == Side.SERVER) { EntityPlayer player = event.player; ICharacterData cd = player.getCapability(CD_CAPABILITY, null); if(cd != null) { PacketHandler.INSTANCE.sendTo(new PlayerCapabilitiesMessage(cd), (EntityPlayerMP) player); } } } And this is my PlayerCapabilitiesMessage: public class PlayerCapabilitiesMessage implements IMessage { @CapabilityInject(ICharacterData.class) public static Capability<ICharacterData> CD_CAPABILITY = null; private static ICharacterData value; public PlayerCapabilitiesMessage() {} public PlayerCapabilitiesMessage(ICharacterData value) { this.value = value; } @Override public void toBytes(ByteBuf buf) { if(this.value != null) { buf.writeInt(this.value.GetReiPlayer()); buf.writeInt(this.value.GetReiPlayerMax()); buf.writeInt(this.value.PlayerisGhost(0)); } } @Override public void fromBytes(ByteBuf buf) { if(this.value != null) { this.value.SetReiPlayer(buf.readInt()); this.value.SetReiPlayerMax(buf.readInt()); this.value.PlayerisGhost(buf.readInt()); } } public ICharacterData getValue(ICharacterData value) { return this.value; } public static class Handler implements IMessageHandler<PlayerCapabilitiesMessage, IMessage>{ @Override public IMessage onMessage(PlayerCapabilitiesMessage message, MessageContext ctx) { final ICharacterData newvalue = message.getValue(value); final EntityPlayerSP p = Minecraft.getMinecraft().player; final ICharacterData oldvalue = p.getCapability(CD_CAPABILITY, null); IThreadListener mainThread = Minecraft.getMinecraft(); mainThread.addScheduledTask(() -> { if(oldvalue != null && newvalue != null) { oldvalue.SetReiPlayer(newvalue.GetReiPlayer()); oldvalue.SetReiPlayerMax((newvalue.GetReiPlayerMax())); oldvalue.PlayerisGhost(newvalue.PlayerisGhost(0)); } }); return null; } } } Now my problem is: The Server and the Client are sync in Singleplayer, there is no problem. In Mulitplayer it isnt working, because the value is null, but sometimes it works with the first Player/Client who join the Server and the second one got null. Someone any idea? Thanks in advance
  9. Hello folks, at the moment i have a problem with my RenderGameOverlayEvent I want this: The "Reiatsubar" should only show up, if the Player have "Reiatsu". With this Event the Player is getting this "Reiatsu" My Problem is: Even if the Player have 10 Reiatsu, the Bar wont show up, because the cd.GetReiPlayer is 0 in the reioverlay event. Now im asking: I musst sync my capability data from server to client, right? Thank you in advance!
×
×
  • Create New...

Important Information

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