Jump to content

[1.14.4] Making a Trident like item


MineModder2000

Recommended Posts

22 minutes ago, MineModder2000 said:

new SSpawnObjectPacket

I didnt say use it... you need to make your own packet.

 

6 hours ago, Animefan8888 said:

To implement your own look at SSpawnObjectPacket

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Just now, MineModder2000 said:

I don't see how that would make any difference,

The problem is that your Entity is not being spawned on the client. The packet I told you to look at is responsible for spawning the entity on the client. You need to create your own, that spawns the entity on the client. If you can't figure that out I don't know what else to do because I'm not giving you the code.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

31 minutes ago, Animefan8888 said:

The problem is that your Entity is not being spawned on the client. The packet I told you to look at is responsible for spawning the entity on the client. You need to create your own, that spawns the entity on the client. If you can't figure that out I don't know what else to do because I'm not giving you the code.

 

package mymod.spear;

import java.io.IOException;
import java.util.UUID;
import net.minecraft.client.network.play.IClientPlayNetHandler;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.network.IPacket;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.registry.Registry;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

public class SSpawnSpearPacket implements IPacket<IClientPlayNetHandler> {
   private int entityId;
   private UUID uniqueId;
   private double x;
   private double y;
   private double z;
   private int speedX;
   private int speedY;
   private int speedZ;
   private int pitch;
   private int yaw;
   private EntityType<?> type;
   private int data;

   public SSpawnSpearPacket() {
   }

   public SSpawnSpearPacket(int p_i50777_1_, UUID p_i50777_2_, double p_i50777_3_, double p_i50777_5_, double p_i50777_7_, float p_i50777_9_, float p_i50777_10_, EntityType<?> p_i50777_11_, int p_i50777_12_, Vec3d p_i50777_13_) {
      this.entityId = p_i50777_1_;
      this.uniqueId = p_i50777_2_;
      this.x = p_i50777_3_;
      this.y = p_i50777_5_;
      this.z = p_i50777_7_;
      this.pitch = MathHelper.floor(p_i50777_9_ * 256.0F / 360.0F);
      this.yaw = MathHelper.floor(p_i50777_10_ * 256.0F / 360.0F);
      this.type = p_i50777_11_;
      this.data = p_i50777_12_;
      this.speedX = (int)(MathHelper.clamp(p_i50777_13_.x, -3.9D, 3.9D) * 8000.0D);
      this.speedY = (int)(MathHelper.clamp(p_i50777_13_.y, -3.9D, 3.9D) * 8000.0D);
      this.speedZ = (int)(MathHelper.clamp(p_i50777_13_.z, -3.9D, 3.9D) * 8000.0D);
   }

   public SSpawnSpearPacket(Spear_Entity p_i50778_1_) {
      this(p_i50778_1_, 0);
   }

   public SSpawnSpearPacket(Spear_Entity entityIn, int typeIn) {
      this(entityIn.getEntityId(), entityIn.getUniqueID(), entityIn.posX, entityIn.posY, entityIn.posZ, entityIn.rotationPitch, entityIn.rotationYaw, entityIn.getType(), typeIn, entityIn.getMotion());
   }

   public SSpawnSpearPacket(Spear_Entity p_i50779_1_, EntityType<Spear_Entity> p_i50779_2_, int p_i50779_3_, BlockPos p_i50779_4_) {
      this(p_i50779_1_.getEntityId(), p_i50779_1_.getUniqueID(), (double)p_i50779_4_.getX(), (double)p_i50779_4_.getY(), (double)p_i50779_4_.getZ(), p_i50779_1_.rotationPitch, p_i50779_1_.rotationYaw, p_i50779_2_, p_i50779_3_, p_i50779_1_.getMotion());
   }

   /**
    * Reads the raw packet data from the data stream.
    */
   public void readPacketData(PacketBuffer buf) throws IOException {
      this.entityId = buf.readVarInt();
      this.uniqueId = buf.readUniqueId();
      this.type = Registry.ENTITY_TYPE.getByValue(buf.readVarInt());
      this.x = buf.readDouble();
      this.y = buf.readDouble();
      this.z = buf.readDouble();
      this.pitch = buf.readByte();
      this.yaw = buf.readByte();
      this.data = buf.readInt();
      this.speedX = buf.readShort();
      this.speedY = buf.readShort();
      this.speedZ = buf.readShort();
   }

   /**
    * Writes the raw packet data to the data stream.
    */
   public void writePacketData(PacketBuffer buf) throws IOException {
      buf.writeVarInt(this.entityId);
      buf.writeUniqueId(this.uniqueId);
      buf.writeVarInt(Registry.ENTITY_TYPE.getId(this.type));
      buf.writeDouble(this.x);
      buf.writeDouble(this.y);
      buf.writeDouble(this.z);
      buf.writeByte(this.pitch);
      buf.writeByte(this.yaw);
      buf.writeInt(this.data);
      buf.writeShort(this.speedX);
      buf.writeShort(this.speedY);
      buf.writeShort(this.speedZ);
   }

   public void processPacket(IClientPlayNetHandler handler) {
      //handler.handleSpawnObject(this);
   }

   @OnlyIn(Dist.CLIENT)
   public int getEntityID() {
      return this.entityId;
   }

   @OnlyIn(Dist.CLIENT)
   public UUID getUniqueId() {
      return this.uniqueId;
   }

   @OnlyIn(Dist.CLIENT)
   public double getX() {
      return this.x;
   }

   @OnlyIn(Dist.CLIENT)
   public double getY() {
      return this.y;
   }

   @OnlyIn(Dist.CLIENT)
   public double getZ() {
      return this.z;
   }

   @OnlyIn(Dist.CLIENT)
   public double func_218693_g() {
      return (double)this.speedX / 8000.0D;
   }

   @OnlyIn(Dist.CLIENT)
   public double func_218695_h() {
      return (double)this.speedY / 8000.0D;
   }

   @OnlyIn(Dist.CLIENT)
   public double func_218692_i() {
      return (double)this.speedZ / 8000.0D;
   }

   @OnlyIn(Dist.CLIENT)
   public int getPitch() {
      return this.pitch;
   }

   @OnlyIn(Dist.CLIENT)
   public int getYaw() {
      return this.yaw;
   }

   @OnlyIn(Dist.CLIENT)
   public EntityType<?> getType() {
      return this.type;
   }

   @OnlyIn(Dist.CLIENT)
   public int getData() {
      return this.data;
   }
}

 

Well Houston we have progress, it doesn't chuck tridents anymore. Well like my other throwable, it doesn't chuck anything, but hey it's something. I tried both of the following for ResourceLocation in Spear_Renderer like so :

 

public static final ResourceLocation field_203087_a = new ResourceLocation("mymod", "textures/entity/spear.png");
public static final ResourceLocation field_203087_a = new ResourceLocation("mymod/textures/entity/spear.png");

 

No cigar....

Link to comment
Share on other sites

2 minutes ago, MineModder2000 said:

public static final ResourceLocation field_203087_a = new ResourceLocation("mymod", "textures/entity/spear.png");

This is the correct one, but you don't do anything in your handle method. You need to create an instance of your entity populate it with the data and then spawn it in the client world.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

9 minutes ago, Animefan8888 said:

This is the correct one, but you don't do anything in your handle method. You need to create an instance of your entity populate it with the data and then spawn it in the client world.

 

You mean this :

 

public void processPacket(IClientPlayNetHandler handler) {
      handler.handleSpawnObject();
   }

 

I don't understand, populate it with what data. That method only accepts SSpawnObjectPackets....

Link to comment
Share on other sites

5 minutes ago, MineModder2000 said:

That method only accepts SSpawnObjectPackets....

I didn't say use handler.handleSpawnObject....

17 minutes ago, Animefan8888 said:

You need to create an instance of your entity populate it with the data and then spawn it in the client world.

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

8 minutes ago, Animefan8888 said:

I didn't say use handler.handleSpawnObject....

 

You also didn't say what method you meant.... 

 

27 minutes ago, Animefan8888 said:

This is the correct one, but you don't do anything in your handle method. You need to create an instance of your entity populate it with the data and then spawn it in the client world.

 

I don't understand where I am suppose to do this. 

Link to comment
Share on other sites

package mymod.thrown;

import java.util.Map;

