Skip to content

Commit

Permalink
raccoon tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexModGuy committed May 6, 2022
1 parent 3f4a5e2 commit 061279f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ public Item getCarpetItemBeingWorn() {
return Items.AIR;
}


public boolean isFood(ItemStack stack) {
return stack.getItem() == Items.BREAD;
}
Expand All @@ -201,7 +200,14 @@ public InteractionResult mobInteract(Player player, InteractionHand hand) {
Item item = itemstack.getItem();
InteractionResult type = super.mobInteract(player, hand);
boolean owner = this.isTame() && isOwnedBy(player);
if (owner && itemstack.is(ItemTags.CARPETS)) {
if(this.isTame() && !this.getMainHandItem().isEmpty()){
if(!this.level.isClientSide){
this.spawnAtLocation(this.getMainHandItem().copy());
}
this.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.EMPTY);
pickupItemCooldown = 60;
return InteractionResult.SUCCESS;
}else if (owner && itemstack.is(ItemTags.CARPETS)) {
DyeColor color = EntityElephant.getCarpetColor(itemstack);
if (color != this.getColor()) {
if (this.getColor() != null) {
Expand Down Expand Up @@ -240,14 +246,6 @@ public InteractionResult mobInteract(Player player, InteractionHand hand) {
this.usePlayerItem(player, hand, itemstack);
return InteractionResult.SUCCESS;
}
if(owner && !this.getMainHandItem().isEmpty()){
if(!this.level.isClientSide){
this.spawnAtLocation(this.getMainHandItem().copy());
}
this.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.EMPTY);
pickupItemCooldown = 60;
return InteractionResult.SUCCESS;
}
InteractionResult interactionresult = itemstack.interactLivingEntity(player, this, hand);
if (interactionresult != InteractionResult.SUCCESS && type != InteractionResult.SUCCESS && isTame() && isOwnedBy(player) && !isRaccoonFood(itemstack)){
if(!player.isShiftKeyDown()){
Expand Down Expand Up @@ -572,6 +570,10 @@ public boolean shouldLootItem(ItemStack stack) {
return isRaccoonFood(stack);
}

public boolean isHoldingSugar() {
return this.getMainHandItem().is(AMTagRegistry.RACOON_DISSOLVES);
}

class StrollGoal extends MoveThroughVillageGoal {
public StrollGoal(int p_i50726_3_) {
super(EntityRaccoon.this, 1.0D, true, p_i50726_3_, () -> false);
Expand Down Expand Up @@ -678,7 +680,7 @@ public void tick(){
fleeTime = 60 + random.nextInt(60);
raccoon.getNavigation().stop();
lookForWaterBeforeEatingTimer = 120 + random.nextInt(60);
target.hurt(DamageSource.mobAttack(raccoon), target.getHealth() <= 2 ? 0 : 1);
target.hurt(DamageSource.GENERIC, 0);
raccoon.stealCooldown = 24000 + random.nextInt(48000);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ public void tick() {
this.raccoon.playSound(SoundEvents.GENERIC_SWIM, 0.7F, 0.5F + raccoon.getRandom().nextFloat());
}
washTime++;
if(washTime > 100 || raccoon.getMainHandItem().getItem() == Items.SUGAR && washTime > 20){
if(washTime > 100 || raccoon.isHoldingSugar() && washTime > 20){
this.stop();
if(raccoon.getMainHandItem().getItem() != Items.SUGAR){
if(!raccoon.isHoldingSugar()){
raccoon.onEatItem();
}
this.raccoon.postWashItem(raccoon.getMainHandItem());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class AMTagRegistry {
public static final TagKey<Block> GELADA_MONKEY_GRASS = registerBlockTag("gelada_monkey_grass");
public static final TagKey<EntityType<?>> GIANT_SQUID_TARGETS = registerEntityTag("giant_squid_targets");
public static final TagKey<EntityType<?>> MONKEY_TARGET_WITH_DART = registerEntityTag("monkey_target_with_dart");

public static final TagKey<Item> RACOON_DISSOLVES = registerItemTag("raccoon_dissolves");
public static final TagKey<Block> ROADRUNNER_SPAWNS = registerBlockTag("roadrunner_spawns");
public static final TagKey<Block> LOBSTER_SPAWNS = registerBlockTag("lobster_spawns");
public static final TagKey<Block> MIMIC_OCTOPUS_SPAWNS = registerBlockTag("mimic_octopus_spawns");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:sugar"
]
}

0 comments on commit 061279f

Please sign in to comment.