Jump to content

Recommended Posts

Posted

For some reason I'm having an issue here with some && on my item here...

 

Here's what I got goin' in 1.11, underlined where its in the red:

 

package guru.tbe.item;

import guru.tbe.entity.EntityAirOrb;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.world.World;

public class ItemAirOrb extends Item
{
    public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
    {
        ItemStack itemstack = worldIn.getHeldItem(playerIn);

        if (!worldIn.capabilities.isCreativeMode)
        {
            itemstack.func_190918_g(1);
        }

        itemStackIn.playSound((EntityPlayer)null, worldIn.posX, worldIn.posY, worldIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if ([u]!itemStackIn[/u] && !worldIn.isSneaking())
        {
             if (!itemStackIn.isRemote)
        {
            EntityAirOrb entitythrowable = new EntityAirOrb(itemStackIn, worldIn);
            entitythrowable.setHeadingFromThrower(worldIn, worldIn.rotationPitch, worldIn.rotationYaw, 0.0F, 1.5F, 1.0F);
            itemStackIn.spawnEntityInWorld(entitythrowable);
        }
        }
        if ([u]!itemStackIn[/u] && worldIn.isSneaking())
        {
            EntityAirOrb entitythrowable = new EntityAirOrb(itemStackIn, worldIn);
            entitythrowable.setHeadingFromThrower(worldIn, worldIn.rotationPitch, worldIn.rotationYaw, 0.0F, 1.5F, 1.0F);
            entitythrowable.addVelocity(0.0, 0.27, 0.0);
            itemStackIn.spawnEntityInWorld(entitythrowable);
        }
        worldIn.addStat(StatList.getObjectUseStats(this));
        return new ActionResult(EnumActionResult.SUCCESS, itemstack);
    }
}

 

 

Is there any idea as to what's going on here?

 

In 1.10.2 this worked amazingly:

 

package guru.tbe.item;

import guru.tbe.entity.EntityAirOrb;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.world.World;

public class ItemAirOrb extends Item
{
    public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
    {
        if (!playerIn.capabilities.isCreativeMode)
        {
            --itemStackIn.stackSize;
        }
        worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.4F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
        if (!worldIn.isRemote && !playerIn.isSneaking())
        {
            EntityAirOrb entitythrowable = new EntityAirOrb(worldIn, playerIn);
            entitythrowable.func_184538_a(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
            worldIn.spawnEntityInWorld(entitythrowable);
        }
        if (!worldIn.isRemote && playerIn.isSneaking())
        {
            EntityAirOrb entitythrowable = new EntityAirOrb(worldIn, playerIn);
            entitythrowable.func_184538_a(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 0.001F, 0.0F);
            entitythrowable.addVelocity(0.0, 0.27, 0.0);
            worldIn.spawnEntityInWorld(entitythrowable);
        }
        playerIn.addStat(StatList.getObjectUseStats(this));
        return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
    }
}

 

 

Posted

1.10:

if (!worldIn.isRemote && !playerIn.isSneaking())

1.11:

if (!itemStackIn && !worldIn.isSneaking())

 

Are you actually an idiot or are you just pretending?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

This one works:

 

public class ItemAetherOrb extends Item
{
    public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
    {
        ItemStack itemstack = worldIn.getHeldItem(playerIn);

        if (!worldIn.capabilities.isCreativeMode)
        {
            itemstack.func_190918_g(1);
        }

        itemStackIn.playSound((EntityPlayer)null, worldIn.posX, worldIn.posY, worldIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!itemStackIn.isRemote)
        {
            EntityAetherOrb entitythrowable = new EntityAetherOrb(itemStackIn, worldIn);
            entitythrowable.setHeadingFromThrower(worldIn, worldIn.rotationPitch, worldIn.rotationYaw, 0.0F, 1.5F, 1.0F);
            itemStackIn.spawnEntityInWorld(entitythrowable);
        }
        worldIn.addStat(StatList.getObjectUseStats(this));
        return new ActionResult(EnumActionResult.SUCCESS, itemstack);
    }
}

 

 

 

but I need this for my magic spells so when I hold shift and right click it lobs one in the air and comes back down and hits me:

 

public class ItemAirOrb extends Item
{
    public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
    {
        ItemStack itemstack = worldIn.getHeldItem(playerIn);

        if (!worldIn.capabilities.isCreativeMode)
        {
            itemstack.func_190918_g(1);
        }

        itemStackIn.playSound((EntityPlayer)null, worldIn.posX, worldIn.posY, worldIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!itemStackIn && !worldIn.isSneaking())
        {
             if (!itemStackIn.isRemote)
        {
            EntityAirOrb entitythrowable = new EntityAirOrb(itemStackIn, worldIn);
            entitythrowable.setHeadingFromThrower(worldIn, worldIn.rotationPitch, worldIn.rotationYaw, 0.0F, 1.5F, 1.0F);
            itemStackIn.spawnEntityInWorld(entitythrowable);
        }
        }
        if (!itemStackIn && worldIn.isSneaking())
        {
            EntityAirOrb entitythrowable = new EntityAirOrb(itemStackIn, worldIn);
            entitythrowable.setHeadingFromThrower(worldIn, worldIn.rotationPitch, worldIn.rotationYaw, 0.0F, 1.5F, 1.0F);
            entitythrowable.addVelocity(0.0, 0.27, 0.0);
            itemStackIn.spawnEntityInWorld(entitythrowable);
        }
        worldIn.addStat(StatList.getObjectUseStats(this));
        return new ActionResult(EnumActionResult.SUCCESS, itemstack);
    }
}

 

 

Its driving me insane!!!!!!!!! asdfhiowehf

 

Are you actually an idiot or are you just pretending?

 

I did quite a bit of studying in the past year, sometimes it works, sometimes it doesn't to be honest... I just do what I can. I could be like Albert Einstein. Speaking of whom, I found two peter max posters sticking out of a dumpster taking out the trash today. Nearly mint condition, one of them the Albert Einstein apollo 11 #1 1969. I also saw a pair of wooden water skiis, they were in mint condition too so I grabbed them as well.

 

I can't imagine who would leave 2 1000$ paper posters and a pair of awesome water skii's in a dumpster... but man, I'm so gladddd I have these posters :) I know I could never afford one. It was an awesome find. - glad I went to see what was inside the vague paper scrolls.

 

edit:

-so next summer I'll go water skiing too. which is super awesome, haven't done that before.

Posted

Are you actually an idiot or are you just pretending?

 

You may be on to something man......... Really its just I have so much going on.

 

Thanks, I can't believe I missed that.... wow.... where's that face palm photo at.... >.< .... geeeez what's wrong with me.... getchyurselftogetherman

 

{
    public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
    {
        ItemStack itemstack = worldIn.getHeldItem(playerIn);

        if (!worldIn.capabilities.isCreativeMode)
        {
            itemstack.func_190918_g(1);
        }

        itemStackIn.playSound((EntityPlayer)null, worldIn.posX, worldIn.posY, worldIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!itemStackIn.isRemote && !worldIn.isSneaking())
        {
             if (!itemStackIn.isRemote)
        {
            EntityAirOrb entitythrowable = new EntityAirOrb(itemStackIn, worldIn);
            entitythrowable.setHeadingFromThrower(worldIn, worldIn.rotationPitch, worldIn.rotationYaw, 0.0F, 1.5F, 1.0F);
            itemStackIn.spawnEntityInWorld(entitythrowable);
        }
        }
        if (!itemStackIn.isRemote && worldIn.isSneaking())
        {
            EntityAirOrb entitythrowable = new EntityAirOrb(itemStackIn, worldIn);
            entitythrowable.setHeadingFromThrower(worldIn, worldIn.rotationPitch, worldIn.rotationYaw, 0.0F, 1.5F, 1.0F);
            entitythrowable.addVelocity(0.0, 0.27, 0.0);
            itemStackIn.spawnEntityInWorld(entitythrowable);
        }
        worldIn.addStat(StatList.getObjectUseStats(this));
        return new ActionResult(EnumActionResult.SUCCESS, itemstack);
    }
}

Posted

For fuck's sake.

 

Rename your fucking variables.

 

What is this shit?

 

(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Well.... I managed to register my stuff, problem is when I got done, all my spells were combined into one.... >.>

 

So now I'm sitting here looking at this seeing if I can find some way to register 2 entities and not one... *sigh*

 

 

package exampled.modinfo;

import exampled.modinfo.entity.EntityOrb;
import exampled.modinfo.entity.EntitySphere;
import exampled.modinfo.init.ExampledEntities;
import exampled.modinfo.init.ExampledItems;
import exampled.modinfo.proxy.CommonProxy;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.MOD_VERSION)
public class Exampled
{
@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy;
@Instance(Reference.MOD_ID)
private static Exampled instance;
private static ResourceLocation rsrcl;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	ModCreativeTabs.load();
	proxy.preInit();
	ExampledItems.init();
	ExampledItems.register();
	ExampledEntities.registerEntities(getResourceLocation());
	initRecipes();
}
    @EventHandler
    public void init(FMLInitializationEvent event)
    { 
    	
	proxy.registerRenders();
        proxy.registerKeybindings();
        NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
    }	
private static void initRecipes()
{
	GameRegistry.addRecipe(new ItemStack(ExampledItems.SPHERE), new Object[] {" X ",  "X X", " X ", 'X', Item.getItemFromBlock(Blocks.DIRT)});
}
public static Exampled getInstance()
{
	return instance;
}
public static ResourceLocation getResourceLocation()
{
	return rsrcl;
}
}

 

 

for some reason its making me change rsrl to rsrl1.... I don't know *sigh*

import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.EntityRegistry;

public class ExampledEntities
{	
private static ResourceLocation rscrl = new ResourceLocation(Reference.MOD_ID, "EntitySphere");
private static ResourceLocation rscrl1 = new ResourceLocation(Reference.MOD_ID, "EntitySphere2");
public static void registerEntities(ResourceLocation rsrcl) {
	// TODO Auto-generated method stub
	EntityRegistry.registerModEntity(rscrl, EntitySphere.class, rscrl.toString(), 0, Exampled.getInstance(), 128, 214, true);
}
public static void registerEntities1(ResourceLocation rsrcl1) {
	// TODO Auto-generated method stub
	EntityRegistry.registerModEntity(rscrl1, EntitySphere.class, rscrl1.toString(), 0, Exampled.getInstance(), 128, 214, true);
}
}

 

*braces self for brutal agonizing ridiculously intense insult*

 

Posted
*braces self for brutal agonizing ridiculously intense insult*

before that happens, You register them with the same id of 0, I personally prefer to use this method for ID's that I don't need to remember

 

int id = 0;

 

EntityRegistry.registerModEntity(rscrl, EntitySphere.class, rscrl.toString(), id++, Exampled.getInstance(), 128, 214, true);

 

EDIT:

 

just to be clear make sure if a "register" method has a param called "ID" or something that sounds like it needs to be "Unique" ensure that it is indeed unique.

 

EDIT2: I also included my method into one of your registers, and bolded it for easier detection

Posted

this is what I ended up with but obviously it is wrong because both rsrcl are underlined "rsrcl = new"

 

package exampled.modinfo.init;

import exampled.modinfo.Exampled;
import exampled.modinfo.Reference;
import exampled.modinfo.entity.EntityOrb;
import exampled.modinfo.entity.EntitySphere;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.EntityRegistry;

public class ExampledEntities
{	
static int id = 0;
public static void register(ResourceLocation rsrcl)
{
ResourceLocation rsrcl = new ResourceLocation(Reference.MOD_ID, "EntitySphere");
ResourceLocation rsrcl = new ResourceLocation(Reference.MOD_ID, "EntitySphere2");
}
public static void registerEntities(ResourceLocation rsrcl) {
	// TODO Auto-generated method stub
	EntityRegistry.registerModEntity(rsrcl, EntitySphere.class, rsrcl.toString(), id++, Exampled.getInstance(), 128, 214, true);
}
}

 

I'm so wrong... and I know it.

Posted

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

sure thing....

 

I just got here without any errors.... but I get a crash like so.

Main:

 

package exampled.modinfo;

import exampled.modinfo.init.ExampledEntities;
import exampled.modinfo.init.ExampledItems;
import exampled.modinfo.proxy.CommonProxy;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.MOD_VERSION)
public class Exampled
{
@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy;
@Instance(Reference.MOD_ID)
private static Exampled instance;
private static ResourceLocation rsrcl;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	ModCreativeTabs.load();
	proxy.preInit();
	ExampledItems.init();
	ExampledItems.register();
	ExampledEntities.registerEntities(rsrcl);
	initRecipes();
}
@EventHandler
    public void init(FMLInitializationEvent event)
    { 
    	
	proxy.registerRenders();
        proxy.registerKeybindings();
        NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
    }	
