-
Posts
785 -
Joined
-
Last visited
Everything posted by ItsAMysteriousYT
-
[1.8][OpenGL] Entity rendered too bright
ItsAMysteriousYT replied to Bedrock_Miner's topic in Modder Support
Oh - im sorry, the setColorOpaque is in the Worldrenderer. Use it like this: WorldRenderer renderer=Tessellator.getInstance().getWorldRenderer(). then do renderer.setColorOpaque(...). Sorry, my mistake -
[1.8][OpenGL] Entity rendered too bright
ItsAMysteriousYT replied to Bedrock_Miner's topic in Modder Support
Why do you set the color in there? For transparent bits, use GLStateManager.setColorOpaque() or GLStatemanager.setColorRGBA() -
[1.8][OpenGL] Entity rendered too bright
ItsAMysteriousYT replied to Bedrock_Miner's topic in Modder Support
Yes, cuz you do not have anything in those pushAttrib() methods. But its just cleaner. -
[1.8][OpenGL] Entity rendered too bright
ItsAMysteriousYT replied to Bedrock_Miner's topic in Modder Support
Paste a screenshot of the rendered entity please. Also, call pushAttrib before pushMatrix(). -
Okay, there still are some tiny bugs that i wanna fix but i don't know how: 1. When i connect two blocks e.g a powersource with a lantern, the lanternblock itself gets updatet(becomes a lightvalue), but not the blocks around it. Even if i make markBlockForUpdtate on it. 2. The voltage in a block itself does not get updated immediatly sometimes(At least it does not show up when i draw a string with that voltage) PS: For number two, i use @SideOnly(Side.CLIENT) variables which i set in a (worldObj.isRemote) check.
-
Just think of what you need. Youll need an entity and then some wy to change the position. These are trigonomic equations. Math.sin, Math.cos. Then youll need some values to steer with. Use the players moveStraffing and moveForward fields for that, then you don't need to use packethandling to update the positions. And thats it. Add me on skype if you need help (itsamysterios)
-
Anf the resourcepack still does not work outside of the modding workpsace These are the methods in which i load additional items/blocks. private void loadVehicles() { System.out.println("loaded vehicles"); if (vehiclefile.exists()) { if (vehiclefile.isDirectory()) { for (File vehicle : vehiclefile.listFiles()) { if (vehicle.getName().endsWith(".rlm")) { Vehicles.addVehicle(new VehicleFile(vehicle)); } } } } else { vehiclefile.mkdirs(); } } Thats why i use that weird MCDirectory stuff, cuz i have too define the directory in which the VehicleFiles are located. But when in minecraft, they do not work.
-
Ah - OK. That explaines many things. Now, i don't wanna make a new thread for that problem - so is anything wrong with the method? Somehow the Gui shows up even if i have set the name/surname before. @SubscribeEvent public void updateRealLifeProps(PlayerTickEvent event) { tickrun++; if (tickrun>3&&RLMPlayerProps.get(event.player) != null) { RLMPlayerProps.get(event.player).circleOfLife(); if (RLMPlayerProps.get(event.player).getName() == null) { BlockPos p = event.player.getPosition(); event.player.openGui(RealLifeMod.instance, GuiModInit.ID, event.player.worldObj, 0, 0, 0); } else { if (RLMPlayerProps.get(event.player).getName().isEmpty()) { BlockPos p = event.player.getPosition(); event.player.openGui(RealLifeMod.instance, GuiModInit.ID, event.player.worldObj, p.getX(), p.getY(), p.getZ()); } } }else { RLMPlayerProps.register(event.player); } } @SubscribeEvent public void onEntityConstructing(EntityConstructing event) { if (event.entity instanceof EntityPlayer) { if (RLMPlayerProps.get((EntityPlayer) event.entity) == null) { RLMPlayerProps.register((EntityPlayer) event.entity); } } } PS - i tried the GuiOpen stuff in PlayerLoggedInEvent, but it did not open the gui.
-
Is it possible to load them dynamicly? Without reloading all resources? And i came out with that resourceDir detection because when i tried starting the server with it, it crashed because it tried to acces the client. First i tried to make the method in a clientcheck (if(event.getSide()==Side.CLIENT)) but it crashed too.
-
1. Forgot to remove it. 2. I do not know whic method to override so the methods automaticly work right 3.Like this: 4.With this method in my clientproxy from preinit: @Override public void loadCoreModules() { List<IResourcePack> defaultResourcePacks = ObfuscationReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "defaultResourcePacks", "field_110449_ao"); defaultResourcePacks.add(new RLMPack()); File screenshots = new File(Minecraft.getMinecraft().mcDataDir, "screenshots"); for (File f : screenshots.listFiles()) { Screenshotspack.filenames.add(f.getName()); } defaultResourcePacks.add(new Screenshotspack()); Minecraft.getMinecraft().refreshResources(); }
-
I created a resourcepack but it won't load when i compiled my mod and try it in minecraft it wouldn't load. This is my resourcefile: package itsamysterious.mods.reallifemod; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.Set; import com.google.common.collect.ImmutableSet; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.DefaultResourcePack; import net.minecraft.client.resources.FolderResourcePack; import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.resources.IResourceManagerReloadListener; import net.minecraft.client.resources.IResourcePack; import net.minecraft.client.resources.data.IMetadataSection; import net.minecraft.client.resources.data.IMetadataSerializer; import net.minecraft.util.ResourceLocation; public class RLMPack extends FolderResourcePack implements IResourcePack,IResourceManagerReloadListener{ public static final Set defaultResourceDomains = ImmutableSet.of("RLM"); public static List<String> filenames=new ArrayList<String>(); public RLMPack() { super(new File(RealLifeMod.MinecraftDirectory+"/RLM")); } @Override public InputStream getInputStream(ResourceLocation p_110590_1_) throws IOException { return getResourceStream(p_110590_1_); } @Override public boolean resourceExists(ResourceLocation p_110589_1_) { return this.getResourceStream(p_110589_1_) != null; } private InputStream getResourceStream(ResourceLocation p_110605_1_) { try { return new FileInputStream(RealLifeMod.MinecraftDirectory+"/RLM/"+p_110605_1_.getResourcePath()); } catch (FileNotFoundException e) { e.printStackTrace(); } return null; } @Override public Set getResourceDomains() { return defaultResourceDomains; } @Override public IMetadataSection getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException { return null; } @Override public BufferedImage getPackImage() throws IOException { return null; } @Override public String getPackName() { return "RLMPack"; } @Override public void onResourceManagerReload(IResourceManager resourceManager) { } }
-
Dedicated Server crashes while opening a Gui[UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
Whoops - i tried that cuz i thought the data could have been null, ill immediatly remove it now. And also i reacted on the things you said, i just didn't wrote that i did sow. I now use the EntityConstructing event to register the props if they are null and in the playertickevent i do the guistuff if one of the values is null. -
Dedicated Server crashes while opening a Gui[UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
And the write/read methods are correct? Cuz if yes, i probably have to edit some of the event codes. -
Dedicated Server crashes while opening a Gui[UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
I used it in my GuiHandler which caused a mess. Now i have it in the OnEntityConstructing method. -
Dedicated Server crashes while opening a Gui[UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
Okay, now the gui opens propperly. Somehow two eventhandlers collided and closed the gui from the other one cuz i forgot to remove the old event handler. So - im not sure if im doing everything propper in my IEEP class. Cuz when the player rejoines in the world, the gui opens again. This is my code: package itsamysterious.mods.reallifemod.core.lifesystem; import itsamysterious.mods.reallifemod.core.blocks.tiles.TileEntity_Electric; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.IExtendedEntityProperties; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class RLMPlayerProps implements IExtendedEntityProperties { private EntityPlayer player; private World theWorld; private String name; private String surname; private double toilet; private double water; private float money; private double energy; private double stamina; private String gender; public boolean shownGui; private int timeWaterless = 0; private int waterlowmessagetime = 0; private String partner; public static final String EXT_PROP_NAME = "RealLifeProperties"; private static final int NAMEWATCHER = 0; public TileEntity_Electric lastTile; public RLMPlayerProps() { } public RLMPlayerProps(EntityPlayer player) { this.player = player; } public static final void register(EntityPlayer player) { player.registerExtendedProperties(RLMPlayerProps.EXT_PROP_NAME, new RLMPlayerProps(player)); } public static final RLMPlayerProps get(EntityPlayer player) { return (RLMPlayerProps) player.getExtendedProperties(EXT_PROP_NAME); } public void circleOfLife() { this.theWorld = this.player.worldObj; if (player != null && !player.capabilities.isCreativeMode) { if (getWater() > 0.1) { setWater(getWater() - 0.00138888889D); } if (toilet < 100) { toilet += 0.00415151515151515D; } updateEffects(); } } private void updateEffects() { if (getWater() < 40 && getWater() > 10 && waterlowmessagetime % 200 == 0) { player.addChatComponentMessage(LinesHelper.ThirstWarning); } if (getWater() < 10 && getWater() > 0.1) { player.addChatComponentMessage(LinesHelper.ThirstWarning2); player.addPotionEffect(new PotionEffect(Potion.confusion.getId(), 100)); } else if (player.getActivePotionEffect(Potion.confusion) != null) { player.removePotionEffect(Potion.confusion.id); } if (getWater() < 0.1) { player.addPotionEffect(new PotionEffect(Potion.weakness.getId(), 100)); timeWaterless++; if (timeWaterless == 200) { player.addChatComponentMessage(LinesHelper.DyingOfThirst); player.setHealth(player.getHealth() - 1); } } // Toilet stuff if (toilet > 50) { player.addPotionEffect(new PotionEffect(Potion.digSlowdown.getId(), 1)); } else { player.removePotionEffect(Potion.digSlowdown.getId()); } } @Override public void saveNBTData(NBTTagCompound compound) { player.writeEntityToNBT(compound); NBTTagCompound properties = new NBTTagCompound(); properties.setDouble("WATER", getWater()); properties.setDouble("TOILET", toilet); properties.setFloat("MONEY", money); if(this.name!=null&&!this.surname.isEmpty()) properties.setString("NAME",this.name); else properties.setString("NAME","Set"); if(this.surname!=null&&!this.surname.isEmpty()) properties.setString("SURNAME", surname.isEmpty()?"Yourname":this.surname); properties.setDouble("ENERGIE", energy); properties.setBoolean("GUISHOWN", shownGui); if(getGender()!=null){ properties.setString("GENDER", getGender()); }else { properties.setString("GENDER", "male"); } compound.setTag(EXT_PROP_NAME, properties); } @Override public void loadNBTData(NBTTagCompound compound) { this.player.readEntityFromNBT(compound); NBTTagCompound theTag = compound.getCompoundTag(EXT_PROP_NAME); this.setWater(theTag.getDouble("WATER")); this.toilet = theTag.getDouble("TOILET"); this.money = theTag.getFloat("MONEY"); this.setName(theTag.getString("NAME")); this.setSurname(theTag.getString("SURNAME")); this.energy = theTag.getDouble("ENERGIE"); this.shownGui = theTag.getBoolean("GUISHOWN"); this.setGender(theTag.getString("GENDER")); } @Override public void init(Entity entity, World world) { if (entity instanceof EntityPlayer) { this.player = (EntityPlayer) entity; this.setWater(100); this.toilet = 0; } } public void copy(RLMPlayerProps props) { this.player.getDataWatcher().updateObject(NAMEWATCHER, props.getName()); this.name = props.name; this.surname = props.surname; this.gender = props.gender; } public void pee() { if (toilet > 0) { toilet -= 1; } } public void setGender(String s) { if (s.equals("male")) { gender = "male"; } else gender = "female"; } public static final String getFullname(EntityPlayerSP thePlayer) { return get(thePlayer).getName() + " " + get(thePlayer).getSurname(); } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getSurname() { return surname; } public void setSurname(String surname) { this.surname = surname; } public String getGender() { return gender; } public double getWater() { return water; } public void setWater(double water) { this.water = water; } } PS - I know - the tagkeys i use are horrible But appart from that - is the class setup correct? -
In my CommonHandler (registered to FMLCommonHandler.instance.bus) i have some methods that set IEPP when the player spawns. Now i need to open a gui when a specific value in these extendedPlayerProps is null or isEmpty(for a string). So i decided to add a ID to the gui and i try opening it using the PlayerTickEvent. But somehow it causes a server crash. This is my code: @SubscribeEvent public void updateRealLifeProps(PlayerTickEvent event) { if(event.player.ticksExisted>2) if (RLMPlayerProps.get(event.player) != null) { RLMPlayerProps.get(event.player).circleOfLife(); }else { RLMPlayerProps.register(event.player); } if(RLMPlayerProps.get(event.player)!=null){ RLMPlayerProps props=RLMPlayerProps.get(event.player); if(props.getName()==null||props.getSurname()==null||props.getGender()==null){ BlockPos p=event.player.getPosition(); event.player.openGui(RealLifeMod.instance, GuiModInit.ID, event.player.worldObj, p.getX(), p.getY(), p.getZ()); } } } @SubscribeEvent public void onEntityConstructing(EntityConstructing event) { if (event.entity instanceof EntityPlayer) { if (RLMPlayerProps.get((EntityPlayer) event.entity) == null) { RLMPlayerProps.register((EntityPlayer) event.entity); } } } This is the ServerLog: