Skip to content

Commit

Permalink
Inverted tag changed:organic_latex to changed:latex. Deprecated `…
Browse files Browse the repository at this point in the history
…changed:organic_latex`.
  • Loading branch information
LtxProgrammer committed Sep 16, 2024
1 parent 73c94c9 commit d88ef2e
Show file tree
Hide file tree
Showing 14 changed files with 91 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public static void onChangedVariant(ProcessTransfur.EntityVariantAssigned.Change
return; // Don't do effect if player is creative mode

event.livingEntity.addEffect(new MobEffectInstance(MobEffects.CONFUSION, duration, 1, false, false));
if (event.newVariant.getEntityType().is(ChangedTags.EntityTypes.ORGANIC_LATEX))
if (!event.newVariant.getEntityType().is(ChangedTags.EntityTypes.LATEX))
return; // Only do blindness if variant is goo

event.livingEntity.addEffect(new MobEffectInstance(MobEffects.BLINDNESS, duration, 1, false, false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static void renderBackground(int x, int y, PoseStack stack, AbstractRadia
int cool = selected.canUse() ? (int)(controller.coolDownPercent() * 32) : 0;
int active = cool >= 32 ? (int)(controller.getProgressActive() * 32) : 0;

int gooOrNot = variant.getParent().getEntityType().is(ChangedTags.EntityTypes.ORGANIC_LATEX) ? 32 : 0;
int gooOrNot = variant.getParent().getEntityType().is(ChangedTags.EntityTypes.LATEX) ? 0 : 32;
blit(stack, x, y, gooOrNot, 0, 32, 32, 64, 96); // back
if (cool > 0)
blit(stack, x, y + (32 - cool), gooOrNot, 32 + (32 - cool), 32, cool, 64, 96); // ready
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import net.ltxprogrammer.changed.init.ChangedAbilities;
import net.ltxprogrammer.changed.network.VariantAbilityActivate;
import net.ltxprogrammer.changed.util.SingleRunnable;
import net.ltxprogrammer.changed.util.UniversalDist;
import net.ltxprogrammer.changed.world.inventory.AbilityRadialMenu;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.client.gui.screens.inventory.InventoryScreen;
Expand All @@ -20,7 +19,7 @@
import java.util.List;
import java.util.stream.Collectors;

public class AbilityRadialScreen extends LatexAbilityRadialScreen<AbilityRadialMenu> {
public class AbilityRadialScreen extends VariantRadialScreen<AbilityRadialMenu> {
public final AbilityRadialMenu menu;
public final TransfurVariantInstance<?> variant;
public final List<AbstractAbility<?>> abilities;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import java.util.List;

public class HairStyleRadialScreen extends LatexAbilityRadialScreen<HairStyleRadialMenu> {
public class HairStyleRadialScreen extends VariantRadialScreen<HairStyleRadialMenu> {
public final HairStyleRadialMenu menu;
public final TransfurVariantInstance<?> variant;
public final List<HairStyle> styles;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import java.util.ArrayList;
import java.util.List;

public class SpecialStateRadialScreen extends LatexAbilityRadialScreen<SpecialStateRadialMenu> {
public class SpecialStateRadialScreen extends VariantRadialScreen<SpecialStateRadialMenu> {
public final SpecialStateRadialMenu menu;
public final SpecialLatex special;
public final List<String> states;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

import javax.annotation.Nullable;

public abstract class LatexAbilityRadialScreen<T extends AbstractContainerMenu> extends AbstractRadialScreen<T> {
public LatexAbilityRadialScreen(T menu, Inventory inventory, Component text, TransfurVariantInstance<?> variant) {
public abstract class VariantRadialScreen<T extends AbstractContainerMenu> extends AbstractRadialScreen<T> {
public VariantRadialScreen(T menu, Inventory inventory, Component text, TransfurVariantInstance<?> variant) {
super(menu, inventory, text, getColors(variant).setForegroundToBright().background(),
getColors(variant).setForegroundToBright().foreground(), variant.getHost());
}
Expand All @@ -30,10 +30,10 @@ public LatexAbilityRadialScreen(T menu, Inventory inventory, Component text, Tra

protected ResourceLocation getTextureForSection(@Nullable TransfurVariant<?> variant, int section, boolean thisHovered, boolean anyHovered) {
boolean renderSelected = thisHovered || (!anyHovered && this.isSelected(section));
if (variant == null || variant.getEntityType().is(ChangedTags.EntityTypes.ORGANIC_LATEX))
return Changed.modResource((renderSelected ? PATH_ORGANIC_SELECTED : PATH_ORGANIC) + section + ".png");
else
if (variant == null || variant.getEntityType().is(ChangedTags.EntityTypes.LATEX))
return Changed.modResource((renderSelected ? PATH_GOO_SELECTED : PATH_GOO) + section + ".png");
else
return Changed.modResource((renderSelected ? PATH_ORGANIC_SELECTED : PATH_ORGANIC) + section + ".png");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,9 @@ public Builder(Supplier<EntityType<T>> entityType) {
this.entityType = entityType;

var event = new UniversalAbilitiesEvent(this.abilities);
event.addAbility(event.isNotOfTag(ChangedTags.EntityTypes.ORGANIC_LATEX), ChangedAbilities.SWITCH_TRANSFUR_MODE);
event.addAbility(event.isNotOfTag(ChangedTags.EntityTypes.ORGANIC_LATEX)
.and(event.isNotOfTag(ChangedTags.EntityTypes.ARMLESS)), ChangedAbilities.GRAB_ENTITY_ABILITY);
event.addAbility(event.isOfTag(ChangedTags.EntityTypes.LATEX), ChangedAbilities.SWITCH_TRANSFUR_MODE);
event.addAbility(event.isOfTag(ChangedTags.EntityTypes.LATEX)
.and(event.isOfTag(ChangedTags.EntityTypes.ARMLESS)), ChangedAbilities.GRAB_ENTITY_ABILITY);

MinecraftForge.EVENT_BUS.post(event);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ public void tick(Player player) {
final double nearRunSpeed = 1.2D;
// Scare mobs
for (Class<? extends PathfinderMob> entityClass : parent.scares) {
if (entityClass.isAssignableFrom(AbstractVillager.class) && (parent.ctor.get().is(ChangedTags.EntityTypes.ORGANIC_LATEX) || player.isCreative() || player.isSpectator()))
if (entityClass.isAssignableFrom(AbstractVillager.class) && (!parent.ctor.get().is(ChangedTags.EntityTypes.LATEX) || player.isCreative() || player.isSpectator()))
continue;

final double speedScale = entityClass.isAssignableFrom(AbstractVillager.class) ? 0.5D : 1.0D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
public class ChangedTags {
public static class EntityTypes {
public static final TagKey<EntityType<?>> HUMANOIDS = create("humanoids");
public static final TagKey<EntityType<?>> ORGANIC_LATEX = create("organic_latex");
public static final TagKey<EntityType<?>> LATEX = create("latex");
@Deprecated public static final TagKey<EntityType<?>> ORGANIC_LATEX = create("organic_latex");
public static final TagKey<EntityType<?>> PALE_SMALL_EXPOSURE = create("pale_small_exposure");
public static final TagKey<EntityType<?>> PALE_LARGE_EXPOSURE = create("pale_large_exposure");
public static final TagKey<EntityType<?>> WHITE_LATEX_SWIMMING = create("white_latex_swimming");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
public abstract class VillagerHostilesSensorMixin {
@Inject(method = "isClose", at = @At("HEAD"), cancellable = true)
private void isClose(LivingEntity villager, LivingEntity hostile, CallbackInfoReturnable<Boolean> callback) {
if (hostile instanceof ChangedEntity latex && !latex.getType().is(ChangedTags.EntityTypes.ORGANIC_LATEX)) {
if (hostile instanceof ChangedEntity latex && latex.getType().is(ChangedTags.EntityTypes.LATEX)) {
callback.setReturnValue(latex.distanceToSqr(villager) <= 64.0);
}
}

@Inject(method = "isHostile", at = @At("HEAD"), cancellable = true)
private void isHostile(LivingEntity hostile, CallbackInfoReturnable<Boolean> callback) {
if (hostile instanceof ChangedEntity latex && !latex.getType().is(ChangedTags.EntityTypes.ORGANIC_LATEX))
if (hostile instanceof ChangedEntity latex && latex.getType().is(ChangedTags.EntityTypes.LATEX))
callback.setReturnValue(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public WanderingTraderMixin(EntityType<? extends AbstractVillager> p_35267_, Lev

@Inject(method = "registerGoals", at = @At("RETURN"))
public void registerGoals(CallbackInfo callback) {
this.goalSelector.addGoal(1, new AvoidEntityGoal<>(this, ChangedEntity.class, latex -> !latex.getType().is(ChangedTags.EntityTypes.ORGANIC_LATEX),
this.goalSelector.addGoal(1, new AvoidEntityGoal<>(this, ChangedEntity.class, latex -> latex.getType().is(ChangedTags.EntityTypes.LATEX),
8.0F, 0.5D, 0.5D, EntitySelector.NO_CREATIVE_OR_SPECTATOR::test));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.mojang.blaze3d.vertex.PoseStack;
import net.ltxprogrammer.changed.Changed;
import net.ltxprogrammer.changed.client.gui.AbstractRadialScreen;
import net.ltxprogrammer.changed.client.gui.LatexAbilityRadialScreen;
import net.ltxprogrammer.changed.client.gui.VariantRadialScreen;
import net.ltxprogrammer.changed.process.ProcessTransfur;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
Expand Down Expand Up @@ -59,7 +59,7 @@ private void renderHeart(PoseStack pose, Gui.HeartType type, int x, int y, int t
if (ProcessTransfur.isPlayerNotLatex(player))
return;
ProcessTransfur.ifPlayerTransfurred(player, variant -> {
var colors = LatexAbilityRadialScreen.getColors(variant);
var colors = VariantRadialScreen.getColors(variant);
var color = type == Gui.HeartType.NORMAL ? colors.background() : colors.foreground();
RenderSystem.setShaderTexture(0, GUI_LATEX_HEARTS);
RenderSystem.setShaderColor(color.red(), color.green(), color.blue(), 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,12 @@ public static boolean ifPlayerTransfurred(Player player, BiConsumer<Player, Tran
// Checks if player is either not latex or is organic latex
public static boolean isPlayerNotLatex(Player player) {
var variant = getPlayerTransfurVariant(player);
return variant == null || variant.getParent().getEntityType().is(ChangedTags.EntityTypes.ORGANIC_LATEX);
return variant == null || !variant.getParent().getEntityType().is(ChangedTags.EntityTypes.LATEX);
}

public static boolean isPlayerLatex(Player player) {
var variant = getPlayerTransfurVariant(player);
return variant != null && !variant.getParent().getEntityType().is(ChangedTags.EntityTypes.ORGANIC_LATEX);
return variant != null && variant.getParent().getEntityType().is(ChangedTags.EntityTypes.LATEX);
}

public static Optional<TransfurVariant<?>> getEntityVariant(LivingEntity livingEntity) {
Expand Down Expand Up @@ -489,11 +489,11 @@ private static boolean isNonGoo(LivingEntity entity) {
if (latex instanceof SpecialLatex specialLatex)
return specialLatex.getCurrentData() != null && specialLatex.getCurrentData().organic();
else
return entity.getType().is(ChangedTags.EntityTypes.ORGANIC_LATEX);
return !entity.getType().is(ChangedTags.EntityTypes.LATEX);
}

else return ifPlayerTransfurred(EntityUtil.playerOrNull(entity), variant -> {
if (variant.getParent().getEntityType().is(ChangedTags.EntityTypes.ORGANIC_LATEX))
if (!variant.getParent().getEntityType().is(ChangedTags.EntityTypes.LATEX))
return true;
else if (variant.getChangedEntity() instanceof SpecialLatex special &&
special.getCurrentData() != null && special.getCurrentData().organic())
Expand Down
66 changes: 66 additions & 0 deletions src/main/resources/data/changed/tags/entity_types/latexes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"replace": false,
"values": [
"changed:white_latex_wolf_female",
"changed:white_latex_wolf_male",
"changed:white_latex_knight",
"changed:white_latex_centaur",
"changed:headless_knight",
"changed:white_latex_knight_fusion",
"changed:latex_deer",
"changed:latex_bee",
"changed:latex_pink_deer",
"changed:latex_keon_wolf",
"changed:dark_latex_wolf_male",
"changed:dark_latex_wolf_female",
"changed:dark_latex_wolf_partial",
"changed:dark_latex_wolf_pup",
"changed:dark_latex_yufeng",
"changed:latex_benign_wolf",
"changed:latex_blue_dragon",
"changed:latex_blue_wolf",
"changed:latex_crocodile",
"changed:latex_fennec_fox",
"changed:latex_human",
"changed:latex_hypno_cat",
"changed:latex_leaf",
"changed:latex_squirrel",
"changed:latex_manta_ray_female",
"changed:latex_manta_ray_male",
"changed:latex_medusa_cat",
"changed:latex_mermaid_shark",
"changed:latex_moth",
"changed:latex_mutant_bloodcell_wolf",
"changed:latex_siren",
"changed:latex_snake",
"changed:latex_mimic_plant",
"changed:latex_pink_wyvern",
"changed:latex_pink_yuin_dragon",
"changed:latex_purple_fox",
"changed:latex_raccoon",
"changed:latex_red_dragon",
"changed:latex_red_panda",
"changed:latex_shark",
"changed:latex_shark_male",
"changed:latex_shark_female",
"changed:latex_alien",
"changed:latex_snow_leopard_male",
"changed:latex_snow_leopard_female",
"changed:latex_squid_dog_female",
"changed:latex_squid_dog_male",
"changed:latex_stiger",
"changed:latex_tiger_shark",
"changed:latex_traffic_cone_dragon",
"changed:latex_translucent_lizard",
"changed:latex_orca",
"changed:latex_otter",
"changed:latex_watermelon_cat",
"changed:latex_white_tiger",
"changed:latex_yuin",
"changed:milk_pudding",
"changed:shark",
"changed:pure_white_latex_wolf",
"changed:phage_latex_wolf_female",
"changed:phage_latex_wolf_male"
]
}

0 comments on commit d88ef2e

Please sign in to comment.