private static void initRecipes()
{
	GameRegistry.addRecipe(new ItemStack(ExampledItems.SPHERE), new Object[] {" X ",  "X X", " X ", 'X', Item.getItemFromBlock(Blocks.DIRT)});
}
public static Exampled getInstance()
{
	return instance;
}
public static ResourceLocation getResourceLocation()
{
	return rsrcl;
}

}

 

entityclass:

 

package exampled.modinfo.init;

import exampled.modinfo.Exampled;
import exampled.modinfo.Reference;
import exampled.modinfo.entity.EntityOrb;
import exampled.modinfo.entity.EntitySphere;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.EntityRegistry;

public class ExampledEntities
{	
static int id = 0;
private static void register(ResourceLocation rsrcl)
{
	rsrcl = new ResourceLocation(Reference.MOD_ID, "EntitySphere");
	rsrcl = new ResourceLocation(Reference.MOD_ID, "EntitySphere2");
}
public static void registerEntities(ResourceLocation rsrl) {
	// TODO Auto-generated method stub
	EntityRegistry.registerModEntity(rsrl, EntitySphere.class, rsrl.toString(), id++, Exampled.getInstance(), 128, 214, true);
}
}

 

 

crash-log:

 

---- Minecraft Crash Report ----
// Who set us up the TNT?

