Jump to content

salvestrom

Members
  • Posts

    116
  • Joined

  • Last visited

Posts posted by salvestrom

  1. 27 minutes ago, V0idWa1k3r said:

    You can put whatever you'd like in it, not that you can have more than 16 redstone strength variants anyway, and I doubt players who use modded need your disk to output a uniqie strength anyway.

    Yeah it doesn't seem like I'll be screwing anything up by passing through a zero. Thanks.

  2. in my previous mod i had a large structure - a village on a plateau. parts of the plateau that were generated on to already loaded chunks had trees buried in it and was undecorated.

     

    i'd like to try something different in my current project so that i can better control structures spawning apart from each other while ensuring that the duplication of a world produces the exact same set of buildings in the exact same spot.

     

    vanilla seems to generate a hashmap of structure starts and structure component coordinates. what happens then i'm just guessing at but i'm assuming each new chunk that loads checks the hashmap and if it finds matching coordinates generates whatever building is specified. i'm not clear on when/how the map is created. what happens if the player teleports 10km away??

     

    i'd like to at least emulate this. a predetermined set of spawn points that a  iworldgenerator class can search when it recieves a new chunk and spawn any associated structures.

  3. 1 hour ago, diesieben07 said:

    No, you need to make a call to a method that is defined in your proxy interface. That method is than implemented in your server and client proxy, where the client proxy actually does the client-only code.

    Okay. what ive done so far is:

            w2theJungle.instance.openJungleBook(playerIn, itemstack, false);

    is now in the OP method.

    the method being called is blank, as is the one in ProxyCommon. The ProxyClient version contains the original Minecraft.getMin... etc, line.

    server doesn't crash, but the book can't be opened. what am i doing wrong? aside from everything...
     

  4. I've been sent a crash report for my mod where it fails to load on  server. the title is part of the crash file. it's also reporting failing to find class definitions etc.

     

    The chain of classes ends with my JungleItems class when it calls bookScale, which is for my prewritten books. It offers no details about where in the class the failure occurs, however, it must be the below method:

     

        public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
        {
            ItemStack itemstack = playerIn.getHeldItem(handIn);
    
            if (!worldIn.isRemote)
            {
                this.resolveContents(itemstack, playerIn);
            }
            
            Minecraft.getMinecraft().displayGuiScreen(new GuiScreenBook(playerIn, itemstack, false));
            	
            //playerIn.openBook(itemstack, handIn);
            playerIn.addStat(StatList.getObjectUseStats(this));
            return new ActionResult(EnumActionResult.SUCCESS, itemstack);
        }

     

    specifically, the line starting Minecraft.getMinecraft(). Blank it and the server will start. I've already tried a few alternatives, including mimicking the code in the blanked out openBook method. I haven't tried using @SideOnly yet.

     

    Edit: using @Side seems to work, but i've read that i shouldn't resort to it, and have concerns something will be lurking in the wings :P

  5. On 4/14/2017 at 9:55 AM, diesieben07 said:

    Debugging this with just snippets of code is difficult. Please post a working Git repo of your mod.

    As requested:

    https://github.com/salvestrom/thejungle

     

    This link is for 1.10.2 code. the issue exists in 3 different versions. One solution should correct them all. You will find that the method for adding subtypes to the bookScale item class and the itemrender class where the books get added have multiple variations, none of which have worked. the best result is still the original version in the op.

     

    I'm not sure there's anyway around it.

  6. i referred to it as a missing texture several times. calling it the missing texture texture, or "missing" texture seemed superfluous :P anyway, yes, black and purple.

     

    so, this is from my op:

    registerRender(JungleItems.bookScales);

     

    registerRenderWithMeta("east_scale", bookScale.eastScale.getMetadata(), bookScale.eastScale.getItem()); registerRenderWithMeta("west_scale", bookScale.westScale.getMetadata(), bookScale.westScale.getItem()); registerRenderWithMeta("north_scale", bookScale.northScale.getMetadata(), bookScale.northScale.getItem()); registerRenderWithMeta("south_scale", bookScale.southScale.getMetadata(), bookScale.southScale.getItem());

     

    the above is part of the cause. bookscale.eastscale.getitem is actually returning the vanilla item item.written_book. if i change it to:

     

    registerRenderWithMeta("east_scale", bookScale.eastScale.getMetadata(), JungleItems.bookScales);      registerRenderWithMeta("west_scale", bookScale.westScale.getMetadata(), JungleItems.bookScales);        registerRenderWithMeta("north_scale", bookScale.northScale.getMetadata(), JungleItems.bookScales);        registerRenderWithMeta("south_scale", bookScale.southScale.getMetadata(), JungleItems.bookScales);
            

    then the vanilla written books get their textures back. however, the mod books lose theirs. i'm wondering if i need to split the bookscale class into 4 seperate classes for each book. but then, if that was going to work i would expect the south-scale, ie, the last book registered to have its texture, which it doesn't..

     

  7. I looked over the client log. there's nothing about a missing texture. but then, i don't think the texture is missing, exactly. let me explain again:

    if you use the vanilla edittable book, sign it to create a written book, that item has a missing texture. i know that there's something in my mod thats causing this - the issue is in 3 seperate minecraft versions and a new mod i started doesn't have this issue. my mod has 4 pre-written books which all work and have textures, but somwhere in this code its causing the vanilla written books to appear textureless.

  8. this was brought to my attention for the 1.11.2 version of my mod, but is present in the 1.9 and 1.10 version, too (but not the 1.7).

    the vanilla item written book, that is a book that has been signed, has a missing texture. there are no errors on load.

    the mod has a series of pre-written books, that use the book_written texture without issue. giving them their own texture did not resolve the issue.

     

    i'm not wholly sure what you guys are going to want to see code wise, but below is the item file. the setup of the file is very old - something i found online over two years ago. extending Item instead of ItemWrittenBook does nothing to resolve the issue. I gutted the book text for posting convenience. also note that this code is the 1.10 version so file names can still have capitals.

     

    Spoiler
    
    public class bookScale extends ItemWrittenBook {
    	
    	public static ItemStack eastScale;
    	public static ItemStack westScale;
    	public static ItemStack northScale;
    	public static ItemStack southScale;
    	
    	public bookScale(Item item) 
        {
    		 super();
    	    	this.setUnlocalizedName("bookScale");
    	    	this.setContainerItem(this);
    	    	this.setCreativeTab(w2theJungle.JungleModTab);
    	    	this.setHasSubtypes(true);
        }
    	
    	{
    		{		
            
    		eastScale = new ItemStack(Items.WRITTEN_BOOK);
    		eastScale.setItemDamage(367);
    		
        	NBTTagCompound tag = new NBTTagCompound();
        	eastScale.setTagCompound(tag);
    	    		
    		tag.setString("author", ("Salvestrom"));
    		tag.setString("title", ("The Books of Scale: The Bringer"));
    		NBTTagList bookPages = new NBTTagList();
    		tag.setTag("pages", bookPages);
    	}
    	{
    		westScale = new ItemStack(Items.WRITTEN_BOOK);
    		NBTTagCompound wtag = new NBTTagCompound();
    		westScale.setTagCompound(wtag);
    	    westScale.setItemDamage(368);
    
    	    NBTTagList westPages = new NBTTagList();
    	    wtag.setTag("pages", westPages);
    		wtag.setString("author", ("Salvestrom"));
    		wtag.setString("title", ("The Books of Scale: The Taker"));
    	}
    	{
    		northScale = new ItemStack(Items.WRITTEN_BOOK);
    		
    		NBTTagCompound ntag = new NBTTagCompound();
    
    		northScale.setTagCompound(ntag);
    	    northScale.setItemDamage(369);
    		
    		ntag.setString("author", ("Salvestrom"));
    		ntag.setString("title", ("The Books of Scale: The Shield"));
    		NBTTagList northPages = new NBTTagList();
    	    ntag.setTag("pages", northPages);
    	}
    	
    	{
    		southScale = new ItemStack(Items.WRITTEN_BOOK);
    		NBTTagCompound stag = new NBTTagCompound();
    		
    		southScale.setTagCompound(stag);
    	    southScale.setItemDamage(370);
    	    
    		NBTTagList southPages = new NBTTagList();
    
    		stag.setTag("pages", southPages);
    		stag.setString("author", ("Salvestrom"));
    		stag.setString("title", ("The Books of Scale: The Sword"));
    		}
    	}
    
    	@SuppressWarnings({"rawtypes", "unchecked"})
        @Override
    	@SideOnly(Side.CLIENT)
    	public void getSubItems(Item i, CreativeTabs c, List<ItemStack> list) {
    		list.add(bookScale.eastScale);
    	 	list.add(bookScale.westScale);
    	 	list.add(bookScale.northScale);
    	 	list.add(bookScale.southScale); 
    	 	}
    }

     

     

    to my untrained eyes, nothing stands out from the render registering that should prevent the game from using a vanilla texture for a vanilla item. again, i stress, there is no issue with rendering my mod item, but something in my code is preventing minecraft from applying a vanilla texture to the vanilla written book.

     

    Spoiler
    
    this is from the render registry file:
    
    	registerRender(JungleItems.bookScales);
    	
    	registerRenderWithMeta("east_scale", bookScale.eastScale.getMetadata(), bookScale.eastScale.getItem());
    	registerRenderWithMeta("west_scale", bookScale.westScale.getMetadata(), bookScale.westScale.getItem());
    	registerRenderWithMeta("north_scale", bookScale.northScale.getMetadata(), bookScale.northScale.getItem());
    	registerRenderWithMeta("south_scale", bookScale.southScale.getMetadata(), bookScale.southScale.getItem());
    
    
    	@SideOnly(Side.CLIENT)
    	public static void registerRenderWithMeta(String string, int i, Item item)
    	{
            ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(References.MODID + ":" + string, "inventory"));
    	}

     

     

  9. Adding pos.getY() > 0 to the while statement allowed the extreme hills to load, and after 5 min roaming have yet to find another area that locked the game up. the only thing i can think of, bizarre as it sounds, is that some column in a chunk contained no stone, allowing the while loop to go all the way down to bedrock and on into the void.

  10. Spoiler
    
    	public int findGroundHeight(int x, int y, int z, Chunk chunk, ExtendedBlockStorage storage, Block toRemove, Block toPlace)
    	{
    		int cy = chunk.getHeightValue(x, z);
    		
    		BlockPos pos = new BlockPos(chunk.xPosition * 16 + x, cy, chunk.zPosition * 16 + z);
    		
    		while(chunk.getBlockState(pos) != toRemove.getDefaultState())
    		{
    			pos = pos.down();
    		}
    			
    		return pos.getY();
    	}

     

    The method is now as above. This helped a little with the load time, but did not resolve the locking up. i disabled the code and reloaded the world to determine what is in the region. an extreme hills biome. a large, tall one. but i figure if the game is checking the entirety of every loading chunk its not going to matter what that chunk contains. i keep wondering if some special circumstance is causing the while() statement to get stuck in an infinite loop. the method in the op already has a null check on the ExtendedBlockStorage, so it's not that. hmm. perhaps i shall try throwing in a break if y < 0...

  11. 	public int findGroundHeight(int x, int y, int z, Chunk chunk, ExtendedBlockStorage storage, Block toRemove, Block toPlace)
    	{
    		int cy = chunk.getHeightValue(x, z);
    		
    		while(chunk.getWorld().getBlockState(new BlockPos(chunk.xPosition * 16 + x, cy, chunk.zPosition * 16 + z))
    				!= toRemove.getDefaultState())
    		{
    			cy = cy - 1;
    		}
    			
    		return cy;
    	}

     

    i'm using the above atm, calling the method from the op code at the "int a = " line. although, as draco noted, exposed tunnels and ravines throw things off, it works to ignore trees. however, the terrain eventually stops loading and is alittle laggy even before that. i appreciate that what i'm doing is going to slow things down alot, so i'm more interested in whats causing the terrain to just give up. even after reloading the same region will lock up.

  12. The spoiler code below is something I found in another thread (the poster said it was diesenben's). i added the height check. the goal is to replace all the stone below half the terrain height with something else. This all works, with one annoying issue: the returned y location from getHeightValue is including leaves and trees. i was expecting/would like the height value to be the "ground" so to speak. All paths lead to Rome, that I've found, i.e calling event.getWorld().getHeight(stuff) ultimately calls getHeightValue in the chunk class.

    Spoiler
    
    	@SubscribeEvent
    	public void blockSwap(PopulateChunkEvent.Pre pce)
    	{
    	
    	    Chunk chunk = pce.getWorld().getChunkFromChunkCoords(pce.getChunkX(), pce.getChunkZ());
    	    Block tobeReplaced = Blocks.STONE;
    	    
    	    for (ExtendedBlockStorage storage : chunk.getBlockStorageArray())
    	    	if(storage != null)
    	    	{
    	    		{
    	                for (int x = 0; x < 16; ++x) 
    	                {
    	                    for (int y = 0; y < 16; ++y) 
    	                    {
    	                        for (int z = 0; z < 16; ++z) 
    	                        {
    	                    	    int a = chunk.getHeightValue(x, z) / 2;
    	                    	    //pce.getWorld().getHeight(pce.getChunkX()*16 + x, pce.getChunkZ()*16 + z)/2;
    
    	                            if (storage.get(x, y, z) == tobeReplaced.getDefaultState()
    	                            		&& storage.getYLocation() + y < a) 
    	                            {
    	                                storage.set(x, y, z, Blocks.SANDSTONE.getDefaultState());
    	                            }
    	                        }
    	                    }
    	                }
    	            }
    	    	}
    
    	    chunk.setModified(true); // this is important as it marks it to be saved
    	}

     

     

  13. 47 minutes ago, Draco18s said:

    Event methods don't return anything. They need to modify the event object passed to it.

    this was for 1.9.4. the return was required, iirc.. in anycase. im not using it atm.

     

    the provider (i realise several methods are pointlessly overidden):

    Spoiler
    
    public class LostWorldProvider extends WorldProvider {
    	
     	@Override
    	public DimensionType getDimensionType() {
    		return w2theJungle.LOST_WORLD;
    	}
        
    	@Override
    	public void init()
    	{
            this.hasSkyLight = true;
    		this.biomeProvider = new BiomeProviderSingle(JungleBiomeRegistry.lostJungle);
            this.hasNoSky = false; //using reduces lag but makes dark. true to remove lag.false
    	}
    
    	@Override
    	public IChunkGenerator createChunkGenerator(){
    		return new LostChunkProvider(this.world, this.world.getSeed(), this.world.getWorldInfo().isMapFeaturesEnabled());
    	}
    	
      protected void generateLightBrightnessTable()
      {
    	  float f = 0.15f;//0.15F;// + this.worldObj.getHeight()/200;
    	  for (int i = 0; i <= 15; ++i)
    	  {
    		  float f1 = 1.0F - (float)i / 15F;
    		  this.lightBrightnessTable[i] = (1.0F - f1) / (f1 * 3.0F + 1.0F) * (1.0F - f) + f;
    		  }
    	//System.out.println(f);  	  
      }
      
      public double getMovementFactor()
      {
          return 2.0;
      }
    	
    	
    	public String getDimensionName() {
    		return "Lost World";
    	}
    
        public void resetRainAndThunder()
        {
            this.world.getWorldInfo().setRainTime(0);
            this.world.getWorldInfo().setRaining(false);
            this.world.getWorldInfo().setThunderTime(0);
            this.world.getWorldInfo().setThundering(false);
        }
    	
        public boolean isSurfaceWorld()
        {
            return true;
        }
    	
        public boolean canRespawnHere()
        {
            return true;  //required tru to prevent beds exploding.
        }
    
        @SideOnly(Side.CLIENT)
        public float getCloudHeight()
        {
            return 33F;
        }
        
        public String getWelcomeMessage()
        {
        	return "Entering the Lost World";
        }
        
        public String getDepartMessage()
        {
        	return "Leaving the Lost World";
        }
    
        public BlockPos getRandomizedSpawnPoint()
        {
            BlockPos ret = this.world.getSpawnPoint();
            return ret;
        }
        
        public BlockPos getSpawnPoint()
        {
            return new BlockPos(0, 54, 0);
        }
        
        public void setSpawnPoint(BlockPos pos)
        {
            world.getWorldInfo().setSpawn(new BlockPos(0, 54, 0));
        }
        
        public int getHeight()
        {
            return 128;
        }
    
        public int getActualHeight()
        {
            return 128;
        }
        
        public boolean isDaytime()
        {
            return world.getSkylightSubtracted() < 4;
        }
        
        public void setWorldTime(long time)
        {
            this.world.getWorldInfo().setWorldTime(time);
        }
    
        public long getWorldTime()
        {
            return this.world.getWorldInfo().getWorldTime();
        }
    }

     

     

  14. 54 minutes ago, diesieben07 said:

    Please show your code.

    umm. what code? having set canRespawnHere to true and forcing the spawn point to a fixed position if there's no bed there's nothing else I'm doing. the above mentioned event was something i tried in 1.9.4. it is not currently being used. i didnt see the point in trying it for 1.11.2 given the way in which it failed.

     

    it looked like this: 

     

    	@SubscribeEvent
    	public EntityPlayer.SleepResult playerSleepInLostWorld(PlayerWakeUpEvent psibe)
    	{
    		/*
    		World wrld = psibe.getEntityPlayer().worldObj;
    		
    		if(wrld.provider instanceof LostWorldProvider)
    		{
    		
    		psibe.getEntityPlayer().worldObj.provider.resetRainAndThunder();
    		
            if (wrld.getGameRules().getBoolean("doDaylightCycle"))
            {
                long i = wrld.getWorldInfo().getWorldTime() + 24000L;
                wrld.getWorldInfo().setWorldTime(i - i % 24000L);
                System.out.println(wrld.getWorldInfo().getWorldTime() + 24000L);
            }
    		}
            System.out.println(wrld.getWorldInfo().getWorldTime() + 24000L);
    */
    		return null;//psibe.getResultStatus();
    	}

     

    the system.out confirmed the rapid switching of the time, to morning, then straight back to night.

  15. i have the bed working in the sense that it lets you get in it and will save the location as a spawn point but the time will not advance to morning when "waking" and the weather will not reset. i attempted to use the event playerWakeInBed to force the update, but it immediately got set back to night, i assumed because the event is being called client side and instantly overridden by the server.

  16. turns out I can't do anything until i recreate the model. the 1.7.10 model was a java file and made use of child boxes and various different angles. the default json format does not support rotations that are not multiples of 22.5 and subsequently modellers such as crayfish's  and BDcraft Cubik do not support non-22.5 rotations. ive also seen no indication of child boxes in the json format, so i'm not sure how i'm going to resolve the animation question. the item animations are akin to those of an entity with a multi-box tail. can this still be done?

  17. i'm picking my way through the https://github.com/MinecraftForge/MinecraftForge/blob/4feb1dff50bb156141be3d6f47b1976021ee29d3/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java, determining which bits I need and whats a product of the test mod being done in a single file.

     

    the abstract class at line 76 doesnt seem to be anything I will need, however, at the end, line 166 I'm less clear on. Related: Line 169 is a class for the serverproxy which I don't think I have in my mod. where should the method here, related to line 166, go?

     

    Line 177 is the client proxy where much registering of blocks and things takes place, as well as a renderer for the block. I'm not sure what I'm going to need from this for my weapon; what can go and what needs to be adjusted.

     

    Line 236 is a class related to the animation of the block. I assume I'll need this, modified, for my custom weapon.

     

    The last two classes are the the tile and entityliving classes for the block, which I guess can go. I just need the relevant lines that set the animation and so on put into the item class.

×
×
  • Create New...

Important Information

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