import com.google.common.collect.ImmutableMap.Builder;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.stats.Stats;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class Chert extends Item { // Copies EggItem
    
    protected static final Map<Block, Block> BLOCK_STRIPPING_MAP = new Builder<Block, Block>().put(Blocks.OAK_LOG, Blocks.CAMPFIRE).build();
    CompoundNBT h;
    
    public Chert(Item.Properties builder) {
       
        super(builder);
        
        h = new CompoundNBT();
           h.putInt("tick_last", 0);
    }

    /**
     * Called to trigger the item's "innate" right click behavior. To handle when this item is used on a Block, see
     * {@link #onItemUse}.
     */
       
    public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
          
        ItemStack itemstack = playerIn.getHeldItem(handIn); 

        if (playerIn.ticksExisted - h.getInt("tick_last") >= 16) {

            h.putInt("tick_last", playerIn.ticksExisted);
            
            if (!playerIn.abilities.isCreativeMode) {
               
                itemstack.shrink(1);
            }
    
            worldIn.playSound((PlayerEntity) null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (random.nextFloat() * 0.4F + 0.8F));
              
            if (!worldIn.isRemote) {
                
                Chert_Entity chert_entity = new Chert_Entity(worldIn, playerIn);
                chert_entity.func_213884_b(itemstack);
                chert_entity.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.15F, 3.0F);
                worldIn.addEntity(chert_entity);
            }
           
        playerIn.addStat(Stats.ITEM_USED.get(this));
        
        return new ActionResult<>(ActionResultType.SUCCESS, itemstack);
      
        }
        
        else return new ActionResult<>(ActionResultType.PASS, itemstack);
   }
    
   public ActionResultType onItemUse(ItemUseContext context) {
       
       World world = context.getWorld();
       BlockPos blockpos = context.getPos();
       BlockState blockstate = world.getBlockState(blockpos);
       Block block = BLOCK_STRIPPING_MAP.get(blockstate.getBlock());
               
            if (block != null && !world.isRemote) {
                
                world.setBlockState(blockpos, block.getDefaultState(), 11);
            }
       
       return ActionResultType.SUCCESS;
   }
}

 

Is this all correct NBT-wise? Sometimes it won't chuck (I am testing it with my old code since I can't get custom entity to render), it has to due with the fact that this code is Item Stack specific. If I switch to another item, or another stack of chert, there is good chance they won't chuck anymore. I am not sure how to work the logic so that this doesn't happen. 

Edited by MineModder2000
Link to comment
Share on other sites

15 minutes ago, MineModder2000 said:

CompoundNBT h;

For the love of christ. Why are you storing this field in your Item class? This isnt possible Items are singletons. They only exist once. You need to use the ItemStack's NBT data. Look at the ItemStack class for the method names to get and set the NBT. Should be something like getTag or getTagCompound and for set just replace get with set.

  • Thanks 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

59 minutes ago, Animefan8888 said:

For the love of christ. Why are you storing this field in your Item class? This isnt possible Items are singletons. They only exist once. You need to use the ItemStack's NBT data. Look at the ItemStack class for the method names to get and set the NBT. Should be something like getTag or getTagCompound and for set just replace get with set.

I don't love him, but I got it working now. 

Link to comment
Share on other sites

Actually I am confused on this part. i have this

 

public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
    	  
    	ItemStack itemstack = playerIn.getHeldItem(handIn); 
    	itemstack.setTag(new CompoundNBT());

	    if (playerIn.ticksExisted - itemstack.getTag().getInt("tick_last") >= 16) {
	    	
	    	itemstack.getTag().putInt("tick_last", playerIn.ticksExisted);
	    	
	        if (!playerIn.abilities.isCreativeMode) {
	    	   
	            itemstack.shrink(1);
	        }
	
	        worldIn.playSound((PlayerEntity) null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (random.nextFloat() * 0.4F + 0.8F));
	    	  
	        if (!worldIn.isRemote) {
	        	
			    Chert_Entity chert_entity = new Chert_Entity(worldIn, playerIn);
			    chert_entity.func_213884_b(itemstack);
			    chert_entity.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.15F, 3.0F);
			    worldIn.addEntity(chert_entity);
	        }
	       
	    playerIn.addStat(Stats.ITEM_USED.get(this));
	    
	    return new ActionResult<>(ActionResultType.SUCCESS, itemstack);
      
	    }
	    
	    else return new ActionResult<>(ActionResultType.PASS, itemstack);
   }

 