Time: 11/22/16 11:27 AM
Description: There was a severe problem during mod loading that has caused the game to fail

net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from change_this_to_set_mod_name (exampled)
Caused by: java.lang.NullPointerException
at exampled.modinfo.init.ExampledEntities.registerEntities(ExampledEntities.java:20)
at exampled.modinfo.Exampled.preInit(Exampled.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:602)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:243)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:221)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:145)
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:614)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:263)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:476)
at net.minecraft.client.Minecraft.run(Minecraft.java:385)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- System Details --
Details:
Minecraft Version: 1.11
Operating System: Windows Vista (x86) version 6.0
Java Version: 1.8.0_111, Oracle Corporation
Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
Memory: 743231928 bytes (708 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP 9.35 Powered by Forge 13.19.0.2154 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCH	mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
UCH	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.11-13.19.0.2154.jar) 
UCH	forge{13.19.0.2154} [Minecraft Forge] (forgeSrc-1.11-13.19.0.2154.jar) 
UCE	exampled{1.0} [change_this_to_set_mod_name] (bin) 
Loaded coremods (and transformers): 
GL info: ' Vendor: 'ATI Technologies Inc.' Version: '3.3.11672 Compatibility Profile Context' Renderer: 'ATI Radeon HD 2400 PRO'

 

 

