Jump to content

[1.7.10][Solved]Custom portal wont activate.


dragon3025

Recommended Posts

I'm making a custom dimension and I it's not crashing, but the portal wont activate. It's made of sandstone and is supposed to activate by fire. Here are my codes for it:

[spoiler=TeleporterMistWoods]

package com.multiverse.blocks;


import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;

import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.Direction;
import net.minecraft.util.LongHashMap;
import net.minecraft.util.MathHelper;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.Teleporter;
import net.minecraft.world.WorldServer;

public class TeleporterMistWoods extends Teleporter
{
private final WorldServer worldServerInstance;

/** A private Random() function in Teleporter */
private final Random random;
private final LongHashMap field_85191_c = new LongHashMap();
@SuppressWarnings("rawtypes")
private final List field_85190_d = new ArrayList();

public TeleporterMistWoods(WorldServer par1WorldServer)
{
	super(par1WorldServer);
	this.worldServerInstance = par1WorldServer;
	this.random = new Random(par1WorldServer.getSeed());
}

/**
 * Place an entity in a nearby portal, creating one if necessary.
 */
public void placeInPortal(Entity par1Entity, double par2, double par4, double par6, float par8)
{
	if (this.worldServerInstance.provider.dimensionId != 1)
	{
		if (!this.placeInExistingPortal(par1Entity, par2, par4, par6, par8))
		{
			this.makePortal(par1Entity);
			this.placeInExistingPortal(par1Entity, par2, par4, par6, par8);
		}
	}
	else
	{
		int i = MathHelper.floor_double(par1Entity.posX);
		int j = MathHelper.floor_double(par1Entity.posY) - 1;
		int k = MathHelper.floor_double(par1Entity.posZ);
		byte b0 = 1;
		byte b1 = 0;

		for (int l = -2; l <= 2; ++l)
		{
			for (int i1 = -2; i1 <= 2; ++i1)
			{
				for (int j1 = -1; j1 < 3; ++j1)
				{
					int k1 = i + i1 * b0 + l * b1;
					int l1 = j + j1;
					int i2 = k + i1 * b1 - l * b0;
					boolean flag = j1 < 0;
					this.worldServerInstance.setBlock(k1, l1, i2, flag ? Blocks.sandstone : Blocks.air);
				}
			}
		}

		par1Entity.setLocationAndAngles((double) i, (double) j, (double) k, par1Entity.rotationYaw, 0.0F);
		par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D;
	}
}

/**
 * Place an entity in a nearby portal which already exists.
 */
@SuppressWarnings("unchecked")
public boolean placeInExistingPortal(Entity par1Entity, double par2, double par4, double par6, float par8)
{
	short short1 = 128;
	double d3 = -1.0D;
	int i = 0;
	int j = 0;
	int k = 0;
	int l = MathHelper.floor_double(par1Entity.posX);
	int i1 = MathHelper.floor_double(par1Entity.posZ);
	long j1 = ChunkCoordIntPair.chunkXZ2Int(l, i1);
	boolean flag = true;
	double d4;
	int k1;

	if (this.field_85191_c.containsItem(j1))
	{
		PortalPosition portalposition = (PortalPosition) this.field_85191_c.getValueByKey(j1);
		d3 = 0.0D;
		i = portalposition.posX;
		j = portalposition.posY;
		k = portalposition.posZ;
		portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime();
		flag = false;
	}
	else
	{
		for (k1 = l - short1; k1 <= l + short1; ++k1)
		{
			double d5 = (double) k1 + 0.5D - par1Entity.posX;

			for (int l1 = i1 - short1; l1 <= i1 + short1; ++l1)
			{
				double d6 = (double) l1 + 0.5D - par1Entity.posZ;

				for (int i2 = this.worldServerInstance.getActualHeight() - 1; i2 >= 0; --i2)
				{
					if (this.worldServerInstance.getBlock(k1, i2, l1) == MultiverseBlocks.MistWoodsPortalBlock)
					{
						while (this.worldServerInstance.getBlock(k1, i2 - 1, l1) == MultiverseBlocks.MistWoodsPortalBlock)
						{
							--i2;
						}

						d4 = (double) i2 + 0.5D - par1Entity.posY;
						double d7 = d5 * d5 + d4 * d4 + d6 * d6;

						if (d3 < 0.0D || d7 < d3)
						{
							d3 = d7;
							i = k1;
							j = i2;
							k = l1;
						}
					}
				}
			}
		}
	}

	if (d3 >= 0.0D)
	{
		if (flag)
		{
			this.field_85191_c.add(j1, new PortalPosition(i, j, k, this.worldServerInstance.getTotalWorldTime()));
			this.field_85190_d.add(Long.valueOf(j1));
		}

		double d8 = (double) i + 0.5D;
		double d9 = (double) j + 0.5D;
		d4 = (double) k + 0.5D;
		int j2 = -1;

		if (this.worldServerInstance.getBlock(i - 1, j, k) == MultiverseBlocks.MistWoodsPortalBlock)
		{
			j2 = 2;
		}

		if (this.worldServerInstance.getBlock(i + 1, j, k) == MultiverseBlocks.MistWoodsPortalBlock)
		{
			j2 = 0;
		}

		if (this.worldServerInstance.getBlock(i, j, k - 1) == MultiverseBlocks.MistWoodsPortalBlock)
		{
			j2 = 3;
		}

		if (this.worldServerInstance.getBlock(i, j, k + 1) == MultiverseBlocks.MistWoodsPortalBlock)
		{
			j2 = 1;
		}

		int k2 = par1Entity.getTeleportDirection();

		if (j2 > -1)
		{
			int l2 = Direction.rotateLeft[j2];
			int i3 = Direction.offsetX[j2];
			int j3 = Direction.offsetZ[j2];
			int k3 = Direction.offsetX[l2];
			int l3 = Direction.offsetZ[l2];
			boolean flag1 = !this.worldServerInstance.isAirBlock(i + i3 + k3, j, k + j3 + l3) || !this.worldServerInstance.isAirBlock(i + i3 + k3, j + 1, k + j3 + l3);
			boolean flag2 = !this.worldServerInstance.isAirBlock(i + i3, j, k + j3) || !this.worldServerInstance.isAirBlock(i + i3, j + 1, k + j3);

			if (flag1 && flag2)
			{
				j2 = Direction.rotateOpposite[j2];
				l2 = Direction.rotateOpposite[l2];
				i3 = Direction.offsetX[j2];
				j3 = Direction.offsetZ[j2];
				k3 = Direction.offsetX[l2];
				l3 = Direction.offsetZ[l2];
				k1 = i - k3;
				d8 -= (double) k3;
				int i4 = k - l3;
				d4 -= (double) l3;
				flag1 = !this.worldServerInstance.isAirBlock(k1 + i3 + k3, j, i4 + j3 + l3) || !this.worldServerInstance.isAirBlock(k1 + i3 + k3, j + 1, i4 + j3 + l3);
				flag2 = !this.worldServerInstance.isAirBlock(k1 + i3, j, i4 + j3) || !this.worldServerInstance.isAirBlock(k1 + i3, j + 1, i4 + j3);
			}

			float f1 = 0.5F;
			float f2 = 0.5F;

			if (!flag1 && flag2)
			{
				f1 = 1.0F;
			}
			else if (flag1 && !flag2)
			{
				f1 = 0.0F;
			}
			else if (flag1 && flag2)
			{
				f2 = 0.0F;
			}

			d8 += (double) ((float) k3 * f1 + f2 * (float) i3);
			d4 += (double) ((float) l3 * f1 + f2 * (float) j3);
			float f3 = 0.0F;
			float f4 = 0.0F;
			float f5 = 0.0F;
			float f6 = 0.0F;

			if (j2 == k2)
			{
				f3 = 1.0F;
				f4 = 1.0F;
			}
			else if (j2 == Direction.rotateOpposite[k2])
			{
				f3 = -1.0F;
				f4 = -1.0F;
			}
			else if (j2 == Direction.rotateRight[k2])
			{
				f5 = 1.0F;
				f6 = -1.0F;
			}
			else
			{
				f5 = -1.0F;
				f6 = 1.0F;
			}

			double d10 = par1Entity.motionX;
			double d11 = par1Entity.motionZ;
			par1Entity.motionX = d10 * (double) f3 + d11 * (double) f6;
			par1Entity.motionZ = d10 * (double) f5 + d11 * (double) f4;
			par1Entity.rotationYaw = par8 - (float) (k2 * 90) + (float) (j2 * 90);
		}
		else
		{
			par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D;
		}

		par1Entity.setLocationAndAngles(d8, d9, d4, par1Entity.rotationYaw, par1Entity.rotationPitch);
		return true;
	}
	else
	{
		return false;
	}
}

public boolean makePortal(Entity par1Entity)
{
	byte b0 = 16;
	double d0 = -1.0D;
	int i = MathHelper.floor_double(par1Entity.posX);
	int j = MathHelper.floor_double(par1Entity.posY);
	int k = MathHelper.floor_double(par1Entity.posZ);
	int l = i;
	int i1 = j;
	int j1 = k;
	int k1 = 0;
	int l1 = this.random.nextInt(4);
	int i2;
	double d1;
	double d2;
	int j2;
	int k2;
	int l2;
	int i3;
	int j3;
	int k3;
	int l3;
	int i4;
	int j4;
	int k4;
	double d3;
	double d4;

	for (i2 = i - b0; i2 <= i + b0; ++i2)
	{
		d1 = (double) i2 + 0.5D - par1Entity.posX;

		for (j2 = k - b0; j2 <= k + b0; ++j2)
		{
			d2 = (double) j2 + 0.5D - par1Entity.posZ;
			label274:

			for (k2 = this.worldServerInstance.getActualHeight() - 1; k2 >= 0; --k2)
			{
				if (this.worldServerInstance.isAirBlock(i2, k2, j2))
				{
					while (k2 > 0 && this.worldServerInstance.isAirBlock(i2, k2 - 1, j2))
					{
						--k2;
					}

					for (i3 = l1; i3 < l1 + 4; ++i3)
					{
						l2 = i3 % 2;
						k3 = 1 - l2;

						if (i3 % 4 >= 2)
						{
							l2 = -l2;
							k3 = -k3;
						}

						for (j3 = 0; j3 < 3; ++j3)
						{
							for (i4 = 0; i4 < 4; ++i4)
							{
								for (l3 = -1; l3 < 4; ++l3)
								{
									k4 = i2 + (i4 - 1) * l2 + j3 * k3;
									j4 = k2 + l3;
									int l4 = j2 + (i4 - 1) * k3 - j3 * l2;

									if (l3 < 0 && !this.worldServerInstance.getBlock(k4, j4, l4).getMaterial().isSolid() || l3 >= 0 && !this.worldServerInstance.isAirBlock(k4, j4, l4))
									{
										continue label274;
									}
								}
							}
						}

						d4 = (double) k2 + 0.5D - par1Entity.posY;
						d3 = d1 * d1 + d4 * d4 + d2 * d2;

						if (d0 < 0.0D || d3 < d0)
						{
							d0 = d3;
							l = i2;
							i1 = k2;
							j1 = j2;
							k1 = i3 % 4;
						}
					}
				}
			}
		}
	}

	if (d0 < 0.0D)
	{
		for (i2 = i - b0; i2 <= i + b0; ++i2)
		{
			d1 = (double) i2 + 0.5D - par1Entity.posX;

			for (j2 = k - b0; j2 <= k + b0; ++j2)
			{
				d2 = (double) j2 + 0.5D - par1Entity.posZ;
				label222:

				for (k2 = this.worldServerInstance.getActualHeight() - 1; k2 >= 0; --k2)
				{
					if (this.worldServerInstance.isAirBlock(i2, k2, j2))
					{
						while (k2 > 0 && this.worldServerInstance.isAirBlock(i2, k2 - 1, j2))
						{
							--k2;
						}

						for (i3 = l1; i3 < l1 + 2; ++i3)
						{
							l2 = i3 % 2;
							k3 = 1 - l2;

							for (j3 = 0; j3 < 4; ++j3)
							{
								for (i4 = -1; i4 < 4; ++i4)
								{
									l3 = i2 + (j3 - 1) * l2;
									k4 = k2 + i4;
									j4 = j2 + (j3 - 1) * k3;

									if (i4 < 0 && !this.worldServerInstance.getBlock(l3, k4, j4).getMaterial().isSolid() || i4 >= 0 && !this.worldServerInstance.isAirBlock(l3, k4, j4))
									{
										continue label222;
									}
								}
							}

							d4 = (double) k2 + 0.5D - par1Entity.posY;
							d3 = d1 * d1 + d4 * d4 + d2 * d2;

							if (d0 < 0.0D || d3 < d0)
							{
								d0 = d3;
								l = i2;
								i1 = k2;
								j1 = j2;
								k1 = i3 % 2;
							}
						}
					}
				}
			}
		}
	}

	int i5 = l;
	int j5 = i1;
	j2 = j1;
	int k5 = k1 % 2;
	int l5 = 1 - k5;

	if (k1 % 4 >= 2)
	{
		k5 = -k5;
		l5 = -l5;
	}

	boolean flag;

	if (d0 < 0.0D)
	{
		if (i1 < 70)
		{
			i1 = 70;
		}

		if (i1 > this.worldServerInstance.getActualHeight() - 10)
		{
			i1 = this.worldServerInstance.getActualHeight() - 10;
		}

		j5 = i1;

		for (k2 = -1; k2 <= 1; ++k2)
		{
			for (i3 = 1; i3 < 3; ++i3)
			{
				for (l2 = -1; l2 < 3; ++l2)
				{
					k3 = i5 + (i3 - 1) * k5 + k2 * l5;
					j3 = j5 + l2;
					i4 = j2 + (i3 - 1) * l5 - k2 * k5;
					flag = l2 < 0;
					this.worldServerInstance.setBlock(k3, j3, i4, flag ? Blocks.sandstone : Blocks.air);
				}
			}
		}
	}

	for (k2 = 0; k2 < 4; ++k2)
	{
		for (i3 = 0; i3 < 4; ++i3)
		{
			for (l2 = -1; l2 < 4; ++l2)
			{
				k3 = i5 + (i3 - 1) * k5;
				j3 = j5 + l2;
				i4 = j2 + (i3 - 1) * l5;
				flag = i3 == 0 || i3 == 3 || l2 == -1 || l2 == 3;
				this.worldServerInstance.setBlock(k3, j3, i4, flag ? Blocks.sandstone : MultiverseBlocks.MistWoodsPortalBlock, 0, 2);
			}
		}

		for (i3 = 0; i3 < 4; ++i3)
		{
			for (l2 = -1; l2 < 4; ++l2)
			{
				k3 = i5 + (i3 - 1) * k5;
				j3 = j5 + l2;
				i4 = j2 + (i3 - 1) * l5;
				this.worldServerInstance.notifyBlocksOfNeighborChange(k3, j3, i4, this.worldServerInstance.getBlock(k3, j3, i4));
			}
		}
	}

	return true;
}

@SuppressWarnings("rawtypes")
public void func_85189_a(long par1)
{
	if (par1 % 100L == 0L)
	{
		Iterator iterator = this.field_85190_d.iterator();
		long j = par1 - 600L;

		while (iterator.hasNext())
		{
			Long olong = (Long) iterator.next();
			PortalPosition portalposition = (PortalPosition) this.field_85191_c.getValueByKey(olong.longValue());

			if (portalposition == null || portalposition.lastUpdateTime < j)
			{
				iterator.remove();
				this.field_85191_c.remove(olong.longValue());
			}
		}
	}
}
}

 

[spoiler=MistWoodsWorldProvider]

package com.multiverse.dimensions;

import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManagerHell;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;

import com.multiverse.main.MainRegistry;

public class MistWoodsWorldProvider extends WorldProvider
{
public void registerWorldChunkManager()
{
	this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.plains, 0.1F);
	this.dimensionId = MainRegistry.MistWoodsDimensionId;
}

@Override
public String getSaveFolder()
{
	return "DIM-G&G";
}

@Override
public String getWelcomeMessage()
{
	return "Entering The Savannah";
}

@Override
public String getDepartMessage()
{
	return "Leaving The Savannah";
}

@Override
public boolean canRespawnHere()
{
	return true;
}

@Override
public IChunkProvider createChunkGenerator()
{
	return new MistWoodsChunkProvider(worldObj, worldObj.getSeed(), true);
}

@Override
public String getDimensionName()
{
	return "Savannah";
}

/**
* Gets the hard-coded portal location to use when entering this dimension.
*/
@Override
public ChunkCoordinates getEntrancePortalLocation()
{
	return null;
}

@Override
public boolean canDoLightning(Chunk chunk)
{
	return true;
}

@Override
public boolean canDoRainSnowIce(Chunk chunk)
{
	return false;
}
}

 

[spoiler=MistWoodsChunkProvider]

package com.multiverse.dimensions;

import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE;
import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT;
import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE;
import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA;

import java.util.List;
import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.BlockFalling;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Blocks;
import net.minecraft.util.IProgressUpdate;
import net.minecraft.util.MathHelper;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.SpawnerAnimals;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.MapGenBase;
import net.minecraft.world.gen.MapGenCaves;
import net.minecraft.world.gen.MapGenRavine;
import net.minecraft.world.gen.NoiseGenerator;
import net.minecraft.world.gen.NoiseGeneratorOctaves;
import net.minecraft.world.gen.NoiseGeneratorPerlin;
import net.minecraft.world.gen.structure.MapGenMineshaft;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.terraingen.ChunkProviderEvent;
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
import net.minecraftforge.event.terraingen.TerrainGen;
import cpw.mods.fml.common.eventhandler.Event.Result;