It works but I need the set tag to only happen once. I don't see any way to do that since I can't use external static variables, nor have variables stored in the class (to do one time boolean check run). 

Link to comment
Share on other sites

2 hours ago, MineModder2000 said:

itemstack.setTag(new CompoundNBT());

if itemstack.getTag() == null

    setTag...

Edited by Animefan8888

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

1 minute ago, MineModder2000 said:

Already tried such (with various sub methods), but I get a java error. It doesn't like If I call getTag() before setTag() apparently...

The method is called getTagCompound the error was probably something along the lines ItemStack has no method getTag.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Just now, MineModder2000 said:

Ain't a dang thang as getTagCompound method.....

Somehow I was looking at my 1,12,2 sources ItemStack. apologizes. What was the error?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

3 minutes ago, Animefan8888 said:

Somehow I was looking at my 1,12,2 sources ItemStack. apologizes. What was the error?

Spoiler

---- Minecraft Crash Report ----
// There are four lights!

Time: 9/13/19 5:27 PM
Description: Unexpected error

java.lang.NullPointerException: Unexpected error
    at mymod.thrown.Chert.func_77659_a(Chert.java:47) ~[?:1.0] {}
    at net.minecraft.item.ItemStack.func_77957_a(ItemStack.java:192) ~[?:?] {}
    at net.minecraft.client.multiplayer.PlayerController.func_187101_a(PlayerController.java:307) ~[?:?] {pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1251) ~[?:?] {pl:accesstransformer:B,xf:fml:customskinloader:MinecraftTransformer,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.func_184117_aA(Minecraft.java:1484) ~[?:?] {pl:accesstransformer:B,xf:fml:customskinloader:MinecraftTransformer,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1317) ~[?:?] {pl:accesstransformer:B,xf:fml:customskinloader:MinecraftTransformer,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:865) ~[?:?] {pl:accesstransformer:B,xf:fml:customskinloader:MinecraftTransformer,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:384) ~[?:?] {pl:accesstransformer:B,xf:fml:customskinloader:MinecraftTransformer,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(SourceFile:155) ~[Forge%201.14.4.jar:?] {}
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_221] {}
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_221] {}
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_221] {}
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_221] {}
    at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:56) ~[forge-1.14.4-28.0.27.jar:28.0] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-3.1.1.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50) [modlauncher-3.1.1.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:68) [modlauncher-3.1.1.jar:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:80) [modlauncher-3.1.1.jar:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-3.1.1.jar:?] {}


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

-- Head --
Thread: Client thread
Stacktrace:
    at mymod.thrown.Chert.func_77659_a(Chert.java:47)
    at net.minecraft.item.ItemStack.func_77957_a(ItemStack.java:192)
    at net.minecraft.client.multiplayer.PlayerController.func_187101_a(PlayerController.java:307)
    at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1251)
    at net.minecraft.client.Minecraft.func_184117_aA(Minecraft.java:1484)

-- Affected level --
Details:
    All players: 1 total; [ClientPlayerEntity['Puran'/78, l='MpServer', x=-281.34, y=67.00, z=43.77]]
    Chunk stats: Client Chunk Cache: 1225, 666
    Level dimension: DimensionType{minecraft:overworld}
    Level name: MpServer
    Level seed: 0
    Level generator: ID 00 - default, ver 1. Features enabled: false
    Level generator options: {}
    Level spawn location: World: (-256,66,129), Chunk: (at 0,4,1 in -16,8; contains blocks -256,0,128 to -241,255,143), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
    Level time: 1100 game time, 1100 day time
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false
    Server brand: forge
    Server type: Integrated singleplayer server
Stacktrace:
    at net.minecraft.client.world.ClientWorld.func_72914_a(ClientWorld.java:410)
    at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:1745)
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:405)
    at net.minecraft.client.main.Main.main(SourceFile:155)
    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.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:56)
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50)
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:68)
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:80)
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:65)