I'll get that zip though.

 

Ok.... maybe i need to rebuild forge or something... something wierds going on... >.>

 

woops wrong log, Still drinkin' coffee. updated

Posted

lol.. comas are underlined, what a trip this is...

 

public class ExampledEntities
{	
private static int id = 0;

public static void registerEntities(ResourceLocation rsrcl)
{
	register(rsrcl), EntitySphere.class, "entity_sphere");
	register(rsrcl), EntitySphere2.class, "entity_sphere2");
}
public static void register(ResourceLocation rsrcl, Class cls, String name) {
	// TODO Auto-generated method stub

	EntityRegistry.registerModEntity(rsrcl, cls, name, id++, Exampled.getInstance(), 128, 214, true);
}
}

 

 

Posted

For fuck's sake.

 

Rename your fucking variables.

 

What is this shit?

 

(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)

 

I know how it happened : he copy pasted the signature of the superclass method, which was deobfuscated using 1.10.2 mappings while on 1.11. A new parameter was added in the new version hence the "shift" in parameters name. It does not excuse the mistake, but it's an explanation.

@OP update your mappings. Newest ones are compatible with 1.11.

 

Also, your register entities is garbage. You use the same resource location for all entities, very stupid. Each entity needs its own.

 

Posted

DANNNNGGGG ITTTTTTTTT

 

still getting crash man.

 

public class ExampledEntities
{	
private static int id = 0;

public static void registerEntities(ResourceLocation rsrcl)
{
	register(rsrcl, EntitySphere.class, "entity_sphere");
	register(rsrcl, EntitySphere2.class, "entity_sphere2");
	rsrcl  = new ResourceLocation("entity_sphere");
	rsrcl  = new ResourceLocation("entity_sphere2");
}
public static void register(ResourceLocation rsrcl, Class cls, String name) {
	// TODO Auto-generated method stub

	EntityRegistry.registerModEntity(rsrcl, cls, name, id++, Exampled.getInstance(), 128, 214, true);
}
}

Posted

Writing code such as two variables in the same place with the same name, and trying to register two entities using the same resource location shows that you do not even begin to comprehend programming, let alone Java.

 

I say this in the friendliest possible way: It's time to phone a friend. Invite a more computer-savvy acquaintance over to sit at your keyboard and translate your concepts into computer language. You need more help than we can provide remotely.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

i need to just stop.... and step away. I know I'm totally messing up.... I just need to stop.

 

And go learn basic programming. You're literally flailing about at random and don't know what anything does.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

i need to just stop.... and step away. I know I'm totally messing up.... I just need to stop.

 

And go learn basic programming. You're literally flailing about at random and don't know what anything does.

 

yeah, that's the only support I've got from you short of being called several indignant names. So wtf ever dude.

Posted

-.- They are correct, you are making fundamental errors, and are obviously copy/pasting code without reading it.

Stop doing that, go through some Java 101 tutorials and your issues will be obvious to you.

This is not a Java school, you are expected to be a little be competent if you want people to help you.

Locking as this thread is going nowhere.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
    • Do you use features of inventory profiles next (ipnext) or is there a change without it?
    • Remove rubidium - you are already using embeddium, which is a fork of rubidium
  • Topics

×
×
  • Create New...

Important Information

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