public class MistWoodsChunkProvider implements IChunkProvider
{
    /**
     * RNG.
     */
    private Random rand;
    private NoiseGeneratorOctaves field_147431_j;
    private NoiseGeneratorOctaves field_147432_k;
    private NoiseGeneratorOctaves field_147429_l;
    private NoiseGeneratorPerlin field_147430_m;
    /**
     * A NoiseGeneratorOctaves used in generating terrain
     */
    public NoiseGeneratorOctaves noiseGen5;
    /**
     * A NoiseGeneratorOctaves used in generating terrain
     */
    public NoiseGeneratorOctaves noiseGen6;
    public NoiseGeneratorOctaves mobSpawnerNoise;
    /**
     * Reference to the World object.
     */
    private World worldObj;
    /**
     * are map structures going to be generated (e.g. strongholds)
     */
    private final boolean mapFeaturesEnabled;
    private WorldType field_147435_p;
    private final double[] field_147434_q;
    private final float[] parabolicField;
    private double[] stoneNoise = new double[256];
    private MapGenBase caveGenerator = new MapGenCaves();
    private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft();
private MapGenBase ravineGenerator = new MapGenRavine();
    /**
     * The biomes that are used to generate the chunk
     */
    private BiomeGenBase[] biomesForGeneration;
    double[] field_147427_d;
    double[] field_147428_e;
    double[] field_147425_f;
    double[] field_147426_g;
    int[][] field_73219_j = new int[32][32];

    {
        caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE);
        mineshaftGenerator = (MapGenMineshaft) TerrainGen.getModdedMapGen(mineshaftGenerator, MINESHAFT);
        ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, RAVINE);
    }    

    public MistWoodsChunkProvider(World par1World, long par2, boolean par4)
    {
        this.worldObj = par1World;
        this.mapFeaturesEnabled = par4;
        this.field_147435_p = par1World.getWorldInfo().getTerrainType();
        this.rand = new Random(par2);
        this.field_147431_j = new NoiseGeneratorOctaves(this.rand, 16);
        this.field_147432_k = new NoiseGeneratorOctaves(this.rand, 16);
        this.field_147429_l = new NoiseGeneratorOctaves(this.rand, ;
        this.field_147430_m = new NoiseGeneratorPerlin(this.rand, 4);
        this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, ;
        this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16);
        this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, ;
        this.field_147434_q = new double[825];
        this.parabolicField = new float[25];

        for (int j = -2; j <= 2; ++j)
        {
            for (int k = -2; k <= 2; ++k)
            {
                float f = 10.0F / MathHelper.sqrt_float((float)(j * j + k * k) + 0.2F);
                this.parabolicField[j + 2 + (k + 2) * 5] = f;
            }
        }

        NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, noiseGen5, noiseGen6, mobSpawnerNoise};
        noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.rand, noiseGens);
        this.field_147431_j = (NoiseGeneratorOctaves)noiseGens[0];
        this.field_147432_k = (NoiseGeneratorOctaves)noiseGens[1];
        this.field_147429_l = (NoiseGeneratorOctaves)noiseGens[2];
        this.field_147430_m = (NoiseGeneratorPerlin)noiseGens[3];
        this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4];
        this.noiseGen6 = (NoiseGeneratorOctaves)noiseGens[5];
        this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6];
    }

    public void generateTerrain(int par1, int par2, Block[] blocks)
    {
        byte b0 = 63;
        this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, par1 * 4 - 2, par2 * 4 - 2, 10, 10);
        this.func_147423_a(par1 * 4, 0, par2 * 4);

        for (int k = 0; k < 4; ++k)
        {
            int l = k * 5;
            int i1 = (k + 1) * 5;

            for (int j1 = 0; j1 < 4; ++j1)
            {
                int k1 = (l + j1) * 33;
                int l1 = (l + j1 + 1) * 33;
                int i2 = (i1 + j1) * 33;
                int j2 = (i1 + j1 + 1) * 33;

                for (int k2 = 0; k2 < 32; ++k2)
                {
                    double d0 = 0.125D;
                    double d1 = this.field_147434_q[k1 + k2];
                    double d2 = this.field_147434_q[l1 + k2];
                    double d3 = this.field_147434_q[i2 + k2];
                    double d4 = this.field_147434_q[j2 + k2];
                    double d5 = (this.field_147434_q[k1 + k2 + 1] - d1) * d0;
                    double d6 = (this.field_147434_q[l1 + k2 + 1] - d2) * d0;
                    double d7 = (this.field_147434_q[i2 + k2 + 1] - d3) * d0;
                    double d8 = (this.field_147434_q[j2 + k2 + 1] - d4) * d0;

                    for (int l2 = 0; l2 < 8; ++l2)
                    {
                        double d9 = 0.25D;
                        double d10 = d1;
                        double d11 = d2;
                        double d12 = (d3 - d1) * d9;
                        double d13 = (d4 - d2) * d9;

                        for (int i3 = 0; i3 < 4; ++i3)
                        {
                            int j3 = i3 + k * 4 << 12 | 0 + j1 * 4 << 8 | k2 * 8 + l2;
                            short short1 = 256;
                            j3 -= short1;
                            double d14 = 0.25D;
                            double d16 = (d11 - d10) * d14;
                            double d15 = d10 - d16;

                            for (int k3 = 0; k3 < 4; ++k3)
                            {
                            	if ((d15 += d16) > 0.0D)
							{
								blocks[j3 += short1] = Blocks.sandstone;
							}
							else if (k2 * 8 + l2 < b0)
							{
								blocks[j3 += short1] = Blocks.sandstone;
							}
							else
							{
								blocks[j3 += short1] = Blocks.air;
							}

                            }

                            d10 += d12;
                            d11 += d13;
                        }

                        d1 += d5;
                        d2 += d6;
                        d3 += d7;
                        d4 += d8;
                    }
                }
            }
        }
    }

    public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] p_147422_3_, byte[] p_147422_4_, BiomeGenBase[] p_147422_5_)
    {
        ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147422_1_, p_147422_2_, p_147422_3_, p_147422_5_);
        MinecraftForge.EVENT_BUS.post(event);
        if (event.getResult() == Result.DENY) return;

        double d0 = 0.03125D;
        this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_147422_1_ * 16), (double)(p_147422_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);

        for (int k = 0; k < 16; ++k)
        {
            for (int l = 0; l < 16; ++l)
            {
                BiomeGenBase biomegenbase = p_147422_5_[l + k * 16];
                biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_147422_3_, p_147422_4_, p_147422_1_ * 16 + k, p_147422_2_ * 16 + l, this.stoneNoise[l + k * 16]);
            }
        }
    }

    /**
     * loads or generates the chunk at the chunk location specified
     */
    public Chunk loadChunk(int par1, int par2)
    {
        return this.provideChunk(par1, par2);
    }

    /**
     * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
     * specified chunk from the map seed and chunk seed
     */
    public Chunk provideChunk(int par1, int par2)
    {
        this.rand.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);
        Block[] ablock = new Block[65536];
        byte[] abyte = new byte[65536];
        this.generateTerrain(par1, par2, ablock);
        this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16);
        this.replaceBlocksForBiome(par1, par2, ablock, abyte, this.biomesForGeneration);
        this.caveGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);
        this.ravineGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);

        if (this.mapFeaturesEnabled)
        {
            this.mineshaftGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);
        }

        Chunk chunk = new Chunk(this.worldObj, ablock, abyte, par1, par2);
        byte[] abyte1 = chunk.getBiomeArray();

        for (int k = 0; k < abyte1.length; ++k)
        {
            abyte1[k] = (byte)this.biomesForGeneration[k].biomeID;
        }

        chunk.generateSkylightMap();
        return chunk;
    }

    private void func_147423_a(int p_147423_1_, int p_147423_2_, int p_147423_3_)
    {
        this.field_147426_g = this.noiseGen6.generateNoiseOctaves(this.field_147426_g, p_147423_1_, p_147423_3_, 5, 5, 200.0D, 200.0D, 0.5D);
        this.field_147427_d = this.field_147429_l.generateNoiseOctaves(this.field_147427_d, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, 8.555150000000001D, 4.277575000000001D, 8.555150000000001D);
        this.field_147428_e = this.field_147431_j.generateNoiseOctaves(this.field_147428_e, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, 684.412D, 684.412D, 684.412D);
        this.field_147425_f = this.field_147432_k.generateNoiseOctaves(this.field_147425_f, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, 684.412D, 684.412D, 684.412D);
        int l = 0;
        int i1 = 0;

        for (int j1 = 0; j1 < 5; ++j1)
        {
            for (int k1 = 0; k1 < 5; ++k1)
            {
                float f = 0.0F;
                float f1 = 0.0F;
                float f2 = 0.0F;
                byte b0 = 2;
                BiomeGenBase biomegenbase = this.biomesForGeneration[j1 + 2 + (k1 + 2) * 10];

                for (int l1 = -b0; l1 <= b0; ++l1)
                {
                    for (int i2 = -b0; i2 <= b0; ++i2)
                    {
                        BiomeGenBase biomegenbase1 = this.biomesForGeneration[j1 + l1 + 2 + (k1 + i2 + 2) * 10];
                        float f3 = biomegenbase1.rootHeight;
                        float f4 = biomegenbase1.heightVariation;

                        if (this.field_147435_p == WorldType.AMPLIFIED && f3 > 0.0F)
                        {
                            f3 = 1.0F + f3 * 2.0F;
                            f4 = 1.0F + f4 * 4.0F;
                        }

                        float f5 = this.parabolicField[l1 + 2 + (i2 + 2) * 5] / (f3 + 2.0F);

                        if (biomegenbase1.rootHeight > biomegenbase.rootHeight)
                        {
                            f5 /= 2.0F;
                        }

                        f += f4 * f5;
                        f1 += f3 * f5;
                        f2 += f5;
                    }
                }

                f /= f2;
                f1 /= f2;
                f = f * 0.9F + 0.1F;
                f1 = (f1 * 4.0F - 1.0F) / 8.0F;
                double d13 = this.field_147426_g[i1] / 8000.0D;

                if (d13 < 0.0D)
                {
                    d13 = -d13 * 0.3D;
                }

                d13 = d13 * 3.0D - 2.0D;

                if (d13 < 0.0D)
                {
                    d13 /= 2.0D;

                    if (d13 < -1.0D)
                    {
                        d13 = -1.0D;
                    }

                    d13 /= 1.4D;
                    d13 /= 2.0D;
                }
                else
                {
                    if (d13 > 1.0D)
                    {
                        d13 = 1.0D;
                    }

                    d13 /= 8.0D;
                }

                ++i1;
                double d12 = (double)f1;
                double d14 = (double)f;
                d12 += d13 * 0.2D;
                d12 = d12 * 8.5D / 8.0D;
                double d5 = 8.5D + d12 * 4.0D;

                for (int j2 = 0; j2 < 33; ++j2)
                {
                    double d6 = ((double)j2 - d5) * 12.0D * 128.0D / 256.0D / d14;

                    if (d6 < 0.0D)
                    {
                        d6 *= 4.0D;
                    }

                    double d7 = this.field_147428_e[l] / 250.0D;
                    double d8 = this.field_147425_f[l] / 152.0D;
                    double d9 = (this.field_147427_d[l] / 10.0D + 1.0D) / 2.0D;
                    double d10 = MathHelper.denormalizeClamp(d7, d8, d9) - d6;

                    if (j2 > 29)
                    {
                        double d11 = (double)((float)(j2 - 29) / 3.0F);
                        d10 = d10 * (1.0D - d11) + -10.0D * d11;
                    }

                    this.field_147434_q[l] = d10;
                    ++l;
                }
            }
        }
    }

    /**
     * Checks to see if a chunk exists at x, y
     */
    public boolean chunkExists(int par1, int par2)
    {
        return true;
    }

    /**
     * Two modes of operation: if passed true, save all Chunks in one go.  If passed false, save up to two chunks.
     * Return true if all chunks have been saved.
     */
    public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate)
    {
        return true;
    }

    /**
     * Save extra data not associated with any Chunk.  Not saved during autosave, only during world unload.  Currently
     * unimplemented.
     */
    public void saveExtraData() {}

    /**
     * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.
     */
    public boolean unloadQueuedChunks()
    {
        return false;
    }

    /**
     * Returns if the IChunkProvider supports saving.
     */
    public boolean canSave()
    {
        return true;
    }

    /**
     * Converts the instance data to a readable string.
     */
    public String makeString()
    {
        return "RandomLevelSource";
    }

    /**
     * Returns a list of creatures of the specified type that can spawn at the given location.
     */
