Jump to content

[1.7.2][Solved]Getting all items and checking if player is in void?


Recommended Posts

Posted

How would I get all items "alive?" I need to check if there are items in the void, then get item info and do stuff with it, but I do not know how to get all EntityItems in the world. I tried this code, but it did not work:

TickListner(Method 1):

 

 

@SubscribeEvent

public void itemDrop(ItemTossEvent e) {

System.out.println("Item Dropped");

if (e.entityItem.dimension == VoidMod.NullVoidDimID) {

System.out.println("In Void");

this.itemDropped = e.entityItem;

System.out.println(itemDropped);

}

}

 

 

TickListner(Method 2):

 

 

@SubscribeEvent

public void onTick(TickEvent.ServerTickEvent event) {

// System.out.println("OnTick");

String[] pls = MinecraftServer.getServer().getConfigurationManager()

.getAllUsernames();

EntityPlayerMP p;

for (int i = 0; i < pls.length; i++) {

p = MinecraftServer.getServer().getConfigurationManager()

.getPlayerForUsername(pls);

if (p != null) {

// System.out.println("Got a ticked player");

if (p.posY <= 0) {

// System.out.println("In the void!");

if (p.dimension == VoidMod.NullVoidDimID) {

p.setLocationAndAngles(p.posX, 256, p.posZ,

p.cameraYaw, p.cameraPitch);

}

p.addStat(VoidMod.fallVoid, 1);

}

if (p.dimension == VoidMod.NullVoidDimID) {

p.clearActivePotions();

}

}

}

World w;

Double x;

Double z;

System.out.println(itemDropped);

if (itemDropped != null) {

System.out.println("Not Null");

if (itemDropped.posY <= 0) {

System.out.println("In Void");

if (itemDropped.getEntityItem().getItem()

.equals(VoidMod.nullVoidAlloy)) {

System.out.println("Is Alloy");

w = itemDropped.worldObj;

x = itemDropped.posX;

z = itemDropped.posZ;

itemDropped.setDead();

itemDropped = null;

w.spawnEntityInWorld(new EntityItem(w, x, 200D, z,

new ItemStack(VoidMod.corruptAlloy)));

}

}

}

 

// WorldProviderNullVoid.getProviderForDimension(VoidMod.NullVoidDimID).setWorldTime(13000);

}

 

 

I am also having trouble with checking if the player has fallen into the void, it is the same code(In method 2) It is giving me the achievement but not teleporting me.

Posted

  if (e.entityItem.dimension == VoidMod.NullVoidDimID)

 

Why are you checking the dimension? The item you need would be in the world where it created...

and you have to edit the teleporting code if you want to teleport the player.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

First how are you getting sent to your dimension.

Second

 p = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(pls);

should be

         p = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(pls[i]);

.

Third

 if (itemDropped.getEntityItem().getItem().equals(VoidMod.nullVoidAlloy))

should be

 if (itemDropped.getEntityItem().getItem() instanceof ItemNullVoidAlloy))

Posted

I do not know why in the code I posted it says str, in my actual code it says str. Also, I have found that equals works in another case. My problem is that it is not recognizing it is in the void. Also I have a block that teleports you into my dimension, but my code is not able to recognize any item past y level 0, which is what I want to do.

Code:

TickListner:

 

 

package aj.Java.Nullvoid.Listners;

 

import java.awt.Color;

import java.util.List;

import java.util.Random;

 

import aj.Java.Nullvoid.VoidMod;

import baubles.api.BaublesApi;

import net.minecraft.client.Minecraft;

import net.minecraft.entity.item.EntityItem;

import net.minecraft.entity.player.EntityPlayerMP;

import net.minecraft.item.ItemStack;

import net.minecraft.potion.Potion;

import net.minecraft.potion.PotionEffect;

import net.minecraft.server.MinecraftServer;

import net.minecraft.world.World;

import net.minecraftforge.client.event.RenderGameOverlayEvent;

import net.minecraftforge.client.event.TextureStitchEvent;

import net.minecraftforge.event.entity.item.ItemTossEvent;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;

import cpw.mods.fml.common.gameevent.TickEvent;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class TickListner {

private World world;

@SubscribeEvent

public void onTick(TickEvent.ServerTickEvent event) {

// System.out.println("OnTick");

String[] pls = MinecraftServer.getServer().getConfigurationManager()

.getAllUsernames();

EntityPlayerMP p;

for (int i = 0; i < pls.length; i++) {

p = MinecraftServer.getServer().getConfigurationManager()

.getPlayerForUsername(pls);

if (p != null) {

// System.out.println("Got a ticked player");

if (p.posY <= 0) {

// System.out.println("In the void!");

if (p.dimension == VoidMod.NullVoidDimID) {

p.setLocationAndAngles(p.posX, 256, p.posZ,

p.cameraYaw, p.cameraPitch);

}

p.addStat(VoidMod.fallVoid, 1);

}

if (p.dimension == VoidMod.NullVoidDimID) {

if(p.inventory.getCurrentItem() == null){

p.clearActivePotions();

}

else{

if(!p.inventory.getCurrentItem().getItem().equals(VoidMod.baneOfDark)){

p.clearActivePotions();

}

else{

p.addPotionEffect(new PotionEffect(Potion.nightVision.id, 140, 10));

}

}

}

}

}

if(world != null){

@SuppressWarnings("rawtypes")

List l = world.loadedEntityList;

for(int i = 0; i < l.size(); i++){

if(l.get(i) != null){

if(l.get(i) instanceof EntityItem){

System.out.println("Not Null");

EntityItem item = (EntityItem)l.get(i);

if (item.posY <= 0) {

System.out.println("In Void");

if (item.getEntityItem().getItem()

.equals(VoidMod.nullVoidAlloy)) {

System.out.println("Is Alloy");

world.spawnEntityInWorld(new EntityItem(world, item.posX, 200D, item.posZ,

new ItemStack(VoidMod.corruptAlloy)));

}

}

}

}

}

}

 

// WorldProviderNullVoid.getProviderForDimension(VoidMod.NullVoidDimID).setWorldTime(13000);

}

 

@SubscribeEvent

@SideOnly(Side.CLIENT)

public void clientTick(TickEvent.ClientTickEvent event) {

if (Minecraft.getMinecraft().thePlayer != null) {

if (Minecraft.getMinecraft().thePlayer.dimension == VoidMod.NullVoidDimID) {

if(Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem() != null){

if(Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem().getItem().equals(VoidMod.baneOfDark)){

Minecraft.getMinecraft().gameSettings.gammaSetting = 1F;

}

else{

Minecraft.getMinecraft().gameSettings.gammaSetting = -1F;

}

}

else{

Minecraft.getMinecraft().gameSettings.gammaSetting = -1F;

}

} else {

if (Minecraft.getMinecraft().gameSettings.gammaSetting == -1F) {

Minecraft.getMinecraft().gameSettings.gammaSetting = Minecraft

.getMinecraft().thePlayer.getEntityData().getFloat(

"NullGamma");

}

}

}

}

 

@SideOnly(Side.CLIENT)

@SubscribeEvent

public void texturePreStitch(TextureStitchEvent.Pre event) {

if (event.map.getTextureType() == 0) {

event.map.setTextureEntry("nullvoid:nullOre", VoidMod.texNullOre);

}

}

 

@SideOnly(Side.CLIENT)

@SubscribeEvent

public void renderGlitch(RenderGameOverlayEvent event) {

if (VoidMod.glitchAmulet != null

&& Minecraft.getMinecraft().thePlayer != null) {

if (BaublesApi.getBaubles(Minecraft.getMinecraft().thePlayer)

.getStackInSlot(0) != null) {

if (!BaublesApi.getBaubles(Minecraft.getMinecraft().thePlayer)

.getStackInSlot(0)

.isItemEqual(new ItemStack(VoidMod.glitchAmulet))) {

glitch();

}

} else {

glitch();

}

}

}

 

@SubscribeEvent

public void crafted(ItemCraftedEvent event) {

if (event.crafting.getItem().equals(VoidMod.nullGoggles)) {

event.player.addStat(VoidMod.craftGoggle, 1);

}

}

 

@SubscribeEvent

public void itemDrop(ItemTossEvent e) {

System.out.println("Item Dropped");

if (e.entityItem.dimension == VoidMod.NullVoidDimID) {

System.out.println("In Void");

this.world = e.entityItem.worldObj;

}

}

 

private String getLetter() {

switch (new Random().nextInt(26)) {

case 0:

return "A";

case 1:

return "B";

case 2:

return "C";

case 3:

return "D";

case 4:

return "E";

case 5:

return "F";

case 6:

return "G";

case 7:

return "H";

case 8:

return "I";

case 9:

return "J";

case 10:

return "K";

case 11:

return "L";

case 12:

return "M";

case 13:

return "N";

case 14:

return "O";

case 15:

return "P";

case 16:

return "Q";

case 17:

return "R";

case 18:

return "S";

case 19:

return "T";

case 20:

return "U";

case 21:

return "V";

case 22:

return "W";

case 23:

return "X";

case 24:

return "Y";

case 25:

return "Z";

}

return null;

}

 

private void glitch() {

if (Minecraft.getMinecraft().thePlayer.dimension == VoidMod.NullVoidDimID) {

if (Minecraft.getMinecraft().thePlayer.posX < 10

&& Minecraft.getMinecraft().thePlayer.posX > -10

&& Minecraft.getMinecraft().thePlayer.posZ < 10

&& Minecraft.getMinecraft().thePlayer.posZ > -10) {

for (int i = 0; i < 10000; i++) {

Minecraft.getMinecraft().fontRenderer

.drawString(getLetter(),

new Random().nextInt(Minecraft

.getMinecraft().displayWidth),

new Random().nextInt(Minecraft

.getMinecraft().displayWidth),

new Color(new Random().nextFloat(),

new Random().nextFloat(),

new Random().nextFloat()).getRGB());

}

} else if (Minecraft.getMinecraft().thePlayer.posX < 50

&& Minecraft.getMinecraft().thePlayer.posX > -50

&& Minecraft.getMinecraft().thePlayer.posZ < 50

&& Minecraft.getMinecraft().thePlayer.posZ > -50) {

for (int i = 0; i < 1000; i++) {

Minecraft.getMinecraft().fontRenderer

.drawString(getLetter(),

new Random().nextInt(Minecraft

.getMinecraft().displayWidth),

new Random().nextInt(Minecraft

.getMinecraft().displayWidth),

new Color(new Random().nextFloat(),

new Random().nextFloat(),

new Random().nextFloat()).getRGB());

}

} else if (Minecraft.getMinecraft().thePlayer.posX < 100

&& Minecraft.getMinecraft().thePlayer.posX > -100

&& Minecraft.getMinecraft().thePlayer.posZ < 100

&& Minecraft.getMinecraft().thePlayer.posZ > -100) {

for (int i = 0; i < 100; i++) {

Minecraft.getMinecraft().fontRenderer

.drawString(getLetter(),

new Random().nextInt(Minecraft

.getMinecraft().displayWidth),

new Random().nextInt(Minecraft

.getMinecraft().displayWidth),

new Color(new Random().nextFloat(),

new Random().nextFloat(),

new Random().nextFloat()).getRGB());

}

} else {

Minecraft.getMinecraft().fontRenderer

.drawString(

getLetter(),

new Random().nextInt(Minecraft.getMinecraft().displayWidth),

new Random().nextInt(Minecraft.getMinecraft().displayWidth),

new Color(new Random().nextFloat(),

new Random().nextFloat(), new Random()

.nextFloat()).getRGB());

}

}

}

}

 

 

