Skip to content

Commit

Permalink
Finish drop matching
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmeow committed Jan 2, 2019
1 parent ef2fe74 commit 4f4c805
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 7 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
- Foxes will not bark
- Fixed bug where HOF recipe was stuck on last oredict for stone
- The wearable Hirschgeist skull can now be repaired with bones and antlers
- Breaking and replacing wolf, deer, or reindeer skull will no longer pick a new variant, but instead persists through the item
- Wolves, deer, and reindeer will drop heads that match their skins
- Drop rate of heads greatly reduced

4.0.1
-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos
if(te != null && te instanceof TileEntityHead) {
TileEntityHead teH = (TileEntityHead) te;
stack.setTagCompound(new NBTTagCompound());
System.out.println(teH.typeValue());
stack.getTagCompound().setInteger("TYPENUM", teH.typeValue());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ protected SoundEvent getAmbientSound()

@Override
public void onDeath(DamageSource cause) {
if(cause.getTrueSource() instanceof EntityPlayer && !this.isChild()) {
if(this.rand.nextInt(15) == 0) {
if(!this.isChild()) {
if(this.rand.nextInt(12) == 0) {
ItemStack stack = new ItemStack(BlockRegistry.wolfhead.getItemBlock());
stack.setTagCompound(new NBTTagCompound());
stack.getTagCompound().setInteger("TYPENUM", 4); // 4 is the coyote value for wolfheads
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ protected void applyEntityAttributes()

@Override
public void onDeath(DamageSource cause) {
if(cause.getTrueSource() instanceof EntityPlayer && !this.isChild()) {
if(this.rand.nextInt(15) == 0) {
if(!this.isChild()) {
if(this.rand.nextInt(12) == 0) {
ItemStack stack = new ItemStack(BlockRegistry.deerhead.getItemBlock());
stack.setTagCompound(new NBTTagCompound());
stack.getTagCompound().setInteger("TYPENUM", this.getTypeNumber());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ public boolean apply(@Nullable Entity p_apply_1_)

@Override
public void onDeath(DamageSource cause) {
if(cause.getTrueSource() instanceof EntityPlayer && !this.isChild()) {
if(this.rand.nextInt(15) == 0) {
if(!this.isChild()) {
if(this.rand.nextInt(12) == 0) {
ItemStack stack = new ItemStack(BlockRegistry.wolfhead.getItemBlock());
stack.setTagCompound(new NBTTagCompound());
stack.getTagCompound().setInteger("TYPENUM", this.getTypeNumber());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.google.common.base.Optional;
import com.google.common.base.Predicate;

import its_meow.betteranimalsplus.init.BlockRegistry;
import its_meow.betteranimalsplus.init.LootTableRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
Expand Down Expand Up @@ -606,6 +607,18 @@ else if (item == Items.GOLDEN_APPLE)
return flag;
}

@Override
public void onDeath(DamageSource cause) {
if(!this.isChild()) {
if(this.rand.nextInt(12) == 0) {
ItemStack stack = new ItemStack(BlockRegistry.reindeerhead.getItemBlock());
stack.setTagCompound(new NBTTagCompound());
stack.getTagCompound().setInteger("TYPENUM", this.getTypeNumber());
this.entityDropItem(stack, 0.5F);
}
}
}

@Override
@Nullable
protected ResourceLocation getLootTable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,34 @@
import its_meow.betteranimalsplus.client.model.ModelReindeerHead;
import its_meow.betteranimalsplus.init.TextureRegistry;
import net.minecraft.client.model.ModelBase;
import net.minecraft.util.ResourceLocation;

public class TileEntityReindeerHead extends TileEntityHead {

public TileEntityReindeerHead() {
super(ModelReindeerHead.class.asSubclass(ModelBase.class), TextureRegistry.reindeer_1, TextureRegistry.reindeer_2, TextureRegistry.reindeer_3, TextureRegistry.reindeer_4);
}

public ResourceLocation getTexture() {
if(typeNum <= 4) {
return textures.get(typeNum);
} else {
return getEntityTexture(typeNum);
}
}

protected static ResourceLocation getEntityTexture(int type) {
switch(type) {
case 1: return TextureRegistry.reindeer_1;
case 2: return TextureRegistry.reindeer_2;
case 3: return TextureRegistry.reindeer_3;
case 4: return TextureRegistry.reindeer_4;
case 5: return TextureRegistry.reindeer_1_christmas;
case 6: return TextureRegistry.reindeer_2_christmas;
case 7: return TextureRegistry.reindeer_3_christmas;
case 8: return TextureRegistry.reindeer_4_christmas;
default: return TextureRegistry.reindeer_1;
}
}

}

0 comments on commit 4f4c805

Please sign in to comment.