@SuppressWarnings("rawtypes")
public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4)
{
	BiomeGenBase var5 = this.worldObj.getBiomeGenForCoords(par2, par4);
	return var5.getSpawnableList(par1EnumCreatureType);
}

    public ChunkPosition func_147416_a(World p_147416_1_, String p_147416_2_, int p_147416_3_, int p_147416_4_, int p_147416_5_)
    {
    	return null;
    }

    public int getLoadedChunkCount()
    {
        return 0;
    }

    public void recreateStructures(int par1, int par2)
    {
        if (this.mapFeaturesEnabled)
        {
            this.mineshaftGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null);
        }
    }

@Override
public void populate(IChunkProvider p_73153_1_, int p_73153_2_,
		int p_73153_3_) {
	// TODO Auto-generated method stub

}
}

 

[spoiler=MistWoodsPortalBlock]

package com.multiverse.blocks;

import java.util.Random;

import com.multiverse.lib.Strings;
import com.multiverse.main.MainRegistry;

import net.minecraft.block.Block;
import net.minecraft.block.BlockPortal;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;

public class MistWoodsPortalBlock extends BlockPortal
{

@Override
public void registerBlockIcons(IIconRegister par1IconRegister)
{
	this.blockIcon = par1IconRegister.registerIcon(Strings.MODID + ":MistWoodsPortal");
}

@Override
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{

}

@Override
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
{
	if ((par5Entity.ridingEntity == null) && (par5Entity.riddenByEntity == null) && ((par5Entity instanceof EntityPlayerMP)))
	{
		EntityPlayerMP player = (EntityPlayerMP) par5Entity;

		MinecraftServer mServer = MinecraftServer.getServer();

		if (player.timeUntilPortal > 0)
		{
			player.timeUntilPortal = 10;
		}
		else if (player.dimension != MainRegistry.MistWoodsDimensionId)
		{
			player.timeUntilPortal = 10;

			player.mcServer.getConfigurationManager().transferPlayerToDimension(player, MainRegistry.MistWoodsDimensionId, new TeleporterMistWoods(mServer.worldServerForDimension(MainRegistry.MistWoodsDimensionId)));
		}
		else
		{
			player.timeUntilPortal = 10;
			player.mcServer.getConfigurationManager().transferPlayerToDimension(player, 0, new TeleporterMistWoods(mServer.worldServerForDimension(1)));
		}
	}
}

@Override
public boolean func_150000_e(World par1World, int par2, int par3, int par4)
{
	byte var5 = 0;
	byte var6 = 0;

	if (par1World.getBlock(par2 - 1, par3, par4) == Blocks.sandstone || par1World.getBlock(par2 + 1, par3, par4) == Blocks.sandstone)
	{
		var5 = 1;
	}

	if (par1World.getBlock(par2, par3, par4 - 1) == Blocks.sandstone || par1World.getBlock(par2, par3, par4 + 1) == Blocks.sandstone)
	{
		var6 = 1;
	}

	if (var5 == var6)
	{
		return false;
	}
	else
	{
		if (par1World.getBlock(par2 - var5, par3, par4 - var6) == Blocks.air)
		{
			par2 -= var5;
			par4 -= var6;
		}

		int var7;
		int var8;

		for (var7 = -1; var7 <= 2; ++var7)
		{
			for (var8 = -1; var8 <= 3; ++var8)
			{
				boolean var9 = var7 == -1 || var7 == 2 || var8 == -1 || var8 == 3;

				if (var7 != -1 && var7 != 2 || var8 != -1 && var8 != 3)
				{
					Block var10 = par1World.getBlock(par2 + var5 * var7, par3 + var8, par4 + var6 * var7);

					if (var9)
					{
						if (var10 != Blocks.sandstone)
						{
							return false;
						}
					}
					else if (var10 != Blocks.air && var10 != Blocks.fire)
					{
						return false;
					}
				}
			}
		}

		for (var7 = 0; var7 < 2; ++var7)
		{
			for (var8 = 0; var8 < 3; ++var8)
			{
				par1World.setBlock(par2 + var5 * var7, par3 + var8, par4 + var6 * var7, this, 0, 2);
			}
		}

		return true;
	}
}

@Override
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5)
{

}

@Override
public int quantityDropped(Random p_149745_1_)
{
	return 0;
}
}

 

[spoiler=BiomeGenSavannah]

package com.multiverse.dimensions;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;

public class BiomeGenSavannah extends BiomeGenBase
{
    public BiomeGenSavannah(int par1)
    {
        super(par1);
        this.spawnableCreatureList.clear();
        this.topBlock = Blocks.sand;
        this.fillerBlock = Blocks.sand;
        this.spawnableCreatureList.clear();
        this.spawnableMonsterList.clear();
        this.spawnableWaterCreatureList.clear();

        this.theBiomeDecorator.cactiPerChunk = 0;
        this.theBiomeDecorator.deadBushPerChunk = 3;
    }
    