Posted

2 things.

 

1) Have you registered your TickListener in your main class?

2) If you are trying to send an entity to the NullVoid dimension after they fall down, you don't check IF that are at the dimension you need to frickin' SEND them to the dimension.

Posted

The tick listener is registered in both event bus things, and I am trying to teleport the item to x 256 in the dimension if they are in the dimension and under y 0. I have a separate method for getting in the dimension. I think I have a problem with getting the world, because there are no entries in world.loadedEntityList and the player one is detecting properly.

Posted

Ok then. I just solved it by looping through all the worlds in MinecraftServer.getServer().worldServers and using those.

TickListner:

 

 

package aj.Java.Nullvoid.Listners;

 

import java.awt.Color;

import java.util.List;

import java.util.Random;

 

import aj.Java.Nullvoid.VoidMod;

import baubles.api.BaublesApi;

import net.minecraft.client.Minecraft;

import net.minecraft.entity.item.EntityItem;

import net.minecraft.entity.player.EntityPlayerMP;

import net.minecraft.item.ItemStack;

import net.minecraft.server.MinecraftServer;

import net.minecraft.world.World;

import net.minecraftforge.client.event.RenderGameOverlayEvent;

import net.minecraftforge.client.event.TextureStitchEvent;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;

import cpw.mods.fml.common.gameevent.TickEvent;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class TickListner {

@SubscribeEvent

public void onTick(TickEvent.ServerTickEvent event) {

// System.out.println("OnTick");

String[] pls = MinecraftServer.getServer().getConfigurationManager()

.getAllUsernames();

EntityPlayerMP p;

for (int i = 0; i < pls.length; i++) {

p = MinecraftServer.getServer().getConfigurationManager()

.getPlayerForUsername(pls);

if (p != null) {

// System.out.println("Got a ticked player");

// System.out.println(p.posY);

if (p.posY < 0.01D) {

System.out.println("In the void!");

if (p.dimension == VoidMod.NullVoidDimID) {

p.setLocationAndAngles(p.posX, 256, p.posZ,

p.cameraYaw, p.cameraPitch);

}

p.addStat(VoidMod.fallVoid, 1);

}

if (p.dimension == VoidMod.NullVoidDimID) {

if (p.inventory.getCurrentItem() == null) {

p.clearActivePotions();

}

}

}

}

World world;

for (int ii = 0; ii < MinecraftServer.getServer().worldServers.length; ii++) {

world = MinecraftServer.getServer().worldServers[ii];

if (world != null) {

@SuppressWarnings("rawtypes")

List l = world.loadedEntityList;

for (int i = 0; i < l.size(); i++) {

if (l.get(i) != null) {

if (l.get(i) instanceof EntityItem) {

System.out.println("Not Null");

EntityItem item = (EntityItem) l.get(i);

if (item.posY < 1D) {

System.out.println("In Void");

if (item.getEntityItem().getItem()

.equals(VoidMod.nullVoidAlloy)) {

System.out.println("Is Alloy");

world.spawnEntityInWorld(new EntityItem(

world, item.posX, 200D, item.posZ,

new ItemStack(VoidMod.corruptAlloy, 1)));

}

}

}

}

}

}

}

 

// WorldProviderNullVoid.getProviderForDimension(VoidMod.NullVoidDimID).setWorldTime(13000);

}

 

@SubscribeEvent

@SideOnly(Side.CLIENT)

public void clientTick(TickEvent.ClientTickEvent event) {

if (Minecraft.getMinecraft().thePlayer != null) {

if (Minecraft.getMinecraft().thePlayer.dimension == VoidMod.NullVoidDimID) {

if (Minecraft.getMinecraft().thePlayer.inventory

.getCurrentItem() != null) {

if (Minecraft.getMinecraft().thePlayer.inventory

.getCurrentItem().getItem()

.equals(VoidMod.baneOfDark)) {

Minecraft.getMinecraft().gameSettings.gammaSetting = 1F;

} else {

Minecraft.getMinecraft().gameSettings.gammaSetting = -1F;

}

} else {

Minecraft.getMinecraft().gameSettings.gammaSetting = -1F;

}

} else {

if (Minecraft.getMinecraft().gameSettings.gammaSetting == -1F) {

Minecraft.getMinecraft().gameSettings.gammaSetting = Minecraft

.getMinecraft().thePlayer.getEntityData().getFloat(

"NullGamma");

}

}

}

}

 

@SideOnly(Side.CLIENT)

@SubscribeEvent

public void texturePreStitch(TextureStitchEvent.Pre event) {

if (event.map.getTextureType() == 0) {

event.map.setTextureEntry("nullvoid:nullOre", VoidMod.texNullOre);

}

}

 

@SideOnly(Side.CLIENT)

@SubscribeEvent

public void renderGlitch(RenderGameOverlayEvent event) {

if (VoidMod.glitchAmulet != null

&& Minecraft.getMinecraft().thePlayer != null) {

if (BaublesApi.getBaubles(Minecraft.getMinecraft().thePlayer)

.getStackInSlot(0) != null) {

if (!BaublesApi.getBaubles(Minecraft.getMinecraft().thePlayer)

.getStackInSlot(0)

.isItemEqual(new ItemStack(VoidMod.glitchAmulet))) {

glitch();

}

} else {

glitch();

}

}

}

 

@SubscribeEvent

public void crafted(ItemCraftedEvent event) {

if (event.crafting.getItem().equals(VoidMod.nullGoggles)) {

event.player.addStat(VoidMod.craftGoggle, 1);

}

}

 

private String getLetter() {

switch (new Random().nextInt(26)) {

case 0:

return "A";

case 1:

return "B";

case 2:

return "C";

case 3:

return "D";

case 4:

return "E";

case 5:

return "F";

case 6:

return "G";

case 7:

return "H";

case 8:

return "I";

case 9:

return "J";

case 10:

return "K";

case 11:

return "L";

case 12:

return "M";

case 13:

return "N";

case 14:

return "O";

case 15:

return "P";

case 16:

return "Q";

case 17:

return "R";

case 18:

return "S";

case 19:

return "T";

case 20:

return "U";

case 21:

return "V";

case 22:

return "W";

case 23:

return "X";

case 24:

return "Y";

case 25:

return "Z";

}

return null;

}

 

private void glitch() {

if (Minecraft.getMinecraft().thePlayer.dimension == VoidMod.NullVoidDimID) {

if (Minecraft.getMinecraft().thePlayer.posX < 10

&& Minecraft.getMinecraft().thePlayer.posX > -10

&& Minecraft.getMinecraft().thePlayer.posZ < 10

&& Minecraft.getMinecraft().thePlayer.posZ > -10) {

for (int i = 0; i < 10000; i++) {

Minecraft.getMinecraft().fontRenderer

.drawString(getLetter(),

new Random().nextInt(Minecraft

.getMinecraft().displayWidth),

new Random().nextInt(Minecraft

.getMinecraft().displayWidth),

new Color(new Random().nextFloat(),

new Random().nextFloat(),

new Random().nextFloat()).getRGB());

}

} else if (Minecraft.getMinecraft().thePlayer.posX < 50

&& Minecraft.getMinecraft().thePlayer.posX > -50

&& Minecraft.getMinecraft().thePlayer.posZ < 50

&& Minecraft.getMinecraft().thePlayer.posZ > -50) {

for (int i = 0; i < 1000; i++) {

Minecraft.getMinecraft().fontRenderer

.drawString(getLetter(),

new Random().nextInt(Minecraft

.getMinecraft().displayWidth),

new Random().nextInt(Minecraft

.getMinecraft().displayWidth),

new Color(new Random().nextFloat(),

new Random().nextFloat(),

new Random().nextFloat()).getRGB());

}

} else if (Minecraft.getMinecraft().thePlayer.posX < 100

&& Minecraft.getMinecraft().thePlayer.posX > -100

&& Minecraft.getMinecraft().thePlayer.posZ < 100

&& Minecraft.getMinecraft().thePlayer.posZ > -100) {

for (int i = 0; i < 100; i++) {

Minecraft.getMinecraft().fontRenderer

.drawString(getLetter(),

new Random().nextInt(Minecraft

.getMinecraft().displayWidth),

new Random().nextInt(Minecraft

.getMinecraft().displayWidth),

new Color(new Random().nextFloat(),

new Random().nextFloat(),

new Random().nextFloat()).getRGB());

}

} else {

Minecraft.getMinecraft().fontRenderer

.drawString(

getLetter(),

new Random().nextInt(Minecraft.getMinecraft().displayWidth),

new Random().nextInt(Minecraft.getMinecraft().displayWidth),

new Color(new Random().nextFloat(),

new Random().nextFloat(), new Random()

.nextFloat()).getRGB());

}

}

}

}

 

 

