Skip to content

Commit

Permalink
Checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
paulyhedral committed Jan 20, 2024
1 parent 126cd6f commit 33fe803
Show file tree
Hide file tree
Showing 201 changed files with 2,268 additions and 2,790 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ logs
forge*changelog.txt
.DS_Store
src/generated/resources/.cache/
old-src/
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public ResourceLocation getTexture() {

@Override
public Component getTooltip() {
return Component.translatable("cattree.color.missing", "//TODO");
return Component.translatable("cattree.color.missing");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public ResourceLocation getTexture() {

@Override
public Component getTooltip() {
return Component.translatable("cattree.dye.missing", "//TODO");
return Component.translatable("cattree.dye.missing");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public ResourceLocation getTexture() {

@Override
public Component getTooltip() {
return Component.translatable("structure.missing", "//TODO");
return Component.translatable("structure.missing");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
import net.minecraft.world.entity.TamableAnimal;
import net.minecraft.world.entity.ai.control.MoveControl;
import net.minecraft.world.entity.ai.navigation.PathNavigation;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
Expand Down Expand Up @@ -97,4 +99,49 @@ public Component getGenderTip() {
public Component getGenderName() {
return this.getTranslationKey(Gender::getUnlocalizedName);
}

public void setNavigation(PathNavigation p) {
if (this.navigation == p) return;
this.navigation.stop();
this.navigation = p;
}

//TODO try to replicate the bug and check if moveControl.haveWantedPosition using debug magic
public void setMoveControl(MoveControl m) {
breakMoveControl();

this.moveControl = m;
}

public void breakMoveControl() {
/*
* Force the MoveControl To Reset :
* this will set the dog's wanted Position to his current Position
* which will cause the moveControl to halt movement and reset in the
* next tick().
* And then immediately update the moveControl by calling tick() so
* that everything is resolved before anything else.
*/
this.moveControl.setWantedPosition(
this.getX(),
this.getY(),
this.getZ(), 1.0
);
this.moveControl.tick();

//Also reset jump just to be sure.
this.setJumping(false);

//Also reset accelerations just to be sure.
this.setSpeed(0.0F);
this.setXxa(0.0F);
this.setYya(0.0F);
this.setZza(0.0F);
}

public abstract void resetNavigation();

public abstract void resetMoveControl();

public abstract boolean canSwimUnderwater();
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import net.minecraft.world.level.Level;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidType;

public interface ICatAlteration {

Expand Down Expand Up @@ -69,7 +70,7 @@ default InteractionResult processInteract(AbstractCatEntity catIn, Level worldIn
return InteractionResult.PASS;
}

default InteractionResult canBeRiddenInWater(AbstractCatEntity catIn, Entity rider) {
default InteractionResult canBeRiddenInWater(AbstractCatEntity catIn) {
return InteractionResult.PASS;
}

Expand Down Expand Up @@ -162,6 +163,18 @@ default InteractionResult onLivingFall(AbstractCatEntity catIn, float distance,
return InteractionResult.PASS;
}

default InteractionResult isBlockSafe(BlockState blockIn) {
return InteractionResult.PASS;
}

default InteractionResult canSwimUnderwater(AbstractCatEntity catIn) {
return InteractionResult.PASS;
}

default InteractionResult canResistPushFromFluidType(FluidType type) {
return InteractionResult.PASS;
}

default <T> LazyOptional<T> getCapability(AbstractCatEntity catIn, Capability<T> cap, Direction side) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public <T extends Accessory> boolean of(T accessoryIn) {
return this.of(accessoryIn);
}

public <T> boolean of(T accessoryDelegateIn) {
return accessoryDelegateIn.equals(this);
}

private ResourceLocation modelTexture;

public <T extends Accessory> T setModelTexture(ResourceLocation modelTextureIn) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ public class AccessoryInstance {
public static final Comparator<AccessoryInstance> RENDER_SORTER = Comparator.comparing(AccessoryInstance::getRenderIndex);

@Deprecated // Do not call directly use AccessoryInstance#getAccessory
private final Accessory accessoryDelegate;
private final Accessory accessory;

public AccessoryInstance(Accessory typeIn) {
this.accessoryDelegate = typeIn;
this.accessory = typeIn;
}

public Accessory getAccessory() {
return this.accessoryDelegate;
return this.accessory;
}

public <T extends Accessory> boolean of(Supplier<T> accessoryIn) {
return this.accessoryDelegate.of(accessoryIn);
return this.accessory.of(accessoryIn);
}

public <T extends Accessory> boolean of(T accessoryIn) {
return this.accessoryDelegate.of(accessoryIn);
return this.accessory.of(accessoryIn);
}

public <T extends AccessoryType> boolean ofType(Supplier<T> accessoryTypeIn) {
Expand All @@ -44,12 +44,12 @@ public <T extends AccessoryType> boolean ofType(T accessoryTypeIn) {
return this.ofType(accessoryTypeIn);
}

public <T extends AccessoryType> boolean ofType(ResourceLocation accessoryTypeDelegateIn) {
return CatHerderAPI.ACCESSORY_TYPE.get().getKey(this.accessoryDelegate.getType()).equals(accessoryTypeDelegateIn);
public <T> boolean ofType(T accessoryTypeDelegateIn) {
return accessoryTypeDelegateIn.equals(this.accessory.getType());
}

public AccessoryInstance copy() {
return new AccessoryInstance(this.accessoryDelegate);
return new AccessoryInstance(this.accessory);
}

public ItemStack getReturnItem() {
Expand All @@ -61,7 +61,7 @@ public byte getRenderIndex() {
}

public final void writeInstance(CompoundTag compound) {
ResourceLocation rl = CatHerderAPI.ACCESSORIES.get().getKey(this.accessoryDelegate);
ResourceLocation rl = CatHerderAPI.ACCESSORIES.get().getKey(this.getAccessory());
if (rl != null) {
compound.putString("type", rl.toString());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.sweetrpg.catherder.api.registry;

import javax.annotation.Nullable;

import com.sweetrpg.catherder.api.CatHerderAPI;
import net.minecraft.Util;

import javax.annotation.Nullable;

public class AccessoryType {

@Nullable
Expand All @@ -15,7 +15,7 @@ public int numberToPutOn() {
}

public String getTranslationKey() {
if (this.translationKey == null) {
if(this.translationKey == null) {
this.translationKey = Util.makeDescriptionId("accessory_type", CatHerderAPI.ACCESSORY_TYPE.get().getKey(this));
}
return this.translationKey;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.sweetrpg.catherder.api.registry;

import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.crafting.Ingredient;

public abstract class IColorMaterial {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,25 @@

public class TalentInstance implements ICatAlteration {

protected final Talent talentDelegate;
protected final Talent talent;

protected int level;

// public TalentInstance(Talent talentIn, int levelIn) {
// this(talentIn, levelIn);
// }

public TalentInstance(Talent talentIn) {
this(talentIn, 1);
}

public TalentInstance(Talent talentDelegateIn, int levelIn) {
this.talentDelegate = talentDelegateIn;
public TalentInstance(Talent talent, int levelIn) {
this.talent = talent;
this.level = levelIn;
}

public Talent getTalent() {
return this.talentDelegate;
return this.talent;
}

public final int level() {
Expand All @@ -45,8 +49,12 @@ public boolean of(Talent talentIn) {
return this.of(talentIn);
}

// public boolean of(IRegistryDelegate<Talent> talentDelegateIn) {
// return talentDelegateIn.equals(this.talentDelegate);
// }

public TalentInstance copy() {
return this.talentDelegate.getDefault(this.level);
return this.talent.getDefault(this.level);
}

public void writeToNBT(AbstractCatEntity catIn, CompoundTag compound) {
Expand All @@ -66,7 +74,7 @@ public void readFromBuf(FriendlyByteBuf buf) {
}

public final void writeInstance(AbstractCatEntity catIn, CompoundTag compound) {
ResourceLocation rl = CatHerderAPI.TALENTS.get().getKey(this.talentDelegate);
ResourceLocation rl = CatHerderAPI.TALENTS.get().getKey(this.talent);
if (rl != null) {
compound.putString("type", rl.toString());
}
Expand Down Expand Up @@ -97,7 +105,7 @@ public <T extends TalentInstance> T cast(Class<T> type) {

@Override
public String toString() {
return String.format("%s [talent: %s, level: %d]", this.getClass().getSimpleName(), CatHerderAPI.TALENTS.get().getKey(talentDelegate), this.level);
return String.format("%s [talent: %s, level: %d]", this.getClass().getSimpleName(), talent, this.level);
}

/**
Expand Down
Loading

0 comments on commit 33fe803

Please sign in to comment.