Colorful Spawning Sheep

模组

· 作者 poopiedoopie9002

此模组允许所有 16 种羊毛颜色的羊以相同的概率生成。

4 本站下载 0 关注 更新于 2 年前

最新 1.0 · 1.2.3 · ModLoader

一键开服(送7天)

彩色生成绵羊!Beta 1.7.3

不同颜色的生成概率完全均等。没有任何稀有度设定,绵羊会随机生成所有羊毛颜色!

本模组对 EntitySheep 类进行了非常简单的修改。直接查看下方的折叠代码块中的源码。

无需加载器,但我必须选择一个 API。

显示内容

基础函数

	public static int getRandomFleeceColor(Random random0) {
		int i1 = random0.nextInt(100);
		return i1 < 5 ? 15 : (i1 < 10 ? 7 : (i1 < 15 ? 8 : (i1 < 18 ? 12 : (random0.nextInt(500) == 0 ? 6 : 0))));
	}

为本模组修改后

	public static int getRandomFleeceColor(Random random0) {
		int i1 = random0.nextInt(100);
		return i1;
	}

以下是关于两个不同版本“普通掉落”和“双倍掉落”的额外信息。 普通掉落意味着当你剪羊毛时,你会获得正常的羊毛数量,即 2-5 个。 双倍掉落会在你剪羊毛时给予你 4-10 个羊毛。直接查看下方的折叠代码块中的源码。

显示内容

普通掉落

	public boolean interact(EntityPlayer entityPlayer1) {
		ItemStack itemStack2 = entityPlayer1.inventory.getCurrentItem();
		if(itemStack2 != null && itemStack2.itemID == Item.shears.shiftedIndex && !this.getSheared()) {
			if(!this.worldObj.multiplayerWorld) {
				this.setSheared(true);
				int i3 = 2 + this.rand.nextInt(3);

				for(int i4 = 0; i4 < i3; ++i4) {
					EntityItem entityItem5 = this.entityDropItem(new ItemStack(Block.cloth.blockID, 1, this.getFleeceColor()), 1.0F);
					entityItem5.motionY += (double)(this.rand.nextFloat() * 0.05F);
					entityItem5.motionX += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F);
					entityItem5.motionZ += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F);
				}
			}

			itemStack2.damageItem(1, entityPlayer1);
		}

		return false;
	}

双倍掉落

	public boolean interact(EntityPlayer entityPlayer1) {
		ItemStack itemStack2 = entityPlayer1.inventory.getCurrentItem();
		if(itemStack2 != null && itemStack2.itemID == Item.shears.shiftedIndex && !this.getSheared()) {
			if(!this.worldObj.multiplayerWorld) {
				this.setSheared(true);
				int i3 = 4 + this.rand.nextInt(6);

				for(int i4 = 0; i4 < i3; ++i4) {
					EntityItem entityItem5 = this.entityDropItem(new ItemStack(Block.cloth.blockID, 1, this.getFleeceColor()), 1.0F);
					entityItem5.motionY += (double)(this.rand.nextFloat() * 0.05F);
					entityItem5.motionX += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F);
					entityItem5.motionZ += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F);
				}
			}

			itemStack2.damageItem(1, entityPlayer1);
		}

		return false;
	}

特别关注这些行

				int i3 = 2 + this.rand.nextInt(3);
				int i3 = 4 + this.rand.nextInt(6);

2 或 4 是你从绵羊身上必定获得的羊毛数量,而 'this.rand.nextInt(3);' 或 6 会在已有的 2 或 4 的基础上额外给予 0 到 3 或 0 到 6 的羊毛。这两部分是同时发生的,但我正在尝试解释这个函数 :)

编辑:2024年4月7日 无更改,但我添加了对 b1.2-b1.8.1、r1.0、r1.1、r1.2.4&5 的支持。我很快就会支持 1.2、1.2.1、1.2.2 和 1.2.3。

编辑:2024年4月8日 添加了 1.2.1-3 的支持。我正在考虑添加 1.3-1.20 的支持。我相信这需要一些时间才能实现。

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源