    @Override
    public void genTerrainBlocks(World p_150573_1_, Random p_150573_2_, Block[] p_150573_3_, byte[] p_150573_4_, int p_150573_5_, int p_150573_6_, double p_150573_7_)
    {
        Block block = this.topBlock;
        byte b0 = (byte)(this.field_150604_aj & 255);
        Block block1 = this.fillerBlock;
        int k = -1;
        int l = (int)(p_150573_7_ / 3.0D + 3.0D + p_150573_2_.nextDouble() * 0.25D);
        int i1 = p_150573_5_ & 15;
        int j1 = p_150573_6_ & 15;
        int k1 = p_150573_3_.length / 256;

        for (int l1 = 255; l1 >= 0; --l1)
        {
            int i2 = (j1 * 16 + i1) * k1 + l1;

            if (l1 <= 0 + p_150573_2_.nextInt(5))
            {
                p_150573_3_[i2] = Blocks.bedrock;
            }
            else
            {
                Block block2 = p_150573_3_[i2];

                if (block2 != null && block2.getMaterial() != Material.air)
                {
                    if (block2 == Blocks.sandstone)
                    {
                        if (k == -1)
                        {
                            if (l <= 0)
                            {
                                block = null;
                                b0 = 0;
                                block1 = Blocks.stone;
                            }
                            else if (l1 >= 59 && l1 <= 64)
                            {
                                block = this.topBlock;
                                b0 = (byte)(this.field_150604_aj & 255);
                                block1 = this.fillerBlock;
                            }

                            if (l1 < 63 && (block == null || block.getMaterial() == Material.air))
                            {
                                if (this.getFloatTemperature(p_150573_5_, l1, p_150573_6_) < 0.15F)
                                {
                                    block = Blocks.ice;
                                    b0 = 0;
                                }
                                else
                                {
                                    block = Blocks.water;
                                    b0 = 0;
                                }
                            }

                            k = l;

                            if (l1 >= 62)
                            {
                                p_150573_3_[i2] = block;
                                p_150573_4_[i2] = b0;
                            }
                            else if (l1 < 56 - l)
                            {
                                block = null;
                                block1 = Blocks.stone;
                                p_150573_3_[i2] = Blocks.gravel;
                            }
                            else
                            {
                                p_150573_3_[i2] = block1;
                            }
                        }
                        else if (k > 0)
                        {
                            --k;
                            p_150573_3_[i2] = block1;

                            if (k == 0 && block1 == Blocks.sand)
                            {
                                k = p_150573_2_.nextInt(4) + Math.max(0, l1 - 63);
                                block1 = Blocks.sandstone;
                            }
                        }
                    }
                }
                else
                {
                    k = -1;
                }
            }
        }
    }
}

 

Link to comment
Share on other sites

Lighting a portal with vannila blocks can be hard as u can't edit the BlockFire class. But anyway, what u need to do is in the block class ur trying to light it with u need to add a method onBlockAdded (I think that's what it's called) and copy the code in it from BlockFire. Then change Blocks.portal into (BlockPortal)MainModClass.yourPortalBlock. I will provide some code in a bit cause I'm not on my computer.

Link to comment
Share on other sites

Lighting a portal with vannila blocks can be hard as u can't edit the BlockFire class. But anyway, what u need to do is in the block class ur trying to light it with u need to add a method onBlockAdded (I think that's what it's called) and copy the code in it from BlockFire. Then change Blocks.portal into (BlockPortal)MainModClass.yourPortalBlock. I will provide some code in a bit cause I'm not on my computer.

I was actually following an example on GitHub "Goblins and Giants", I ended up watching a video because I couldn't figure out how the portal activated and realized it was an item, so I looked at the name in the video and saw how it was done, so I created an item for it and it worked, this is the item's code:

 

package com.multiverse.items;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

import com.multiverse.blocks.MultiverseBlocks;
import com.multiverse.lib.Strings;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class MistWoodsPortalPlacer extends Item
{

public MistWoodsPortalPlacer(){
	super();
	this.setMaxStackSize(64);
}

@SideOnly(Side.CLIENT)
@Override
    public void registerIcons(IIconRegister par1IconRegister)
    {
        this.itemIcon = par1IconRegister.registerIcon(Strings.MODID + ":MistWoodsPortalPlacer");
    }

@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
	if(!par2World.isRemote)
	{
		par2World.setBlock((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ, Blocks.sandstone);
		par2World.setBlock((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ, Blocks.sandstone);
		par2World.setBlock((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ, Blocks.sandstone);
		par2World.setBlock((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ, Blocks.sandstone);
		par2World.setBlock((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ, Blocks.sandstone);
		par2World.setBlock((int) par3EntityPlayer.posX + 1, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ, Blocks.sandstone);
		par2World.setBlock((int) par3EntityPlayer.posX + 1, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ, Blocks.sandstone);
		par2World.setBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ, Blocks.sandstone);
		par2World.setBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ, Blocks.sandstone);
		par2World.setBlock((int) par3EntityPlayer.posX + 3, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ, Blocks.sandstone);
		par2World.setBlock((int) par3EntityPlayer.posX + 3, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ, Blocks.sandstone);
		par2World.setBlock((int) par3EntityPlayer.posX + 3, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ, Blocks.sandstone);
		par2World.setBlock((int) par3EntityPlayer.posX + 3, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ, Blocks.sandstone);
		par2World.setBlock((int) par3EntityPlayer.posX + 3, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ, Blocks.sandstone);

		par2World.setBlock((int) par3EntityPlayer.posX + 1, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ, MultiverseBlocks.MistWoodsPortalBlock);
		par2World.setBlock((int) par3EntityPlayer.posX + 1, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ, MultiverseBlocks.MistWoodsPortalBlock);
		par2World.setBlock((int) par3EntityPlayer.posX + 1, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ, MultiverseBlocks.MistWoodsPortalBlock);
		par2World.setBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ, MultiverseBlocks.MistWoodsPortalBlock);
		par2World.setBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ, MultiverseBlocks.MistWoodsPortalBlock);
		par2World.setBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ, MultiverseBlocks.MistWoodsPortalBlock);

		par1ItemStack.stackSize--;
	}

	return par1ItemStack;
    }
}

My only problem is the portal isn't spawning where the frame is built, but a block away from it, sometimes perpendicular to the portal. I'm guessing I have to look at the code that spawns the blocks. Thanks for helping me.

 

EDIT: Okay, so apparently the item spawns the portal, you don't need to build a frame.

 

EDIT: I don't like the way this item method, it's less controllable, so could you still post a code for a block that activates the portal. I tried making a block based off of flame block, adding the method you said, and making the changes, but it didn't activate the portal, so maybe I'm missing something.

 

Also my protal frame texture isn't loading, I have this in my portal block:

	@Override
public void registerBlockIcons(IIconRegister par1IconRegister)
{
	this.blockIcon = par1IconRegister.registerIcon(Strings.MODID + ":MistWoodsPortal");
}

and in my textures/blocks folder I have the texture image for it and a metadata file with the same name that has:

{
  "animation": {}
}

Link to comment
Share on other sites

Ah that's easy to fix!

In the items code you will see there is a lot of lines of code than determine the x, y, and z pos. read them carefully and change the y pos of all the blocks to where u want it :)

I tried that, but I wanted it to be in front of the player so I used this:

 

@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
	if(!par2World.isRemote)
	{
		if (par3EntityPlayer.cameraYaw > -45 && par3EntityPlayer.cameraYaw < 45){
			par2World.setBlock((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 1, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 1, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 3, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 3, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 3, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 3, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 3, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);

			par2World.setBlock((int) par3EntityPlayer.posX + 1, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ+2, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX + 1, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ+2, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX + 1, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ+2, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ+2, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ+2, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ+2, MultiverseBlocks.MistWoodsPortalBlock);
		}
		else if (par3EntityPlayer.cameraYaw > 145 && par3EntityPlayer.cameraYaw < -145){
			par2World.setBlock((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ-2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ-2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ-2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ-2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ-2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 1, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ-2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 1, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ-2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ-2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ-2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 3, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ-2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 3, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ-2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 3, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ-2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 3, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ-2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX + 3, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ-2, Blocks.sandstone);

			par2World.setBlock((int) par3EntityPlayer.posX + 1, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ-2, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX + 1, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ-2, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX + 1, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ-2, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ-2, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ-2, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ-2, MultiverseBlocks.MistWoodsPortalBlock);
		}
		else if (par3EntityPlayer.cameraYaw > -145 && par3EntityPlayer.cameraYaw < -45){
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ+1, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ+1, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ+3, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ+3, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ+3, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ+3, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ+3, Blocks.sandstone);

			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ+1, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ+1, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ+1, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ+2, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ+2, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX+2, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ+2, MultiverseBlocks.MistWoodsPortalBlock);
		}
		else if (par3EntityPlayer.cameraYaw > 45 && par3EntityPlayer.cameraYaw < 145){
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ+1, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ+1, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ+2, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ+3, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ+3, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ+3, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ+3, Blocks.sandstone);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY + 4, (int) par3EntityPlayer.posZ+3, Blocks.sandstone);

			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ+1, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ+1, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ+1, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY + 1, (int) par3EntityPlayer.posZ+2, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY + 2, (int) par3EntityPlayer.posZ+2, MultiverseBlocks.MistWoodsPortalBlock);
			par2World.setBlock((int) par3EntityPlayer.posX-2, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ+2, MultiverseBlocks.MistWoodsPortalBlock);
		}

		par1ItemStack.stackSize--;
	}

	return par1ItemStack;
    }

,but it'd always place the portal position for "if (par3EntityPlayer.cameraYaw > -45 && par3EntityPlayer.cameraYaw < 45)", even when my camera view was in other directions.

Wait... why not just using a PlayerInteractEvent, which is easier? You have everything you need in that event.

Making a new fire block is pointless, in my opinion..

How do you do this? I looked everyone on these forums, Github, and Google, and I don't see any examples of this. I have it set up with "MinecraftForge.EVENT_BUS.register(new MistPortalActivationHandler());" in my MainRegistry and in a new class I have:

"@SubscribeEvent
public void onPlayerInteractEvent(PlayerInteractEvent event){

}"

Link to comment
Share on other sites

event.x, event.y, and event.z are the coordinates of the block you interacted with. You obviously check if the block at those coords is a sandstone block. Note that the event fires even if you left click, so add a check for event.action aswell!

 

Then you need to check the item that the player is holding, and we have an event.entityPlayer. Finally, the side of the block the player has interacted with: event.face. 1 is the top face, so you should go with that.

 

