![](https://forums.minecraftforge.net/uploads/set_resources_2/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
gegy1000
-
Posts
47 -
Joined
-
Last visited
Posts posted by gegy1000
-
-
Makes sense, ok. I will try think of another way to do this. Because as you can see in my read, I am getting a random name if it doesn't already have one... What event would I use if I wanted it to get called sometime after read is called?Of course it won't call it. Since the player has never been on the server before there is no data from previous connections that could be read. This is not any different from normal servers.
-
So I am using IExtendedEntityProperties for my mod, but I have a problem with it. When another player joins a LAN world for the first time, it won't call readFromNBT on it. However, if I join again after that it does get called. I have used IExtendedEntityProperties and never got a problem with this. So that's why I posted this here.
You can find the source code here: https://github.com/gegy1000/WarriorsMod/blob/master/src/main/java/net/gegy1000/warriors/common/data/WarriorCatData.java
And my Event:
-
Since the event you are using is a fml event, you'll have to use: FMLCommonHandler.instance().bus().register() You can tell whether they are an FML event or a Forge event by looking at their package name.
-
Are you registering the event with the correct bus? Send your registration code for the event.
-
I have some armor, that when you put on the full set it activates some animations. I have an animation that only activates when off the ground. player.onGround works perfectly when in single player but when one player views another player with the armor on, it activates the falling animation, because player.onGround is not synced between clients. That is not what I want to happen. I can't think of another way to check if the player is on the ground. I tried checking if the block beneath the player is air, but it doesn't work that well because you could be standing on the very edge of a block.
I also use player.motionY and player.capabilties.isFlying in the animation. But then again, that is not synced between clients.
I want to avoid using packets for this because I don't want to send too many of them just for the animation.
You can find the source here: https://github.com/FiskFille/TransformersMod/blob/master/src/main/java/fiskfille/tf/client/model/transformer/ModelPurge.java/#L550
- gegy1000
-
Bounding box size of 80, 80. http://prntscr.com/6afo74 I'm standing right next to it. (It's a sphere)How big is "REALLY" big? Maybe you can post an image or give us the bounding box size?
-
As I said, this is a REALY big entityI doubt that is possible without interacting directly with server property "viewDistance".
Maximum range it 16*distance+16.
From what I remember server only supporst distance up to 15 so anything beyond 256 is impossible for server to send to client.
You could access viewDistance property (maybe reflection is enough) and edit it, but it might be autocorrecting itself (idk, there are calls to setDist in ticking method, I didn't realy looked further).
How is 256 not enough?
-
I have an entity, that is really big, I want it to render from further away though. I've tried changing the tracking range when I register the entity, but that has a max range too.
-
Remove your if(!worldIn.isRemote) in onBlockActivated in BlockNileWorkbench
-
Try going into 1.8, change render distance to 16 or under and then run in 1.7.10 again with mods and it shouldn't crash
-
As the title says, I'm trying to put a Zero-Gravity effect on the player.
If anyone knows how I can do this, please notify me
-
Doesn't world.getWorldTime() just return the time of day?You will need a tick handler and you will want it to check the world.getWorldTime() value and check to see if it's the "when" you want your Thing to happen, and then Do It.
-
I want to make a certain event happen after a certain amount of Minecraft days. But I'm not sure how I would go about doing this. Any help would be gratefully appreciated.
-
First of all, please do not implement IMessage and IMessageHandler on the same class.
Then: Even if the packet is only received on the client you cannot use client-only classes in it, since of course the server needs to load the class as well, to send the packet.
Tried this, still crashes with the same log, what are we doing wrong? D:
-
I've recently started using the SimpleNetworkWrapper for sending packets, but when I start the server I get this crash: http://pastebin.com/KndVFmUp
I have no idea what is causing this, if anyone could help I would be very grateful.
The source can be found here: https://github.com/FiskFille/TransformersMod/blob/master/src/main/java/fiskfille/tf/common/packet/base/TFPacketManager.java
-
I'm trying to set the Camera Height and Bounding box of the player. That's all working, but after I changed the bounding box the player get's a 'black tint'. This is because I am using player.yOffset to change the camera height. I can't see any ways around this. If you could help me I would be very grateful.
Here's my code:
package gegy1000.warriors.client.renderer; import java.util.HashMap; import java.util.Map; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.entity.player.EntityPlayer; import org.lwjgl.opengl.GL11; public class CustomEntityRenderer extends EntityRenderer { private final Minecraft mc; float offsetY = -1.05F; public CustomEntityRenderer(Minecraft mc) { super(mc, mc.getResourceManager()); this.mc = mc; } public void hurtCameraEffect(float p_78482_1_) { } @Override public void renderWorld(float p_78471_1_, long p_78471_2_) { GL11.glRotatef(90, 1, 0, 0); GL11.glRotatef(90, 0, 1, 0); GL11.glRotatef(90, 0, 0, 1); super.renderWorld(p_78471_1_, p_78471_2_); } @Override public void updateCameraAndRender(float partialTick) { hurtCameraEffect(partialTick); EntityPlayer player = mc.thePlayer; if (player == null || player.isPlayerSleeping()) { super.updateCameraAndRender(partialTick); return; } GL11.glRotatef(90, 1, 0, 0); player.yOffset -= offsetY; super.updateCameraAndRender(partialTick); player.yOffset = 1.62F; } @Override public void getMouseOver(float partialTick) { super.getMouseOver(partialTick); } }
@SubscribeEvent public void renderTick(TickEvent.RenderTickEvent event) { Minecraft mc = Minecraft.getMinecraft(); if (mc.theWorld != null) { if(event.phase == Phase.START) { EntityClientPlayerMP player = mc.thePlayer; if (renderer == null) { renderer = new CustomEntityRenderer(mc); } if (mc.entityRenderer != renderer) { prevRenderer = mc.entityRenderer; mc.entityRenderer = renderer; } } else if(event.phase == Phase.END) { } } }
-
https://docs.oracle.com/javase/7/docs/api/java/lang/StackOverflowError.html
Your code is probably getting into an infinite loop.
-
I just moved my development code from one harddrive to the other. E - D
And I'm getting this error:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_21]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_21]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_21]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_21]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source) ~[?:1.7.0_21]
at java.lang.Runtime.loadLibrary0(Unknown Source) ~[?:1.7.0_21]
at java.lang.System.loadLibrary(Unknown Source) ~[?:1.7.0_21]
at org.lwjgl.Sys$1.run(Sys.java:73) ~[lwjgl-2.9.0.jar:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_21]
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66) ~[lwjgl-2.9.0.jar:?]
at org.lwjgl.Sys.loadLibrary(Sys.java:95) ~[lwjgl-2.9.0.jar:?]
at org.lwjgl.Sys.<clinit>(Sys.java:112) ~[lwjgl-2.9.0.jar:?]
at net.minecraft.client.Minecraft.getSystemTime(Minecraft.java:2674) ~[Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:40) ~[Main.class:?]
... 6 more
I tried to make a fresh install of the forge dev environment, but the error continued.
If you have any ideas why, please respond.
Thank You
-
Diesieben07's somewhat cryptic remark means that you have to look at the extended events from PlayerUseItemEvent and find the one you want. There is actually these events available:
PlayerUseItemEvent.Start
PlayerUseItemEvent.Tick
PlayerUseItemEvent.Finish
PlayerUseItemEvent.Stop
By the way, I know it is hard to figure out all the available events, and also you can get ideas from mods by learning all the available events so I've tried to compile a list in my tutorial, you might want to check it out: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-event-handling.html
I've used PlayerUseItemEvent.Finish and it doesn't give an error but the even never get's called.
-
I'm trying to use the PlayerUseItemEvent but I keep getting this error:
java.lang.InstantiationException
at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at cpw.mods.fml.common.eventhandler.EventBus.register(EventBus.java:90)
at cpw.mods.fml.common.eventhandler.EventBus.register(EventBus.java:72)
at com.gegy1000.advancedgravity.event.AdvancedGravityEvents.registerEvents(AdvancedGravityEvents.java:13)
at com.gegy1000.advancedgravity.proxy.CommonProxy.init(CommonProxy.java:12)
at com.gegy1000.advancedgravity.proxy.ClientProxy.init(ClientProxy.java:21)
at com.gegy1000.advancedgravity.AdvancedGravityMod.load(AdvancedGravityMod.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:209)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:500)
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:202)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:520)
at net.minecraft.client.Minecraft.run(Minecraft.java:890)
at net.minecraft.client.main.Main.main(Main.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
Registry Code:
MinecraftForge.EVENT_BUS.register(new EventPlayerUseItem());
Event Class:
package com.gegy1000.advancedgravity.event;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.init.Items;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.PlayerUseItemEvent;
import com.gegy1000.advancedgravity.handler.AdvancedGravityGravityHandler;
import com.gegy1000.advancedgravity.rotated.RotatedEntity;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class EventPlayerUseItem
{
@SubscribeEvent
public void onRightClick(PlayerUseItemEvent event) //Changed PlayerUseItemEvent to PlayerUseItemEvent.Finish. And now it doesn't give me an error but the event never get's called
{
if(event.item.getItem() == Items.stick)
{
RotatedEntity rotatedentity = (RotatedEntity) AdvancedGravityGravityHandler.getRotatedEntities(event.entityPlayer.worldObj).get(event.entityPlayer.getUniqueID().toString());
if(rotatedentity != null)
{
if(rotatedentity.rotation == 1)
{
World world = event.entityPlayer.worldObj;
EntityCow cow = new EntityCow(world);
world.spawnEntityInWorld(cow);
AdvancedGravityGravityHandler.rotateEntity(cow, 1);
}
}
}
}
}
IExtendedEntityProperties readFromNBT not called first time join LAN world
in Modder Support
Posted