Posted

Ok, I edited to your comments, but I need to set the player's gamma to one previously set, and I want to to retain across minecraft closings. How would I do that? I think packets but I do not know how to use them at all. Thanks for helping me fix my code :).

Revised TickListner:

 

 

package aj.Java.Nullvoid.Listners;

 

import java.awt.Color;

import java.util.Random;

 

import aj.Java.Nullvoid.VoidMod;

import baubles.api.BaublesApi;

import net.minecraft.client.Minecraft;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.ItemStack;

import net.minecraftforge.client.event.RenderGameOverlayEvent;

import net.minecraftforge.client.event.TextureStitchEvent;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;

import cpw.mods.fml.common.gameevent.TickEvent;

import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class TickListner {

private Minecraft m = Minecraft.getMinecraft();

private Random r = new Random();

@SubscribeEvent

public void playerTick(PlayerTickEvent event){

EntityPlayer p = event.player;

if (p != null) {

// System.out.println("Got a ticked player");

// System.out.println(p.posY);

if (p.posY < 0.01D) {

System.out.println("In the void!");

if (p.dimension == VoidMod.NullVoidDimID) {

p.setLocationAndAngles(p.posX, 256, p.posZ,

p.cameraYaw, p.cameraPitch);

}

p.addStat(VoidMod.fallVoid, 1);

}

if (p.dimension == VoidMod.NullVoidDimID) {

if (p.inventory.getCurrentItem() == null) {

p.clearActivePotions();

}

}

}

}

 

@SubscribeEvent

@SideOnly(Side.CLIENT)

public void clientTick(TickEvent.ClientTickEvent event) {

if (m.thePlayer != null) {

if (m.thePlayer.dimension == VoidMod.NullVoidDimID) {

if (m.thePlayer.inventory

.getCurrentItem() != null) {

if (m.thePlayer.inventory

.getCurrentItem().getItem()

.equals(VoidMod.baneOfDark)) {

m.gameSettings.gammaSetting = 1F;

} else {

m.gameSettings.gammaSetting = -1F;

}

} else {

m.gameSettings.gammaSetting = -1F;

}

} else {

if (m.gameSettings.gammaSetting == -1F) {

m.gameSettings.gammaSetting = Minecraft

.getMinecraft().thePlayer.getEntityData().getFloat(

"NullGamma");

}

}

}

}

 

@SideOnly(Side.CLIENT)

@SubscribeEvent

public void texturePreStitch(TextureStitchEvent.Pre event) {

if (event.map.getTextureType() == 0) {

event.map.setTextureEntry("nullvoid:nullOre", VoidMod.texNullOre);

}

}

 

@SideOnly(Side.CLIENT)

@SubscribeEvent

public void renderGlitch(RenderGameOverlayEvent event) {

if (VoidMod.glitchAmulet != null

&& m.thePlayer != null) {

if (BaublesApi.getBaubles(m.thePlayer)

.getStackInSlot(0) != null) {

if (!BaublesApi.getBaubles(m.thePlayer)

.getStackInSlot(0)

.isItemEqual(new ItemStack(VoidMod.glitchAmulet))) {

glitch();

}

} else {

glitch();

}

}

}

 

@SubscribeEvent

public void crafted(ItemCraftedEvent event) {

if (event.crafting.getItem().equals(VoidMod.nullGoggles)) {

event.player.addStat(VoidMod.craftGoggle, 1);

}

}

 

private String getLetter() {

return String.valueOf(Character.toChars(r.nextInt(93) + 33));

}

 

private void glitch() {

if (m.thePlayer.dimension == VoidMod.NullVoidDimID) {

if (m.thePlayer.posX < 10

&& m.thePlayer.posX > -10

&& m.thePlayer.posZ < 10

&& m.thePlayer.posZ > -10) {

for (int i = 0; i < 10000; i++) {

m.fontRenderer

.drawString(getLetter(),

r.nextInt(m.displayWidth),

r.nextInt(m.displayWidth),

new Color(r.nextFloat(),

r.nextFloat(),

r.nextFloat()).getRGB());

}

} else if (m.thePlayer.posX < 50

&& m.thePlayer.posX > -50

&& m.thePlayer.posZ < 50

&& m.thePlayer.posZ > -50) {

for (int i = 0; i < 1000; i++) {

m.fontRenderer

.drawString(getLetter(),

r.nextInt(m.displayWidth),

r.nextInt(m.displayWidth),

new Color(r.nextFloat(),

r.nextFloat(),

r.nextFloat()).getRGB());

}

} else if (m.thePlayer.posX < 100

&& m.thePlayer.posX > -100

&& m.thePlayer.posZ < 100

&& m.thePlayer.posZ > -100) {

for (int i = 0; i < 100; i++) {

m.fontRenderer

.drawString(getLetter(),

r.nextInt(m.displayWidth),

r.nextInt(m.displayWidth),

new Color(r.nextFloat(),

r.nextFloat(),

r.nextFloat()).getRGB());

}

} else {

m.fontRenderer

.drawString(

getLetter(),

r.nextInt(m.displayWidth),

r.nextInt(m.displayHeight),

new Color(r.nextFloat(),

r.nextFloat(), r

.nextFloat()).getRGB());

}

}

}

}

 

 

Posted

Ok, Thanks.

I am trying to change the player's gamma to -1F when they enter a dimension and revert it to their previous gamma when they exit. I already have it saving their gamma somewhere else, but I also need to revert it and make sure it is enforced if something does not work.

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



×
×
  • Create New...

Important Information

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