At this point we checked if the player right clicked with a flint and steel in hand, on the top side of a sandstone block. Now you should set your portal blocks with event.world.setBlock. But be careful, because you also need to check for the shape of the portal around (and by that I also mean its orientation)

 

I won't provide any code for now, you have to try by yourself!

 

I try my best, so apologies if I said something obviously stupid!

Link to comment
Share on other sites

event.x, event.y, and event.z are the coordinates of the block you interacted with. You obviously check if the block at those coords is a sandstone block. Note that the event fires even if you left click, so add a check for event.action aswell!

 

Then you need to check the item that the player is holding, and we have an event.entityPlayer. Finally, the side of the block the player has interacted with: event.face. 1 is the top face, so you should go with that.

 

At this point we checked if the player right clicked with a flint and steel in hand, on the top side of a sandstone block. Now you should set your portal blocks with event.world.setBlock. But be careful, because you also need to check for the shape of the portal around (and by that I also mean its orientation)

 

I won't provide any code for now, you have to try by yourself!

That worked, thanks. I still have a problem with the portal texture showing as missing texture though, I'll repost what I have:

	@Override
public void registerBlockIcons(IIconRegister par1IconRegister)
{
	this.blockIcon = par1IconRegister.registerIcon(Strings.MODID + ":MistWoodsPortal");
}

I have the image texture and a mcmeta file with { "animation":{} }.

 

Also I have a problem with my portal block, I want to make it so the portal is destroyed when the frame is gone, if I remove this from my portal block:

	@Override
    public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
    {
    }

So the portal will be destroyed when the frame is broken, the portal doesn't spawn because onNeighborBlockChange detects portal blocks missing before all portal blocks can be placed. Could I use onBlockBroken, or is there a way around this?

Link to comment
Share on other sites

I just tried this, but it isn't working, I hit the frame in many different spots on the sides and it wont break (I haven't added the code for breaking top and bottom frame blocks and the code for a portal going in another direction, but I have two frames facing different directions and I tested them both):

package com.multiverse.blocks;

