-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add frostology illagers to pillager friendly origin * use tags for custom frost resistance materials * remove and deprecate item attribute modifiers * frostology cloak attributes * better method for warm foods tag no longer hooking directly into farmers delight code * reformat packed snow block class a bit * packed snow decay to snow * polar bear brushable * ocelot brushing * wolf brushing, anger on brush closes #63 * brushed polar bear texture Closes #63 * bump version * Revert "bump version" This reverts commit 6a5145e. * remove shearing damage config; fix template chance config * add ad astra armor to fur armor tag
- Loading branch information
1 parent
1da285e
commit a6287f7
Showing
58 changed files
with
631 additions
and
735 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/com/github/thedeathlycow/frostiful/client/BrushableTextures.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.github.thedeathlycow.frostiful.client; | ||
|
||
import com.github.thedeathlycow.frostiful.Frostiful; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.util.Identifier; | ||
|
||
@Environment(EnvType.CLIENT) | ||
public class BrushableTextures { | ||
|
||
public static final Identifier POLAR_BEAR = Frostiful.id("textures/entity/bear/polar_bear_brushed.png"); | ||
|
||
private BrushableTextures() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/com/github/thedeathlycow/frostiful/entity/FBrushable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.github.thedeathlycow.frostiful.entity; | ||
|
||
import com.github.thedeathlycow.frostiful.Frostiful; | ||
import com.github.thedeathlycow.frostiful.registry.FComponents; | ||
import com.github.thedeathlycow.frostiful.util.FLootHelper; | ||
import net.minecraft.entity.passive.AnimalEntity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.sound.SoundCategory; | ||
import net.minecraft.sound.SoundEvents; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.world.World; | ||
|
||
public interface FBrushable { | ||
|
||
int BRUSH_COOLDOWN = 20 * 300; | ||
Identifier POLAR_BEAR_BRUSHING_LOOT_TABLE = Frostiful.id("gameplay/polar_bear_brushing"); | ||
Identifier OCELOT_BRUSHING_LOOT_TABLE = Frostiful.id("gameplay/ocelot_brushing"); | ||
Identifier WOLF_BRUSHING_LOOT_TABLE = Frostiful.id("gameplay/wolf_brushing"); | ||
|
||
void frostiful$brush(PlayerEntity source, SoundCategory shearedSoundCategory); | ||
|
||
boolean frostiful$isBrushable(); | ||
|
||
boolean frostiful$wasBrushed(); | ||
|
||
static void brushEntity( | ||
AnimalEntity animalEntity, | ||
SoundCategory shearedSoundCategory, | ||
Identifier furLootTable | ||
) { | ||
World world = animalEntity.getWorld(); | ||
world.playSoundFromEntity( | ||
null, | ||
animalEntity, | ||
SoundEvents.ITEM_BRUSH_BRUSHING_GENERIC, | ||
shearedSoundCategory, | ||
1.0f, 1.0f | ||
); | ||
|
||
if (!world.isClient) { | ||
FLootHelper.dropLootFromEntity(animalEntity, furLootTable); | ||
} | ||
|
||
FComponents.BRUSHABLE_COMPONENT.get(animalEntity).setLastBrushTime(world.getTime()); | ||
} | ||
|
||
} |
18 changes: 0 additions & 18 deletions
18
src/main/java/com/github/thedeathlycow/frostiful/entity/FShearable.java
This file was deleted.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
src/main/java/com/github/thedeathlycow/frostiful/entity/component/BrushableComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.github.thedeathlycow.frostiful.entity.component; | ||
|
||
import com.github.thedeathlycow.frostiful.entity.FBrushable; | ||
import com.github.thedeathlycow.frostiful.registry.FComponents; | ||
import dev.onyxstudios.cca.api.v3.component.Component; | ||
import dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent; | ||
import net.minecraft.entity.passive.AnimalEntity; | ||
import net.minecraft.nbt.NbtCompound; | ||
import net.minecraft.nbt.NbtElement; | ||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
|
||
public class BrushableComponent implements Component, AutoSyncedComponent { | ||
|
||
private static final String LAST_BRUSHED_TIME_KEY = "last_brushed_time"; | ||
|
||
private long lastBrushTime = -1; | ||
|
||
private final AnimalEntity provider; | ||
private final FBrushable brushable; | ||
|
||
public BrushableComponent(AnimalEntity provider) { | ||
this.provider = provider; | ||
this.brushable = (FBrushable) provider; | ||
} | ||
|
||
@Override | ||
public void writeSyncPacket(PacketByteBuf buf, ServerPlayerEntity recipient) { | ||
buf.writeLong(this.lastBrushTime); | ||
} | ||
|
||
@Override | ||
public void applySyncPacket(PacketByteBuf buf) { | ||
this.lastBrushTime = buf.readLong(); | ||
} | ||
|
||
@Override | ||
public void readFromNbt(NbtCompound tag) { | ||
if (tag.contains(LAST_BRUSHED_TIME_KEY, NbtElement.LONG_TYPE)) { | ||
this.lastBrushTime = tag.getLong(LAST_BRUSHED_TIME_KEY); | ||
} | ||
} | ||
|
||
@Override | ||
public void writeToNbt(NbtCompound tag) { | ||
if (brushable.frostiful$wasBrushed()) { | ||
tag.putLong(LAST_BRUSHED_TIME_KEY, lastBrushTime); | ||
} | ||
} | ||
|
||
public long getLastBrushTime() { | ||
return lastBrushTime; | ||
} | ||
|
||
public void setLastBrushTime(long lastBrushTime) { | ||
if (this.lastBrushTime != lastBrushTime) { | ||
this.lastBrushTime = lastBrushTime; | ||
FComponents.BRUSHABLE_COMPONENT.sync(this.provider); | ||
} | ||
} | ||
|
||
public boolean isBrushable() { | ||
return this.provider.isAlive() | ||
&& !this.provider.isBaby() | ||
&& !this.wasBrushed(); | ||
} | ||
|
||
public boolean wasBrushed() { | ||
return lastBrushTime >= 0L | ||
&& this.provider.getWorld().getTimeOfDay() - lastBrushTime <= FBrushable.BRUSH_COOLDOWN; | ||
} | ||
} |
Oops, something went wrong.