-- System Details --
Details:
    Minecraft Version: 1.14.4
    Minecraft Version ID: 1.14.4
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_221, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 295156696 bytes (281 MB) / 688017408 bytes (656 MB) up to 10468196352 bytes (9983 MB)
    CPUs: 16
    JVM Flags: 5 total; -Xmn128M -Xmx9995M -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xss1M -XX:+UseConcMarkSweepGC
    ModLauncher: 3.1.1+59+e32e753
    ModLauncher launch target: fmlclient
    ModLauncher naming: srg
    ModLauncher services: 
        /eventbus-0.10.6-service.jar eventbus PLUGINSERVICE 
        /forge-1.14.4-28.0.27.jar object_holder_definalize PLUGINSERVICE 
        /forge-1.14.4-28.0.27.jar runtime_enum_extender PLUGINSERVICE 
        /accesstransformers-0.16.0-shadowed.jar accesstransformer PLUGINSERVICE 
        /forge-1.14.4-28.0.27.jar capability_inject_definalize PLUGINSERVICE 
        /forge-1.14.4-28.0.27.jar runtimedistcleaner PLUGINSERVICE 
        /forge-1.14.4-28.0.27.jar fml TRANSFORMATIONSERVICE 
    FML: 28.0
    Forge: net.minecraftforge:28.0.27
    FML Language Providers: 
        javafml@28.0
    Mod List: 
        modid-1.0.jar My Mod {mymod@1.0 DONE}
        tl_skin-1.2.jar TL_SKIN {customskinloader@1.1 DONE}
        forge-1.14.4-28.0.27-universal.jar Forge {forge@28.0.27 DONE}
    Launched Version: Forge 1.14.4
    LWJGL: 3.2.2 build 10
    OpenGL: GeForce GTX 1660/PCIe/SSE2 GL version 4.6.0 NVIDIA 431.60, NVIDIA Corporation
    GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

    Using VBOs: Yes
    Is Modded: Definitely; Client brand changed to 'forge'
    Type: Client (map_client.txt)
    Resource Packs: vanilla, file/M32
    Current Language: English (US)
    CPU: 16x Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz

 

Link to comment
Share on other sites

3 minutes ago, MineModder2000 said:

at mymod.thrown.Chert.func_77659_a(Chert.java:47)

Something on this line is null. Figure out what is null and make it so it's not null.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

2 minutes ago, Animefan8888 said:

Something on this line is null. Figure out what is null and make it so it's not null.

 

Hmmm.....

 

 if (playerIn.ticksExisted - itemstack.getTag().getInt("tick_last") >= 16) {

 

It can only be the itemstack.getTag. It works if I don't have the if check on : itemstack.setTag(new CompoundNBT()); So i guess that means getTag() isn't null to begin with, and thus the tag never gets initialized....

Link to comment
Share on other sites

3 minutes ago, MineModder2000 said:

So i guess that means getTag() isn't null to begin with, and thus the tag never gets initialized....

No it would be null unless you initialized it. Post your getTag if statement.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

13 minutes ago, Animefan8888 said:

No it would be null unless you initialized it. Post your getTag if statement.

Oh dear oh my this is silly, and I blame thou. 

 

2 hours ago, MineModder2000 said:

if itemstack.getTag() != null

    setTag...

 

I copied it without even thinking, you edited it in your own post but I was somehow blind to it. I changed it to "==" now it works....

Edited by MineModder2000
Link to comment
Share on other sites

Just now, MineModder2000 said:

and I blame thou. 

Cool I did make the type-O. But...

1 minute ago, MineModder2000 said:

I copied it without even thinking

I'm not responsible for this.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Just now, MineModder2000 said:

Now how bouts we fix the rendering entity issue

I told you how to do it in your Trident post. You need to override getSpawnPacket in your Entity class and return your own IPacket that spawns the Entity. The problem is the vanilla one doesn't handle modded entities unless they extend LivingEntity.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements




  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • They were already updated, and just to double check I even did a cleanup and fresh update from that same page. I'm quite sure drivers are not the problem here. 
    • i tried downloading the drivers but it says no AMD graphics hardware has been detected    
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
  • Topics

×
×
  • Create New...

Important Information

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