import net.minecraft.init.Blocks;
import net.minecraftforge.event.world.BlockEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class MistWoodsPortalFrameBreakHandler {

@SubscribeEvent
public void onBlockBroken(BlockEvent.BreakEvent event){
	if (event.block == Blocks.sandstone){
		for (int i=-2;i<0;i++){
			for (int j=-3;j==-3;j=0){
				if (event.world.getBlock(event.x+1+j, event.y+i, event.z) == MultiverseBlocks.MistWoodsPortalBlock &&
						event.world.getBlock(event.x+1+j, event.y+1+i, event.z) == MultiverseBlocks.MistWoodsPortalBlock &&
						event.world.getBlock(event.x+1+j, event.y+2+i, event.z) == MultiverseBlocks.MistWoodsPortalBlock &&
						event.world.getBlock(event.x+2+j, event.y+i, event.z) == MultiverseBlocks.MistWoodsPortalBlock &&
						event.world.getBlock(event.x+2+j, event.y+1+i, event.z) == MultiverseBlocks.MistWoodsPortalBlock &&
						event.world.getBlock(event.x+2+j, event.y+2+i, event.z) == MultiverseBlocks.MistWoodsPortalBlock){
					event.world.setBlock(event.x+1+j, event.y+i, event.z, Blocks.air);
					event.world.setBlock(event.x+1+j, event.y+1+i, event.z, Blocks.air);
					event.world.setBlock(event.x+1+j, event.y+2+i, event.z, Blocks.air);
					event.world.setBlock(event.x+2+j, event.y+i, event.z, Blocks.air);
					event.world.setBlock(event.x+2+j, event.y+1+i, event.z, Blocks.air);
					event.world.setBlock(event.x+2+j, event.y+2+i, event.z, Blocks.air);
				}
			}
		}
	}
}
}

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • i have kinda simillar stuff with mods.toml. every time launching my modpack these logs are typinbg off: - fastpaintings 1.20-1.2.7 |-- apoli 1.20.1-2.9.0.8 \-- calio 1.20.1-1.11.0.5 - playeranimator 1.0.2-rc1+1.20 - puzzleslib 8.1.20 - quad 1.2.5 - ramcompat 0.1.3 - rare_ice 0.0NONE - reignitedhud 1.1.0 - relics 0.6.5.1 - repurposed_structures 7.1.15+1.20.1-forge - resourcefulconfig 2.1.2 - resourcefullib 2.1.25 - rotten_flesh_to_leather 2.0.0 - rrls 4.0.6.1+mc1.20.1-forge - saturn 0.1.3 - sereneseasons 9.0.0.46 - silverbirch 1.1.1 - smoothboot 0.0.4 - snowundertrees 1.4.4 - spelunkery 1.20.1-0.3.5 - strictly_origins 1 - terrablender 3.0.1.7 - terralith 2.5.1 - travelersbackpack 9.1.14 - treechop 0.18.8 - trulytreasures 1.20-3.0.0 - vtweaks 4.0.13.fix1 - walkers 4.5.1 - walljump 1.20.1-1.1.6-forge - wizards_reborn 1.20.1-0.1.4 - yungsapi 1.20-Forge-4.0.5 - yungsbridges 1.20-Forge-4.0.3 - yungsextras 1.20-Forge-4.0.3 - yungsmenutweaks 1.20.1-Forge-1.0.2 [16���.2024 20:42:56.008] [main/INFO] [BadOptimizations/]: Loading config from C:\Users\{COMPUTER_USERNAME}\AppData\Roaming\com.modrinth.theseus\profiles\ExoRodemIII\config\badoptimizations.txt [16���.2024 20:42:56.009] [main/INFO] [BadOptimizations/]: Config version: 3 [16���.2024 20:42:56.010] [main/INFO] [BadOptimizations/]: BadOptimizations config dump: [16���.2024 20:42:56.011] [main/INFO] [BadOptimizations/]: enable_toast_optimizations: true [16���.2024 20:42:56.012] [main/INFO] [BadOptimizations/]: ignore_mod_incompatibilities: false [16���.2024 20:42:56.013] [main/INFO] [BadOptimizations/]: lightmap_time_change_needed_for_update: 80 [16���.2024 20:42:56.013] [main/INFO] [BadOptimizations/]: enable_lightmap_caching: true [16���.2024 20:42:56.013] [main/INFO] [BadOptimizations/]: enable_particle_manager_optimization: true [16���.2024 20:42:56.013] [main/INFO] [BadOptimizations/]: enable_entity_renderer_caching: true [16���.2024 20:42:56.014] [main/INFO] [BadOptimizations/]: log_config: true [16���.2024 20:42:56.014] [main/INFO] [BadOptimizations/]: enable_remove_redundant_fov_calculations: true [16���.2024 20:42:56.014] [main/INFO] [BadOptimizations/]: config_version: 3 [16���.2024 20:42:56.014] [main/INFO] [BadOptimizations/]: enable_sky_angle_caching_in_worldrenderer: true [16���.2024 20:42:56.014] [main/INFO] [BadOptimizations/]: enable_block_entity_renderer_caching: true [16���.2024 20:42:56.014] [main/INFO] [BadOptimizations/]: skycolor_time_change_needed_for_update: 3 [16���.2024 20:42:56.014] [main/INFO] [BadOptimizations/]: enable_entity_flag_caching: true [16���.2024 20:42:56.014] [main/INFO] [BadOptimizations/]: enable_debug_renderer_disable_if_not_needed: true [16���.2024 20:42:56.014] [main/INFO] [BadOptimizations/]: enable_sky_color_caching: true [16���.2024 20:42:56.014] [main/INFO] [BadOptimizations/]: enable_remove_tutorial_if_not_demo: true [16���.2024 20:42:56.014] [main/INFO] [BadOptimizations/]: show_f3_text: true [16���.2024 20:42:57.417] [main/WARN] [mixin/]: Error loading class: dev/emi/emi/screen/EmiScreenManager (java.lang.ClassNotFoundException: dev.emi.emi.screen.EmiScreenManager) [16���.2024 20:42:57.422] [main/WARN] [mixin/]: Error loading class: me/shedaniel/rei/impl/client/gui/ScreenOverlayImpl (java.lang.ClassNotFoundException: me.shedaniel.rei.impl.client.gui.ScreenOverlayImpl) [16���.2024 20:42:58.657] [main/WARN] [mixin/]: Error loading class: vazkii/quark/base/module/ModuleFinder (java.lang.ClassNotFoundException: vazkii.quark.base.module.ModuleFinder) [16���.2024 20:42:58.942] [main/INFO] [fpsreducer/]: bre2el.fpsreducer.mixin.RenderSystemMixin will be applied. [16���.2024 20:42:58.943] [main/INFO] [fpsreducer/]: bre2el.fpsreducer.mixin.WindowMixin will be applied. [16���.2024 20:42:59.109] [main/WARN] [mixin/]: Error loading class: com/illusivesoulworks/colytra/client/ColytraLayer (java.lang.ClassNotFoundException: com.illusivesoulworks.colytra.client.ColytraLayer) [16���.2024 20:42:59.119] [main/WARN] [mixin/]: Error loading class: com/illusivesoulworks/elytraslot/client/ElytraSlotLayer (java.lang.ClassNotFoundException: com.illusivesoulworks.elytraslot.client.ElytraSlotLayer) [16���.2024 20:43:01.569] [main/INFO] [memoryleakfix/]: [MemoryLeakFix] Will be applying 3 memory leak fixes! [16���.2024 20:43:01.569] [main/INFO] [memoryleakfix/]: [MemoryLeakFix] Currently enabled memory leak fixes: [targetEntityLeak, biomeTemperatureLeak, hugeScreenshotLeak] [16���.2024 20:43:02.459] [main/INFO] [MixinExtras|Service/]: Initializing MixinExtras via com.llamalad7.mixinextras.service.MixinExtrasServiceImpl(version=0.3.6). [16���.2024 20:43:03.003] [main/WARN] [mixin/]: Injection warning: LVT in net/minecraft/client/gui/GuiGraphics::m_280497_(Lnet/minecraft/client/gui/Font;Ljava/util/List;IILnet/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipPositioner;)V has incompatible changes at opcode 346 in callback relics.mixins.json:GuiGraphicsMixin->@Inject::onTooltipRender(Lnet/minecraft/client/gui/Font;Ljava/util/List;IILnet/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipPositioner;Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfo;Lnet/minecraftforge/client/event/RenderTooltipEvent$Pre;IIIILorg/joml/Vector2ic;)V. Expected: [Lnet/minecraftforge/client/event/RenderTooltipEvent$Pre;, I, I, I, I, Lorg/joml/Vector2ic;] Found: [Ljava/lang/Object;, I, I, I, I, Lorg/joml/Vector2ic;] Available: [Ljava/lang/Object;, I, I, I, I, Lorg/joml/Vector2ic;, I, I, I, Lnet/minecraft/client/gui/Font;, I, I, Lnet/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent;] [16���.2024 20:43:03.735] [main/INFO] [Smooth Boot (Reloaded)/]: Smooth Boot (Reloaded) config initialized [16���.2024 20:43:05.500] [main/WARN] [mixin/]: Static binding violation: PRIVATE @Overwrite method m_172993_ in embeddium.mixins.json:core.render.world.WorldRendererMixin cannot reduce visibiliy of PUBLIC target method, visibility will be upgraded. [16���.2024 20:43:05.500] [main/WARN] [mixin/]: Static binding violation: PRIVATE @Overwrite method m_109501_ in embeddium.mixins.json:core.render.world.WorldRendererMixin cannot reduce visibiliy of PUBLIC target method, visibility will be upgraded. [16���.2024 20:43:05.571] [main/WARN] [mixin/]: @Redirect conflict. Skipping forge-badoptimizations.mixins.json:MixinWorldRenderer->@Redirect::getSkyAngle(Lnet/minecraft/client/multiplayer/ClientLevel;F)F with priority 700, already redirected by citadel.mixins.json:client.LevelRendererMixin->@Redirect::citadel_getTimeOfDay(Lnet/minecraft/client/multiplayer/ClientLevel;F)F with priority 1000   i feel very stupid, but, can someone help me? i would really appreciatte that
    • Hello, I just finished my first mod for MC for 1.19.2, I've used: IntelliJ 2024.1.3 Forge MDK 43.3.13 SDK 17.0.11 (eclipse Temurin) Basically, my mod plays scary music at night time, stopping any music played by the game. For that I needed to access via reflection to a private MusicManager.class attribute (SoundInstance currentMusic), and the management of this is giving me errors (I think). Here's the full stacktrace: ---- Minecraft Crash Report ---- // There are four lights! Time: 2024-06-16 20:29:25 Description: Ticking entity java.lang.NoSuchMethodError: 'net.minecraft.client.Minecraft net.minecraft.client.Minecraft.m_91087_()' at com.miorg.scarysounds.SoundHandler.onWorldTick(SoundHandler.java:64) ~[scarysounds-1.0.0.jar%23188!/:1.0.0] {re:classloading} at com.miorg.scarysounds.__SoundHandler_onWorldTick_PlayerTickEvent.invoke(.dynamic) ~[scarysounds-1.0.0.jar%23188!/:1.0.0] {re:classloading,pl:eventbus:B} at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.3.jar%23113!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.3.jar%23113!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.3.jar%23113!/:?] {} at net.minecraftforge.event.ForgeEventFactory.onPlayerPreTick(ForgeEventFactory.java:814) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23189%23197!/:?] {re:classloading} at net.minecraft.world.entity.player.Player.tick(Player.java:216) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.client.player.LocalPlayer.tick(LocalPlayer.java:200) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.multiplayer.ClientLevel.tickNonPassenger(ClientLevel.java:269) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.world.level.Level.guardEntityTick(Level.java:457) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.client.multiplayer.ClientLevel.lambda$tickEntities$4(ClientLevel.java:251) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.world.level.entity.EntityTickList.forEach(EntityTickList.java:54) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading} at net.minecraft.client.multiplayer.ClientLevel.tickEntities(ClientLevel.java:249) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.tick(Minecraft.java:1791) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runTick(Minecraft.java:1078) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:700) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.run(Main.java:212) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:51) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {} at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:25) ~[fmlloader-1.19.2-43.3.13.jar%23101!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:108) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Suspected Mod: ScarySounds (scarysounds), Version: 1.0.0 at TRANSFORMER/[email protected]/com.miorg.scarysounds.SoundHandler.onWorldTick(SoundHandler.java:64) Stacktrace: at com.miorg.scarysounds.SoundHandler.onWorldTick(SoundHandler.java:64) ~[scarysounds-1.0.0.jar%23188!/:1.0.0] {re:classloading} at com.miorg.scarysounds.__SoundHandler_onWorldTick_PlayerTickEvent.invoke(.dynamic) ~[scarysounds-1.0.0.jar%23188!/:1.0.0] {re:classloading,pl:eventbus:B} at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.3.jar%23113!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.3.jar%23113!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.3.jar%23113!/:?] {} at net.minecraftforge.event.ForgeEventFactory.onPlayerPreTick(ForgeEventFactory.java:814) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23189%23197!/:?] {re:classloading} at net.minecraft.world.entity.player.Player.tick(Player.java:216) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.client.player.LocalPlayer.tick(LocalPlayer.java:200) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.multiplayer.ClientLevel.tickNonPassenger(ClientLevel.java:269) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.world.level.Level.guardEntityTick(Level.java:457) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.client.multiplayer.ClientLevel.lambda$tickEntities$4(ClientLevel.java:251) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.world.level.entity.EntityTickList.forEach(EntityTickList.java:54) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading} at net.minecraft.client.multiplayer.ClientLevel.tickEntities(ClientLevel.java:249) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:runtimedistcleaner:A} -- Entity being ticked -- Details: Entity Type: minecraft:player (net.minecraft.client.player.LocalPlayer) Entity ID: 227 Entity Name: Dev Entity's Exact location: -55.87, 119.00, -7.99 Entity's Block location: World: (-56,119,-8), Section: (at 8,7,8 in -4,7,-1; chunk contains blocks -64,-64,-16 to -49,319,-1), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,-64,-512 to -1,319,-1) Entity's Momentum: 0.00, 0.00, 0.00 Entity's Passengers: [] Entity's Vehicle: null Stacktrace: at net.minecraft.world.level.Level.guardEntityTick(Level.java:457) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.client.multiplayer.ClientLevel.lambda$tickEntities$4(ClientLevel.java:251) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.world.level.entity.EntityTickList.forEach(EntityTickList.java:54) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading} at net.minecraft.client.multiplayer.ClientLevel.tickEntities(ClientLevel.java:249) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.tick(Minecraft.java:1791) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runTick(Minecraft.java:1078) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:700) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.run(Main.java:212) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:51) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {} at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:25) ~[fmlloader-1.19.2-43.3.13.jar%23101!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:108) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {} -- Affected level -- Details: All players: 1 total; [LocalPlayer['Dev'/227, l='ClientLevel', x=-55.87, y=119.00, z=-7.99]] Chunk stats: 961, 400 Level dimension: minecraft:overworld Level spawn location: World: (0,106,0), Section: (at 0,10,0 in 0,6,0; chunk contains blocks 0,-64,0 to 15,319,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,-64,0 to 511,319,511) Level time: 6100 game time, 14340 day time Server brand: forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.ClientLevel.fillReportDetails(ClientLevel.java:450) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.fillReport(Minecraft.java:2280) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:717) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.run(Main.java:212) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:51) ~[forge-1.19.2-43.3.13_mapped_official_1.19.2.jar%23190!/:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {} at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:25) ~[fmlloader-1.19.2-43.3.13.jar%23101!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:108) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.9.jar%23114!/:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {} -- Last reload -- Details: Reload number: 1 Reload reason: initial Finished: Yes Packs: Default, Mod Resources -- System Details -- Details: Minecraft Version: 1.19.2 Minecraft Version ID: 1.19.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 17.0.11, Eclipse Adoptium Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Eclipse Adoptium Memory: 1080430488 bytes (1030 MiB) / 2302672896 bytes (2196 MiB) up to 4208984064 bytes (4014 MiB) CPUs: 12 Processor Vendor: GenuineIntel Processor Name: 12th Gen Intel(R) Core(TM) i5-12450H Identifier: Intel64 Family 6 Model 154 Stepping 3 Microarchitecture: unknown Frequency (GHz): 2.50 Number of physical packages: 1 Number of physical CPUs: 8 Number of logical CPUs: 12 Graphics card #0 name: NVIDIA GeForce RTX 3050 Laptop GPU Graphics card #0 vendor: NVIDIA (0x10de) Graphics card #0 VRAM (MB): 4095.00 Graphics card #0 deviceId: 0x25a2 Graphics card #0 versionInfo: DriverVersion=31.0.15.4680 Graphics card #1 name: Intel(R) UHD Graphics Graphics card #1 vendor: Intel Corporation (0x8086) Graphics card #1 VRAM (MB): 128.00 Graphics card #1 deviceId: 0x46a3 Graphics card #1 versionInfo: DriverVersion=31.0.101.5186 Memory slot #0 capacity (MB): 8192.00 Memory slot #0 clockSpeed (GHz): 3.20 Memory slot #0 type: DDR4 Memory slot #1 capacity (MB): 8192.00 Memory slot #1 clockSpeed (GHz): 3.20 Memory slot #1 type: DDR4 Virtual memory max (MB): 19530.51 Virtual memory used (MB): 17390.07 Swap memory total (MB): 3478.36 Swap memory used (MB): 253.88 JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump Launched Version: MOD_DEV Backend library: LWJGL version 3.3.1 build 7 Backend API: Intel(R) UHD Graphics GL version 3.2.0 - Build 31.0.101.5186, Intel Window size: 854x480 GL Caps: Using framebuffer using OpenGL 3.2 GL debug messages: Using VBOs: Yes Is Modded: Definitely; Client brand changed to 'forge'; Server brand changed to 'forge' Type: Integrated Server (map_client.txt) Graphics mode: fancy Resource Packs: Current Language: English (US) CPU: 12x 12th Gen Intel(R) Core(TM) i5-12450H Server Running: true Player Count: 1 / 8; [ServerPlayer['Dev'/227, l='ServerLevel[New World]', x=-55.87, y=119.00, z=-7.99]] Data Packs: vanilla, mod:scarysounds, mod:forge World Generation: Stable ModLauncher: 10.0.9+10.0.9+main.dcd20f30 ModLauncher launch target: forgeclientuserdev ModLauncher naming: mcp ModLauncher services: mixin-0.8.5.jar mixin PLUGINSERVICE eventbus-6.0.3.jar eventbus PLUGINSERVICE fmlloader-1.19.2-43.3.13.jar slf4jfixer PLUGINSERVICE fmlloader-1.19.2-43.3.13.jar object_holder_definalize PLUGINSERVICE fmlloader-1.19.2-43.3.13.jar runtime_enum_extender PLUGINSERVICE fmlloader-1.19.2-43.3.13.jar capability_token_subclass PLUGINSERVICE accesstransformers-8.0.4.jar accesstransformer PLUGINSERVICE fmlloader-1.19.2-43.3.13.jar runtimedistcleaner PLUGINSERVICE modlauncher-10.0.9.jar mixin TRANSFORMATIONSERVICE modlauncher-10.0.9.jar fml TRANSFORMATIONSERVICE FML Language Providers: [email protected] lowcodefml@null javafml@null Mod List: forge-1.19.2-43.3.13_mapped_official_1.19.2.jar |Minecraft |minecraft |1.19.2 |DONE |Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f scarysounds-1.0.0.jar |ScarySounds |scarysounds |1.0.0 |DONE |Manifest: NOSIGNATURE |Forge |forge |43.3.13 |DONE |Manifest: NOSIGNATURE Crash Report UUID: dc1c47a9-be1f-45b8-b70f-eab49d54148b FML: 43.3 Forge: net.minecraftforge:43.3.13   Here's my code, the most important lines are at the start of the class and the start of onWorldTick(). These lines manage the private attribute (currentMusic) and the exception fires at line 64: MusicManager musicManager = Minecraft.getInstance().getMusicManager(); Anybody knows what is happening????? I've spent 2 days trying to find a solution and I can't get it  Really appreciate your time package com.miorg.scarysounds; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.sounds.SoundInstance; import net.minecraft.client.sounds.MusicManager; import net.minecraft.client.sounds.SoundManager; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.Music; import net.minecraft.sounds.Musics; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; import net.minecraft.util.profiling.jfr.event.WorldLoadFinishedEvent; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraftforge.client.ClientCommandHandler; import net.minecraft.world.level.Level; import net.minecraft.core.BlockPos; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.event.TickEvent; import net.minecraftforge.event.entity.EntityJoinLevelEvent; import net.minecraftforge.event.level.LevelEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.util.ObfuscationReflectionHelper; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.util.Random; @Mod.EventBusSubscriber(modid = "scarysounds", value = Dist.CLIENT) public class SoundHandler { private static Field currentMusicField; static { try { currentMusicField = MusicManager.class.getDeclaredField("currentMusic"); currentMusicField.setAccessible(true); } catch (NoSuchFieldException e) { e.printStackTrace(); } } private static final Random random = new Random(); static int ticksUntilNextSound = 0; static int ticksRestantes = 0; static int espera; static boolean flag = false; static boolean flagLoad = false; static String soundName; private static final String[] SOUND_NAMES = { "sound1", "sound2", "sound3", "sound4", "sound5", "sound6", "sound7", "sound8", "sound9", "sound10", "sound11", "sound12", "sound13", "sound14", "sound15" }; @SubscribeEvent public static void onWorldLoad(LevelEvent.Load event) { ticksUntilNextSound = getRandomTicks(); flagLoad = true; } @SubscribeEvent public static void onWorldTick(TickEvent.PlayerTickEvent event) throws InterruptedException { if (flagLoad) { try { MusicManager musicManager = Minecraft.getInstance().getMusicManager(); Object currentMusic = currentMusicField.get(musicManager); Level world = (Level) event.player.level; BlockPos playerPos = event.player.blockPosition(); //Coordenadas del jugador if (!world.isClientSide && event.phase == TickEvent.Phase.END) { long dayTime = world.getDayTime() % 24000L; if ((dayTime >= 13000L && dayTime <= 23000L) && !flag) { // De noche if (ticksUntilNextSound > 0) { ticksUntilNextSound--; if (ticksUntilNextSound == 75) Minecraft.getInstance().getMusicManager().stopPlaying(); if (ticksUntilNextSound == 110) { if (currentMusic != null) { event.player.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 200, 4, true, true)); event.player.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 10, true, true)); event.player.addEffect(new MobEffectInstance(MobEffects.DARKNESS, 200, 10, true, true)); world.playSound(null, playerPos, ScarySounds.FX.get(), SoundSource.MUSIC, 1.0F, 1.0F); } } System.out.println(ticksUntilNextSound); } else { soundName = SOUND_NAMES[random.nextInt(SOUND_NAMES.length)]; ResourceLocation resourceLocation = new ResourceLocation("scarysounds", soundName); SoundEvent soundEvent = ForgeRegistries.SOUND_EVENTS.getValue(resourceLocation); switch (soundName) { case "sound1": { soundEvent = ScarySounds.SOUND1.get(); espera = 112; break; } case "sound2": { soundEvent = ScarySounds.SOUND2.get(); espera = 164; break; } case "sound3": { soundEvent = ScarySounds.SOUND3.get(); espera = 70; break; } case "sound4": { soundEvent = ScarySounds.SOUND4.get(); espera = 184; break; } case "sound5": { soundEvent = ScarySounds.SOUND5.get(); espera = 135; break; } case "sound6": { soundEvent = ScarySounds.SOUND6.get(); espera = 255; break; } case "sound7": { soundEvent = ScarySounds.SOUND7.get(); espera = 151; break; } case "sound8": { soundEvent = ScarySounds.SOUND8.get(); espera = 107; break; } case "sound9": { soundEvent = ScarySounds.SOUND9.get(); espera = 304; break; } case "sound10": { soundEvent = ScarySounds.SOUND10.get(); espera = 48; break; } case "sound11": { soundEvent = ScarySounds.SOUND11.get(); espera = 181; break; } case "sound12": { soundEvent = ScarySounds.SOUND12.get(); espera = 11; break; } case "sound13": { soundEvent = ScarySounds.SOUND13.get(); espera = 216; break; } case "sound14": { soundEvent = ScarySounds.SOUND14.get(); espera = 52; break; } case "sound15": { soundEvent = ScarySounds.SOUND15.get(); espera = 120; break; } } if (soundEvent != null) { ticksRestantes = espera * 20; world.playSound(null, playerPos, soundEvent, SoundSource.MUSIC, 1.0F, 1.0F); flag = true; } else { System.out.println("SoundEvent es nulo para: " + resourceLocation); } } } else { if (ticksRestantes > 0) { ticksRestantes--; Minecraft.getInstance().getMusicManager().stopPlaying(); System.out.println("Ticks restantes: " + ticksRestantes); } else { flag = false; ticksUntilNextSound = getRandomTicks(); } } } } catch (IllegalAccessException e) { e.printStackTrace(); } } } static int getRandomTicks() { return 500 + random.nextInt(1500); } }  
  • Topics

×
×
  • Create New...

Important Information

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