Skip to content

Commit

Permalink
格式化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
TartaricAcid committed Nov 11, 2023
1 parent 7e6ecd8 commit 201038a
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ public class ConditionArmor {
private final Map<EquipmentSlot, List<ResourceLocation>> idTest = Maps.newHashMap();
private final Map<EquipmentSlot, List<TagKey<Item>>> tagTest = Maps.newHashMap();

@Nullable
public static EquipmentSlot getType(String type) {
for (EquipmentSlot equipmentslot : EquipmentSlot.values()) {
if (equipmentslot.getName().equals(type)) {
return equipmentslot;
}
}
return null;
}

public void addTest(String name) {
Matcher matcherId = ID_PRE_REG.matcher(name);
if (matcherId.find()) {
Expand Down Expand Up @@ -114,15 +124,4 @@ private String doTagTest(EntityMaid maid, EquipmentSlot slot) {
}
return tagListTest.stream().filter(item::is).findFirst().map(itemTagKey -> slot.getName() + "#" + itemTagKey.location()).orElse(EMPTY);
}


@Nullable
public static EquipmentSlot getType(String type) {
for (EquipmentSlot equipmentslot : EquipmentSlot.values()) {
if (equipmentslot.getName().equals(type)) {
return equipmentslot;
}
}
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.github.tartaricacid.touhoulittlemaid.client.event;

import com.github.tartaricacid.touhoulittlemaid.TouhouLittleMaid;
import com.github.tartaricacid.touhoulittlemaid.client.sound.data.MaidSoundInstance;
import com.github.tartaricacid.touhoulittlemaid.config.subconfig.InGameMaidConfig;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.sound.PlaySoundEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.vehicle.Minecart;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
import java.util.function.Consumer;

public class ChatBubbleRenderer {
private static final List<Pair<Long, ChatText>> TMP_CHAT_BUBBLES = Lists.newArrayList();
protected static final RenderStateShard.TransparencyStateShard NO_TRANSPARENCY = new RenderStateShard.TransparencyStateShard("no_transparency", RenderSystem::disableBlend, () -> {
});
private static final List<Pair<Long, ChatText>> TMP_CHAT_BUBBLES = Lists.newArrayList();
private static final String LEFT_ARROW = "left_arrow";
private static final String MIDDLE_ARROW = "middle_arrow";
private static final String RIGHT_ARROW = "right_arrow";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ public void render(Entity entity, float entityYaw, float partialTick, PoseStack
}
}

public void setMainInfo(ChairModelInfo mainInfo) {
this.mainInfo = mainInfo;
}

public ChairModelInfo getMainInfo() {
return mainInfo;
}

public void setMainInfo(ChairModelInfo mainInfo) {
this.mainInfo = mainInfo;
}

@Override
public float getHeightScale(Object entity) {
return mainInfo.getRenderEntityScale();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ public void render(Entity entity, float entityYaw, float partialTick, PoseStack
}
}

public void setMainInfo(MaidModelInfo mainInfo) {
this.mainInfo = mainInfo;
}

public MaidModelInfo getMainInfo() {
return mainInfo;
}

public void setMainInfo(MaidModelInfo mainInfo) {
this.mainInfo = mainInfo;
}

@Override
public float getHeightScale(Object entity) {
return mainInfo.getRenderEntityScale();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public ReplaceExperienceOrbRenderer(EntityRendererProvider.Context context) {
this.vanillaRender = new ExperienceOrbRenderer(context);
}

private static void vertex(VertexConsumer pConsumer, Matrix4f pMatrix, Matrix3f pMatrixNormal, float pX, float pY, int pRed, int pGreen, int pBlue, float pTexU, float pTexV, int pPackedLight) {
pConsumer.vertex(pMatrix, pX, pY, 0.0F).color(pRed, pGreen, pBlue, 128).uv(pTexU, pTexV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(pPackedLight).normal(pMatrixNormal, 0.0F, 1.0F, 0.0F).endVertex();
}

protected int getBlockLightLevel(ExperienceOrb pEntity, BlockPos pPos) {
return Mth.clamp(super.getBlockLightLevel(pEntity, pPos) + 7, 0, 15);
}
Expand Down Expand Up @@ -66,10 +70,6 @@ private void renderPointItem(ExperienceOrb orb, float pEntityYaw, float partialT
super.render(orb, pEntityYaw, partialTicks, poseStack, buffer, packedLight);
}

private static void vertex(VertexConsumer pConsumer, Matrix4f pMatrix, Matrix3f pMatrixNormal, float pX, float pY, int pRed, int pGreen, int pBlue, float pTexU, float pTexV, int pPackedLight) {
pConsumer.vertex(pMatrix, pX, pY, 0.0F).color(pRed, pGreen, pBlue, 128).uv(pTexU, pTexV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(pPackedLight).normal(pMatrixNormal, 0.0F, 1.0F, 0.0F).endVertex();
}

public ResourceLocation getTextureLocation(ExperienceOrb pEntity) {
return POINT_ITEM_TEXTURE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ public GeckoLayerMaidBackpack(GeckoEntityMaidRenderer entityRendererIn, EntityMo
bigModel = new MaidBackpackBigModel(modelSet.bakeLayer(MaidBackpackBigModel.LAYER));
}

protected static <T extends LivingEntity> void renderColoredCutoutModel(EntityModel<T> pModel, ResourceLocation pTextureLocation, PoseStack pPoseStack, MultiBufferSource pBuffer, int pPackedLight, T pEntity, float pRed, float pGreen, float pBlue) {
VertexConsumer vertexconsumer = pBuffer.getBuffer(RenderType.entityCutoutNoCull(pTextureLocation));
pModel.renderToBuffer(pPoseStack, vertexconsumer, pPackedLight, LivingEntityRenderer.getOverlayCoords(pEntity, 0.0F), pRed, pGreen, pBlue, 1.0F);
}

@Override
public void render(PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn, T livingEntity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
if (livingEntity instanceof EntityMaid maid && this.entityRenderer.getGeoModel() != null) {
Expand Down Expand Up @@ -68,11 +73,6 @@ public void render(PoseStack poseStack, MultiBufferSource bufferIn, int packedLi
}
}

protected static <T extends LivingEntity> void renderColoredCutoutModel(EntityModel<T> pModel, ResourceLocation pTextureLocation, PoseStack pPoseStack, MultiBufferSource pBuffer, int pPackedLight, T pEntity, float pRed, float pGreen, float pBlue) {
VertexConsumer vertexconsumer = pBuffer.getBuffer(RenderType.entityCutoutNoCull(pTextureLocation));
pModel.renderToBuffer(pPoseStack, vertexconsumer, pPackedLight, LivingEntityRenderer.getOverlayCoords(pEntity, 0.0F), pRed, pGreen, pBlue, 1.0F);
}

protected void translateToBackpack(PoseStack poseStack, GeoModel geoModel) {
int size = geoModel.backpackBones.size();
for (int i = 0; i < size - 1; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@

public class MaidTemptGoal extends Goal {
private static final TargetingConditions TEMP_TARGETING = TargetingConditions.forNonCombat().range(10).ignoreLineOfSight();
private final TargetingConditions targetingConditions;
protected final PathfinderMob mob;
private final TargetingConditions targetingConditions;
private final double speedModifier;
private final Ingredient items;
private final boolean canScare;
@Nullable
protected EntityMaid maid;
private double px;
private double py;
private double pz;
@Nullable
protected EntityMaid maid;
private int calmDown;
private boolean isRunning;
private final Ingredient items;
private final boolean canScare;

public MaidTemptGoal(PathfinderMob mob, double speedModifier, Ingredient items, boolean canScare) {
this.mob = mob;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@
import net.minecraft.stats.Stats;
import net.minecraft.tags.TagKey;
import net.minecraft.util.Mth;
import net.minecraft.world.*;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.ai.Brain;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.github.tartaricacid.touhoulittlemaid.geckolib3.core.IAnimatable;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ public EffectData(String descriptionId, int amplifier, int duration, int categor
this.category = category;
}

public static EffectData fromBytes(FriendlyByteBuf buf) {
return new EffectData(buf.readUtf(), buf.readInt(), buf.readInt(), buf.readInt());
}

public void toBytes(FriendlyByteBuf buf) {
buf.writeUtf(this.descriptionId);
buf.writeInt(this.amplifier);
buf.writeInt(this.duration);
buf.writeInt(this.category);
}

public static EffectData fromBytes(FriendlyByteBuf buf) {
return new EffectData(buf.readUtf(), buf.readInt(), buf.readInt(), buf.readInt());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.github.tartaricacid.touhoulittlemaid.inventory.handler.BaubleItemHandler;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
import net.minecraft.world.Containers;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
Expand Down

0 comments on commit 201038a

Please sign in to comment.