版本:1.18.2-1.4.4-beta

+ 16种混凝土栅栏,通过切石机合成
- 删除了些无用的内容
This commit is contained in:
叁玖领域 2025-03-22 17:28:13 +08:00
parent 49ff4ee7f0
commit eadd6db00d
322 changed files with 1955 additions and 39058 deletions

View File

@ -1,2 +1,3 @@
# 版本1.18.2-1.4.4-beta
A patch was made due to too many flaws in the original author's graphic design.
因为原作者的美工槽点太多,而做的一个补丁。

View File

@ -6,4 +6,4 @@ org.gradle.daemon=false
mod.id = modernlifepatch
mod.group = com.r3944realms.modernlifepatch
mod.author = r3944Realms
mod.version = 1.18.2-1.4.3
mod.version = 1.18.2-1.4.4-beta

File diff suppressed because it is too large Load Diff

View File

@ -1,465 +0,0 @@
package com.dairymoose.entity;
import com.dairymoose.modernlife.core.CustomBlocks;
import com.dairymoose.modernlife.core.ModernLifeCommon;
import com.dairymoose.modernlife.core.ModernLifeNetwork;
import com.dairymoose.modernlife.network.play.client.ServerboundBikeDismountPacket;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Mth;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityDimensions;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.entity.MoverType;
import net.minecraft.world.entity.Pose;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.HorseArmorItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.pathfinder.PathComputationType;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.network.NetworkHooks;
/* loaded from: outputsrg.jar:com/dairymoose/entity/BicycleEntity.class */
public class BicycleEntity extends Entity {
private float velocity;
private float downward_velocity;
public static final float MAX_SPEED = 0.42f;
public static final float MIN_SPEED = 0.05f;
public static final float REVERSE_MAX_SPEED = -0.14f;
public static final int TICKS_PER_JUMP = 6;
public static final float MAX_ANGLE_DELTA = 10.0f;
public static final float SPEED_INCREASE_CONSTANT = 0.0085f;
public float maxSpeedIncrease;
public Vec3 lastPos;
private float jumpStep;
public boolean recentDismount;
public float renderWheelRot;
public Vec3 lastRenderPos;
public long lastRenderTime;
public static final EntityType<BicycleEntity> BICYCLE_ENTITY = EntityType.Builder.of(BicycleEntity::new, MobCategory.MISC).sized(0.6f, 1.01f).clientTrackingRange(10).build(new ResourceLocation("modernlife", "bicycle").toString());
private static final EntityDataAccessor<Integer> DATA_ID_HURT = SynchedEntityData.defineId(BicycleEntity.class, EntityDataSerializers.INT);
private static final EntityDataAccessor<Integer> DATA_ID_HURTDIR = SynchedEntityData.defineId(BicycleEntity.class, EntityDataSerializers.INT);
private static final EntityDataAccessor<Float> DATA_ID_DAMAGE = SynchedEntityData.defineId(BicycleEntity.class, EntityDataSerializers.FLOAT);
public void setVelocity(float velocity) {
this.velocity = velocity;
}
public void setSpeedBoost(float speedBoost) {
this.maxSpeedIncrease = speedBoost;
}
public void setDownwardVelocity(float downward_velocity) {
this.downward_velocity = downward_velocity;
}
public void setJumpStep(float jumpStep) {
this.jumpStep = jumpStep;
}
public BicycleEntity(EntityType<? extends BicycleEntity> p_i50238_1_, Level p_i50238_2_) {
super(p_i50238_1_, p_i50238_2_);
this.velocity = 0.0f;
this.downward_velocity = 0.0f;
this.maxSpeedIncrease = 1.0f;
this.lastPos = null;
this.jumpStep = -1.0f;
this.recentDismount = false;
this.renderWheelRot = 0.0f;
this.lastRenderPos = null;
this.lastRenderTime = 0L;
this.maxUpStep = 1.0f;
}
public InteractionResult interact(Player player, InteractionHand hand) {
player.getItemInHand(hand);
if (isVehicle()) {
return super.interact(player, hand);
}
if (!this.level.isClientSide) {
player.setYRot(getYRot());
player.setXRot(getXRot());
player.startRiding(this);
}
return InteractionResult.sidedSuccess(this.level.isClientSide);
}
public void positionRider(Entity p_184232_1_) {
super.positionRider(p_184232_1_);
if (p_184232_1_ instanceof Mob) {
}
float f3 = Mth.sin(getYRot() * 0.017453292f);
float f = Mth.cos(getYRot() * 0.017453292f);
p_184232_1_.setPos(getX() + (0.38f * f3), getY() + getPassengersRidingOffset() + p_184232_1_.getMyRidingOffset() + 0.65f, getZ() - (0.38f * f));
if (p_184232_1_ instanceof LivingEntity) {
}
}
protected boolean canAddPassenger(Entity p_184219_1_) {
return this.velocity == 0.0f && getPassengers().size() < 1;
}
public Entity getControllingPassenger() {
if (getPassengers().isEmpty()) {
return null;
}
return (Entity) getPassengers().get(0);
}
public Vec3 getDismountLocationForPassenger(LivingEntity p_230268_1_) {
return super.getDismountLocationForPassenger(p_230268_1_);
}
protected void removePassenger(Entity p_184225_1_) {
ModernLifeCommon.LOGGER.debug(p_184225_1_.level);
this.lastPos = null;
if (p_184225_1_.level.isClientSide) {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundBikeDismountPacket(position(), this.jumpStep, this.velocity, this.downward_velocity, getId()));
}
super.removePassenger(p_184225_1_);
}
protected void addPassenger(Entity p_184200_1_) {
this.lastPos = null;
super.addPassenger(p_184200_1_);
}
protected float getEyeHeight(Pose p_213316_1_, EntityDimensions p_213316_2_) {
return p_213316_2_.height;
}
private float angularDifference(float angle1, float angle2) {
float angle12 = angle1 % 360.0f;
if (angle12 < 0.0f) {
angle12 += 360.0f;
}
float angle22 = angle2 % 360.0f;
if (angle22 < 0.0f) {
angle22 += 360.0f;
}
float diff = angle22 - angle12;
if (diff > 180.0f) {
diff = -(360.0f - diff);
} else if (diff < -180.0f) {
diff = 360.0f + diff;
}
return diff;
}
private void applyNewFacing(float facing) {
setYRot(facing);
setRot(getYRot(), getXRot());
}
protected void clampRotation(Entity p_184454_1_) {
if (p_184454_1_ != null) {
p_184454_1_.setYBodyRot(getYRot());
float f = Mth.wrapDegrees(p_184454_1_.getYRot() - getYRot());
float f1 = Mth.clamp(f, -105.0f, 105.0f);
p_184454_1_.setYRot((p_184454_1_.getYRot() + f1) - f);
p_184454_1_.setYHeadRot(p_184454_1_.getYRot());
}
}
protected void checkFallDamage(double p_184231_1_, boolean p_184231_3_, BlockState p_184231_4_, BlockPos p_184231_5_) {
this.fallDistance *= 0.88f;
super.checkFallDamage(p_184231_1_, p_184231_3_, p_184231_4_, p_184231_5_);
}
public void setDamage(float p_70266_1_) {
this.entityData.set(DATA_ID_DAMAGE, Float.valueOf(p_70266_1_));
}
public float getDamage() {
return ((Float) this.entityData.get(DATA_ID_DAMAGE)).floatValue();
}
public void setHurtTime(int p_70265_1_) {
this.entityData.set(DATA_ID_HURT, Integer.valueOf(p_70265_1_));
}
public int getHurtTime() {
return ((Integer) this.entityData.get(DATA_ID_HURT)).intValue();
}
public int getHurtDir() {
return ((Integer) this.entityData.get(DATA_ID_HURTDIR)).intValue();
}
public void setHurtDir(int p_70269_1_) {
this.entityData.set(DATA_ID_HURTDIR, Integer.valueOf(p_70269_1_));
}
public Item getDropItem() {
return CustomBlocks.ITEM_BICYCLE.get();
}
@OnlyIn(Dist.CLIENT)
public void animateHurt() {
setHurtDir(-getHurtDir());
setHurtTime(10);
setDamage(getDamage() * 11.0f);
}
public boolean hurt(DamageSource p_70097_1_, float p_70097_2_) {
if (isInvulnerableTo(p_70097_1_)) {
return false;
}
if (!this.level.isClientSide && !isRemoved()) {
setHurtDir(-getHurtDir());
setHurtTime(10);
setDamage(getDamage() + (p_70097_2_ * 20.0f));
markHurt();
boolean flag = (p_70097_1_.getEntity() instanceof Player) && p_70097_1_.getEntity().getAbilities().instabuild;
if (flag || getDamage() > 40.0f) {
if (!flag && this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
spawnAtLocation(getDropItem());
}
remove(RemovalReason.DISCARDED);
return true;
}
return true;
}
return true;
}
public void advanceMovement(LivingEntity livingEntity, float speed, boolean jumping) {
if (this.lastPos != null) {
double positionDelta = position().distanceTo(this.lastPos);
if (positionDelta <= 0.04d) {
if (this.velocity >= 0.05f) {
this.velocity *= 0.2f;
}
if (positionDelta <= 0.01d) {
this.downward_velocity = 0.0f;
}
}
}
if (this.downward_velocity == 0.0f) {
this.velocity *= 0.985f;
} else {
this.velocity *= 0.998f;
}
if (speed != 0.0d && this.downward_velocity == 0.0f) {
float speedIncrease = 0.0085f;
if (speed < 0.0f) {
speedIncrease = 0.0085f * 0.75f;
}
float increment = speed * speedIncrease;
this.velocity += increment;
if (this.velocity > 0.42f * this.maxSpeedIncrease) {
this.velocity = 0.42f * this.maxSpeedIncrease;
} else if (this.velocity < (-0.14f) * this.maxSpeedIncrease) {
this.velocity = (-0.14f) * this.maxSpeedIncrease;
}
} else if (this.velocity > 0.0f && this.velocity <= 0.05f) {
this.velocity = 0.0f;
} else if (this.velocity < 0.0f && this.velocity >= -0.05f) {
this.velocity = 0.0f;
}
if (this.maxSpeedIncrease > 1.0f) {
this.maxSpeedIncrease = 1.0f;
}
if (this.level.getFluidState(blockPosition()).getType() != Fluids.EMPTY) {
this.velocity = (float) (this.velocity * 0.9d);
}
if (isEyeInFluid(FluidTags.WATER) || isEyeInFluid(FluidTags.LAVA)) {
this.downward_velocity = (float) (this.downward_velocity * 0.2d);
}
if (this.velocity != 0.0f && livingEntity != null && this.downward_velocity == 0.0f) {
float facingAngle = livingEntity.getYRot();
float livingYRot = livingEntity.getYRot();
float bikeYRot = getYRot();
float angleDelta = angularDifference(bikeYRot, livingYRot);
if (Math.abs(angleDelta) > 10.0f) {
if (angleDelta > 0.0f) {
facingAngle = bikeYRot + Math.min(Math.abs(angleDelta), 10.0f);
} else {
facingAngle = bikeYRot - Math.min(Math.abs(angleDelta), 10.0f);
}
}
applyNewFacing(facingAngle);
}
BlockState currentState = this.level.getBlockState(blockPosition());
BlockState currentBelowState = this.level.getBlockState(blockPosition().below());
float friction = currentBelowState.getFriction(this.level, blockPosition().below(), this);
float frictionPercent = (friction - 0.6f) / 0.4f;
float frictionSlowdownFactor = 1.0f - (0.012f * frictionPercent);
this.velocity *= frictionSlowdownFactor;
setDeltaMovement(this.velocity * Math.cos(Math.toRadians(getYRot() + 90.0f)), -this.downward_velocity, this.velocity * Math.sin(Math.toRadians(getYRot() + 90.0f)));
if (isPushedByFluid()) {
Vec3 fluidFlow = this.level.getFluidState(blockPosition()).getFlow(this.level, blockPosition());
setDeltaMovement(getDeltaMovement().add(fluidFlow.scale(0.01d)));
}
Vec3 moveToVec = position().add(new Vec3(getDeltaMovement().x, 0.0d, getDeltaMovement().z).scale(2.0d));
BlockPos moveToPos = new BlockPos(moveToVec.x, moveToVec.y, moveToVec.z);
BlockState moveToState = this.level.getBlockState(moveToPos);
BlockState moveToAboveState = this.level.getBlockState(moveToPos.above());
this.level.getBlockState(moveToPos.below());
moveToState.getBlock().isPathfindable(moveToState, this.level, moveToPos, PathComputationType.LAND);
moveToAboveState.getBlock().isPathfindable(moveToAboveState, this.level, moveToPos.above(), PathComputationType.LAND);
BlockState stateToCheck = currentState;
BlockPos posToCheck = blockPosition();
if (stateToCheck.isAir()) {
stateToCheck = currentBelowState;
posToCheck = posToCheck.below();
}
double currentHeight = 0.0d;
VoxelShape groundShape = stateToCheck.getBlock().getCollisionShape(stateToCheck, this.level, posToCheck, CollisionContext.empty());
if (!groundShape.equals(Shapes.empty())) {
currentHeight = groundShape.max(Direction.Axis.Y);
}
double moveToHeight = 0.0d;
VoxelShape moveToShape = moveToState.getBlock().getCollisionShape(moveToState, this.level, moveToPos, CollisionContext.empty());
if (!moveToShape.equals(Shapes.empty())) {
moveToHeight = moveToShape.max(Direction.Axis.Y);
}
double jumpHeight = 0.0d;
if (jumping && this.downward_velocity == 0.0f && this.jumpStep < 0.0f) {
this.jumpStep = 0.0f;
}
if (this.jumpStep >= 0.0f) {
jumpHeight = 0.4d * (this.velocity / 0.42f) * Math.sin(Math.toRadians(this.jumpStep));
this.jumpStep += 30.0f;
}
if (this.jumpStep >= 180.0f) {
this.jumpStep = -1.0f;
}
double d = moveToHeight - currentHeight;
double groundY = posToCheck.getY() + currentHeight;
if (!currentState.isAir()) {
}
if (currentBelowState.isAir() || position().y > groundY) {
this.downward_velocity += 0.03f;
} else {
if (this.downward_velocity != 0.0f && currentBelowState.getFluidState().isEmpty()) {
if (livingEntity != null) {
applyNewFacing(livingEntity.getYRot());
}
float damageDone = this.downward_velocity * 1.12f;
if (damageDone <= 1.0f || livingEntity != null) {
}
if (livingEntity instanceof Player) {
Player Player = (Player) livingEntity;
if (damageDone >= 1.0d) {
this.level.playSound(Player, blockPosition(), SoundEvents.GENERIC_BIG_FALL, SoundSource.PLAYERS, 0.25f, 1.0f);
} else if (damageDone > 0.2d) {
this.level.playSound(Player, blockPosition(), SoundEvents.GENERIC_SMALL_FALL, SoundSource.PLAYERS, 0.25f, 1.0f);
}
}
}
this.downward_velocity = 0.0f;
}
setDeltaMovement(getDeltaMovement().x, (-this.downward_velocity) + jumpHeight, getDeltaMovement().z);
this.lastPos = position();
if ((this.level instanceof ServerLevel) || (isVehicle() && isControlledByLocalInstance())) {
getDeltaMovement();
if (this.downward_velocity == 0.0f) {
Vec3 mov = getDeltaMovement();
setDeltaMovement(mov.x, mov.y - 0.01d, mov.z);
}
move(MoverType.SELF, getDeltaMovement());
}
setPacketCoordinates(getX(), getY(), getZ());
}
public void tick() {
boolean jumping = false;
float speed = 0.0f;
if (getHurtTime() > 0) {
setHurtTime(getHurtTime() - 1);
}
if (getDamage() > 0.0f) {
setDamage(getDamage() - 1.0f);
}
if (this.level.isClientSide) {
LivingEntity livingEntity = (LivingEntity) getControllingPassenger();
if (isVehicle() && isControlledByLocalInstance()) {
float f = livingEntity.xxa;
float zDelta = livingEntity.zza;
if (Minecraft.getInstance().options.keyJump.isDown()) {
jumping = true;
}
speed = (0.0f * 0.0f) + (zDelta * zDelta);
double headingDegrees = Math.toDegrees(Math.atan2(zDelta, 0.0f));
if (headingDegrees < 0.0d) {
speed = -speed;
}
}
advanceMovement(livingEntity, speed, jumping);
} else if (this.velocity > 0.0f || this.downward_velocity > 0.0f) {
advanceMovement(null, 0.0f, false);
if (this.velocity == 0.0f && this.recentDismount) {
this.recentDismount = false;
}
}
super.tick();
}
public boolean canBeCollidedWith() {
return true;
}
public boolean isPushable() {
return true;
}
public double getPassengersRidingOffset() {
return -0.15d;
}
public boolean isPickable() {
return !isRemoved();
}
public boolean canWearArmor() {
return true;
}
public boolean isArmor(ItemStack p_190682_1_) {
return p_190682_1_.getItem() instanceof HorseArmorItem;
}
public Packet<?> getAddEntityPacket() {
return NetworkHooks.getEntitySpawningPacket(this);
}
protected void defineSynchedData() {
this.entityData.define(DATA_ID_HURT, 0);
this.entityData.define(DATA_ID_HURTDIR, 1);
this.entityData.define(DATA_ID_DAMAGE, Float.valueOf(0.0f));
}
protected void readAdditionalSaveData(CompoundTag var1) {
}
protected void addAdditionalSaveData(CompoundTag var1) {
}
}

View File

@ -1,109 +0,0 @@
package com.dairymoose.entity;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
/* loaded from: outputsrg.jar:com/dairymoose/entity/BicycleModel.class */
public class BicycleModel extends EntityModel<BicycleEntity> {
public static final ModelLayerLocation BICYCLE = new ModelLayerLocation(new ResourceLocation("modernlife", "bicycle"), "main");
private final ModelPart crankset;
private final ModelPart front_wheel;
private final ModelPart back_wheel;
private final ModelPart back_wheel_sprite;
private final ModelPart front_wheel_sprite;
private final ModelPart frame;
private final ModelPart crank_arm;
public BicycleModel(ModelPart root) {
this.crankset = root.getChild("crankset");
this.front_wheel = root.getChild("front_wheel");
this.back_wheel = root.getChild("back_wheel");
this.back_wheel_sprite = root.getChild("back_wheel_sprite");
this.front_wheel_sprite = root.getChild("front_wheel_sprite");
this.frame = root.getChild("frame");
this.crank_arm = root.getChild("crank_arm");
}
public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot();
PartDefinition crankset = partdefinition.addOrReplaceChild("crankset", CubeListBuilder.create().texOffs(15, 1).addBox(-0.55f, -0.7272f, -1.8f, 0.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(15, 1).addBox(-0.55f, -0.7272f, 1.2f, 0.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(15, 1).addBox(-0.55f, 0.875f, -0.1978f, 0.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(15, 1).addBox(-0.55f, -2.125f, -0.1978f, 0.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offset(-1.025f, 20.0f, 2.0f));
crankset.addOrReplaceChild("hexadecagon_r1", CubeListBuilder.create().texOffs(15, 1).addBox(0.5f, -2.0f, -0.3978f, 0.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(15, 1).addBox(0.5f, 1.0f, -0.3978f, 0.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(15, 1).addBox(0.5f, -0.6022f, 1.0f, 0.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(15, 1).addBox(0.5f, -0.6022f, -2.0f, 0.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(-1.05f, -0.125f, 0.2f, -0.3927f, 0.0f, 0.0f));
crankset.addOrReplaceChild("hexadecagon_r2", CubeListBuilder.create().texOffs(15, 1).addBox(0.5f, -2.0f, -0.3978f, 0.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(15, 1).addBox(0.5f, 1.0f, -0.3978f, 0.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(15, 1).addBox(0.5f, -0.6022f, 1.0f, 0.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(15, 1).addBox(0.5f, -0.6022f, -2.0f, 0.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(-1.05f, -0.125f, 0.2f, 0.3927f, 0.0f, 0.0f));
crankset.addOrReplaceChild("hexadecagon_r3", CubeListBuilder.create().texOffs(15, 1).addBox(0.5f, -0.6022f, 1.0f, 0.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(15, 1).addBox(0.5f, -0.6022f, -2.0f, 0.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(-1.05f, -0.125f, 0.2f, -0.7854f, 0.0f, 0.0f));
crankset.addOrReplaceChild("hexadecagon_r4", CubeListBuilder.create().texOffs(15, 1).addBox(0.5f, -0.6022f, 1.0f, 0.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(15, 1).addBox(0.5f, -0.6022f, -2.0f, 0.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(-1.05f, -0.125f, 0.2f, 0.7854f, 0.0f, 0.0f));
PartDefinition front_wheel = partdefinition.addOrReplaceChild("front_wheel", CubeListBuilder.create().texOffs(0, 0).addBox(-0.5f, -0.9955f, -22.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, -0.9955f, -12.95f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, 4.05f, -18.0045f, 1.0f, 1.0f, 2.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, -5.05f, -18.0045f, 1.0f, 1.0f, 2.0f, new CubeDeformation(0.0f)), PartPose.offset(0.0f, 19.0f, 9.0f));
front_wheel.addOrReplaceChild("hexadecagon_r5", CubeListBuilder.create().texOffs(0, 0).addBox(-0.5f, -5.05f, -1.0045f, 1.0f, 1.0f, 2.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, 4.05f, -1.0045f, 1.0f, 1.0f, 2.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, -0.9955f, 4.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, -0.9955f, -5.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(0.0f, 0.0f, -17.0f, -0.3927f, 0.0f, 0.0f));
front_wheel.addOrReplaceChild("hexadecagon_r6", CubeListBuilder.create().texOffs(0, 0).addBox(-0.5f, -5.05f, -1.0045f, 1.0f, 1.0f, 2.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, 4.05f, -1.0045f, 1.0f, 1.0f, 2.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, -0.9955f, 4.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, -0.9955f, -5.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(0.0f, 0.0f, -17.0f, 0.3927f, 0.0f, 0.0f));
front_wheel.addOrReplaceChild("hexadecagon_r7", CubeListBuilder.create().texOffs(0, 0).addBox(-0.5f, -0.9955f, 4.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, -0.9955f, -5.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(0.0f, 0.0f, -17.0f, -0.7854f, 0.0f, 0.0f));
front_wheel.addOrReplaceChild("hexadecagon_r8", CubeListBuilder.create().texOffs(0, 0).addBox(-0.5f, -0.9955f, 4.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, -0.9955f, -5.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(0.0f, 0.0f, -17.0f, 0.7854f, 0.0f, 0.0f));
PartDefinition back_wheel = partdefinition.addOrReplaceChild("back_wheel", CubeListBuilder.create().texOffs(0, 0).addBox(-0.5f, -0.9955f, -5.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, -0.9955f, 4.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, 4.05f, -1.0045f, 1.0f, 1.0f, 2.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, -5.05f, -1.0045f, 1.0f, 1.0f, 2.0f, new CubeDeformation(0.0f)), PartPose.offset(0.0f, 19.0f, 9.0f));
back_wheel.addOrReplaceChild("hexadecagon_r9", CubeListBuilder.create().texOffs(0, 0).addBox(-0.5f, -5.05f, -1.0045f, 1.0f, 1.0f, 2.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, 4.05f, -1.0045f, 1.0f, 1.0f, 2.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, -0.9955f, 4.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, -0.9955f, -5.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(0.0f, 0.0f, 0.0f, -0.3927f, 0.0f, 0.0f));
back_wheel.addOrReplaceChild("hexadecagon_r10", CubeListBuilder.create().texOffs(0, 0).addBox(-0.5f, -5.05f, -1.0045f, 1.0f, 1.0f, 2.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, 4.05f, -1.0045f, 1.0f, 1.0f, 2.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, -0.9955f, 4.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, -0.9955f, -5.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(0.0f, 0.0f, 0.0f, 0.3927f, 0.0f, 0.0f));
back_wheel.addOrReplaceChild("hexadecagon_r11", CubeListBuilder.create().texOffs(0, 0).addBox(-0.5f, -0.9955f, 4.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, -0.9955f, -5.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(0.0f, 0.0f, 0.0f, -0.7854f, 0.0f, 0.0f));
back_wheel.addOrReplaceChild("hexadecagon_r12", CubeListBuilder.create().texOffs(0, 0).addBox(-0.5f, -0.9955f, 4.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-0.5f, -0.9955f, -5.05f, 1.0f, 2.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(0.0f, 0.0f, 0.0f, 0.7854f, 0.0f, 0.0f));
partdefinition.addOrReplaceChild("back_wheel_sprite", CubeListBuilder.create().texOffs(1, 14).addBox(0.0f, -4.0f, -4.0f, 0.0f, 8.0f, 8.0f, new CubeDeformation(0.0f)), PartPose.offset(0.0f, 19.0f, 9.0f));
PartDefinition front_wheel_sprite = partdefinition.addOrReplaceChild("front_wheel_sprite", CubeListBuilder.create(), PartPose.offset(0.0f, 19.0f, -8.0f));
front_wheel_sprite.addOrReplaceChild("front_wheel_sprite_r1", CubeListBuilder.create().texOffs(0, 0).addBox(0.0f, -5.0f, -5.0f, 0.0f, 10.0f, 10.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(0.0f, 0.0f, 0.0f, 0.0873f, 0.0f, 0.0f));
PartDefinition frame = partdefinition.addOrReplaceChild("frame", CubeListBuilder.create().texOffs(18, 0).addBox(-2.575f, -9.875f, -5.575f, 3.0f, 1.0f, 4.0f, new CubeDeformation(0.0f)), PartPose.offset(0.0f, 19.0f, 9.0f));
frame.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(24, 0).addBox(-0.575f, -7.625f, -17.925f, 3.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(24, 0).addBox(-1.525f, -7.65f, -17.925f, 1.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(24, 0).addBox(-4.5f, -7.625f, -17.925f, 3.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(21, 16).addBox(-1.525f, -7.65f, -16.925f, 1.0f, 1.0f, 2.0f, new CubeDeformation(0.0f)).texOffs(28, 21).addBox(-1.5f, -7.7f, -6.4f, 1.0f, 10.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(0.0f, 0.0f, 0.0f, -0.2618f, 0.0f, 0.0f));
frame.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(23, 17).addBox(-1.5f, -5.325f, -16.5f, 1.0f, 11.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(12, 22).addBox(-1.45f, -3.45f, -15.475f, 1.0f, 1.0f, 9.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(0.0f, 0.0f, 0.0f, -0.3491f, 0.0f, 0.0f));
frame.addOrReplaceChild("cube_r3", CubeListBuilder.create().texOffs(28, 5).addBox(-1.525f, -15.0f, -5.7f, 1.0f, 11.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(0.0f, 0.0f, 0.0f, 0.7418f, 0.0f, 0.0f));
frame.addOrReplaceChild("cube_r4", CubeListBuilder.create().texOffs(10, 0).addBox(-1.5f, -7.3f, 0.025f, 1.0f, 8.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(0.0f, 0.0f, 0.0f, 0.8727f, 0.0f, 0.0f));
frame.addOrReplaceChild("cube_r5", CubeListBuilder.create().texOffs(14, 0).addBox(-1.55f, -0.25f, -6.75f, 1.0f, 1.0f, 8.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(0.0f, 0.0f, 0.0f, 0.0873f, 0.0f, 0.0f));
partdefinition.addOrReplaceChild("crank_arm", CubeListBuilder.create().texOffs(24, 29).addBox(-0.75f, -0.5f, -2.55f, 1.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(11, 0).addBox(0.25f, -0.5f, -2.55f, 0.0f, 1.0f, 3.0f, new CubeDeformation(0.0f)), PartPose.offset(-1.875f, 19.875f, 2.0f));
return LayerDefinition.create(meshdefinition, 32, 32);
}
public void m_7695_(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
this.crankset.render(poseStack, buffer, packedLight, packedOverlay);
this.front_wheel.render(poseStack, buffer, packedLight, packedOverlay);
this.back_wheel.render(poseStack, buffer, packedLight, packedOverlay);
this.back_wheel_sprite.render(poseStack, buffer, packedLight, packedOverlay);
this.front_wheel_sprite.render(poseStack, buffer, packedLight, packedOverlay);
this.frame.render(poseStack, buffer, packedLight, packedOverlay);
this.crank_arm.render(poseStack, buffer, packedLight, packedOverlay);
}
public void setRotationAngle(ModelPart modelRenderer, float x, float y, float z) {
modelRenderer.xRot = x;
modelRenderer.yRot = y;
modelRenderer.zRot = z;
}
public void renderToBufferWithRotation(float wheelRot, PoseStack matrixStack, VertexConsumer buffer, int var3, int var4, float var5, float var6, float var7, float var8) {
this.crankset.render(matrixStack, buffer, var3, var4, var5, var6, var7, var8);
setRotationAngle(this.front_wheel_sprite, wheelRot, 0.0f, 0.0f);
this.front_wheel_sprite.render(matrixStack, buffer, var3, var4, var5, var6, var7, var8);
this.front_wheel.render(matrixStack, buffer, var3, var4, var5, var6, var7, var8);
setRotationAngle(this.back_wheel_sprite, wheelRot, 0.0f, 0.0f);
this.back_wheel_sprite.render(matrixStack, buffer, var3, var4, var5, var6, var7, var8);
this.back_wheel.render(matrixStack, buffer, var3, var4, var5, var6, var7, var8);
setRotationAngle(this.crank_arm, wheelRot / 1.2f, 0.0f, 0.0f);
this.crank_arm.render(matrixStack, buffer, var3, var4, var5, var6, var7, var8);
this.frame.render(matrixStack, buffer, var3, var4, var5, var6, var7, var8);
}
public void setupAnim(BicycleEntity var1, float var2, float var3, float var4, float var5, float var6) {
this.crankset.visible = true;
this.front_wheel.visible = true;
this.front_wheel_sprite.visible = true;
this.back_wheel.visible = true;
this.back_wheel_sprite.visible = true;
this.crank_arm.visible = true;
this.frame.visible = true;
}
}

View File

@ -1,79 +0,0 @@
package com.dairymoose.entity;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Vector3f;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.culling.Frustum;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@OnlyIn(Dist.CLIENT)
/* loaded from: outputsrg.jar:com/dairymoose/entity/BicycleRenderer.class */
public final class BicycleRenderer extends EntityRenderer<BicycleEntity> {
private float modelScale;
private final BicycleModel bicycleModel;
private static final Logger LOGGER = LogManager.getLogger();
private static final ResourceLocation texture = new ResourceLocation("modernlife", "textures/entity/bicycle_uv.png");
public BicycleRenderer(EntityRendererProvider.Context ctx) {
super(ctx);
this.modelScale = 1.0f;
this.bicycleModel = new BicycleModel(ctx.bakeLayer(BicycleModel.BICYCLE));
}
public boolean shouldRender(BicycleEntity p_225626_1_, Frustum p_225626_2_, double p_225626_3_, double p_225626_5_, double p_225626_7_) {
return true;
}
public void render(BicycleEntity bicycleEntity, float angle, float partialTicks, PoseStack matrixStack, MultiBufferSource buffer, int p_225623_6_) {
Vec3 pos = bicycleEntity.position();
if (bicycleEntity.lastRenderPos != null) {
float t = ((float) (System.currentTimeMillis() - bicycleEntity.lastRenderTime)) / 1000.0f;
if (t >= 0.05d) {
pos = new Vec3(pos.x, 0.0d, pos.z);
bicycleEntity.lastRenderPos = new Vec3(bicycleEntity.lastRenderPos.x, 0.0d, bicycleEntity.lastRenderPos.z);
float distSqr = (float) pos.distanceToSqr(bicycleEntity.lastRenderPos);
float dist = Mth.sqrt(distSqr);
float calcSpeed = dist / t;
float increment = calcSpeed / 15.0f;
bicycleEntity.renderWheelRot = (bicycleEntity.renderWheelRot + increment) % 360.0f;
bicycleEntity.lastRenderPos = pos;
bicycleEntity.lastRenderTime = System.currentTimeMillis();
}
}
matrixStack.pushPose();
matrixStack.translate(0.0d, 1.5d, 0.0d);
matrixStack.mulPose(Vector3f.YP.rotationDegrees(180.0f - angle));
float lvt_7_1_ = bicycleEntity.getHurtTime() - partialTicks;
float lvt_8_1_ = bicycleEntity.getDamage() - partialTicks;
if (lvt_8_1_ < 0.0f) {
lvt_8_1_ = 0.0f;
}
if (lvt_7_1_ > 0.0f) {
matrixStack.mulPose(Vector3f.XP.rotationDegrees((((Mth.sin(lvt_7_1_) * lvt_7_1_) * lvt_8_1_) / 10.0f) * bicycleEntity.getHurtDir()));
}
matrixStack.scale(-this.modelScale, -this.modelScale, this.modelScale);
this.bicycleModel.setupAnim(bicycleEntity, partialTicks, 0.0f, -0.1f, 0.0f, 0.0f);
VertexConsumer builder = buffer.getBuffer(this.bicycleModel.m_103119_(getTextureLocation(bicycleEntity)));
this.bicycleModel.renderToBufferWithRotation(bicycleEntity.renderWheelRot, matrixStack, builder, p_225623_6_, OverlayTexture.NO_OVERLAY, 1.0f, 1.0f, 1.0f, 1.0f);
matrixStack.popPose();
if (bicycleEntity.lastRenderPos == null) {
bicycleEntity.lastRenderPos = pos;
bicycleEntity.lastRenderTime = System.currentTimeMillis();
}
super.render(bicycleEntity, angle, partialTicks, matrixStack, buffer, p_225623_6_);
}
public ResourceLocation getTextureLocation(BicycleEntity var1) {
return texture;
}
}

View File

@ -1,185 +0,0 @@
package com.dairymoose.entity;
import com.dairymoose.modernlife.blocks.gui.HBlockPos;
import com.dairymoose.modernlife.core.ModernLifeCommon;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.network.NetworkHooks;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/* loaded from: outputsrg.jar:com/dairymoose/entity/DummyEntity.class */
public class DummyEntity extends Entity {
public static final EntityType<DummyEntity> DUMMY_ENTITY = EntityType.Builder.of(DummyEntity::new, MobCategory.MISC).sized(0.0f, 0.0f).build(new ResourceLocation("modernlife", "dummy").toString());
private static final Logger LOGGER = LogManager.getLogger();
private static final EntityDataAccessor<Float> DATA_ID_RIDE_HEIGHT = SynchedEntityData.defineId(DummyEntity.class, EntityDataSerializers.FLOAT);
public List<RenderableBlock> renderables;
public DummyEntity(EntityType<?> p_i48580_1_, Level p_i48580_2_) {
super(p_i48580_1_, p_i48580_2_);
this.renderables = new ArrayList();
}
public boolean isEntityStandingOnSolidGround(Entity e) {
for (RenderableBlock renderable : this.renderables) {
BlockPos dummyPos = blockPosition();
double x = dummyPos.getX() + renderable.relativeX;
double y = dummyPos.getY() + renderable.relativeY;
double z = dummyPos.getZ() + renderable.relativeZ;
int blockX = (int) x;
int blockZ = (int) z;
HBlockPos renderablePos = new HBlockPos(blockX, 0, blockZ);
HBlockPos entityPos = new HBlockPos(e.blockPosition().getX(), 0, e.blockPosition().getZ());
if (renderable.state.m_60638_(this.level, renderablePos, e, Direction.UP) && renderablePos.equals(entityPos) && e.distanceToSqr(x, y, z) <= 2.25d) {
return true;
}
}
return false;
}
public Vec3 getEntitySolidGround(Entity e) {
for (RenderableBlock renderable : this.renderables) {
Vec3 dummyPos = position();
double x = dummyPos.x + renderable.relativeX;
double y = dummyPos.y + renderable.relativeY;
double z = dummyPos.z + renderable.relativeZ;
int blockX = (int) x;
int blockZ = (int) z;
HBlockPos renderablePos = new HBlockPos(blockX, 0, blockZ);
HBlockPos entityPos = new HBlockPos(e.blockPosition().getX(), 0, e.blockPosition().getZ());
if (renderable.state.m_60638_(this.level, entityPos, e, Direction.UP) && renderablePos.equals(entityPos)) {
double yDiff = e.getY() - y;
if (yDiff > 0.0d && yDiff <= 1.0d) {
return new Vec3(x, y + 1.0d, z);
}
}
}
return null;
}
public boolean isEntityColliding(Entity e) {
for (RenderableBlock renderable : this.renderables) {
Vec3 dummyPos = position();
double x = dummyPos.x + renderable.relativeX;
double y = dummyPos.y + renderable.relativeY;
double z = dummyPos.z + renderable.relativeZ;
int blockX = (int) x;
int blockY = (int) y;
int blockZ = (int) z;
HBlockPos renderablePos = new HBlockPos(blockX, blockY, blockZ);
new HBlockPos(e.blockPosition().getX(), e.blockPosition().getY(), e.blockPosition().getZ());
VoxelShape collisionShape = renderable.state.m_60812_(this.level, renderablePos);
AABB collisionBB = null;
if (!collisionShape.isEmpty()) {
collisionBB = collisionShape.bounds().move(x - 0.5d, y, z - 0.5d);
}
AABB entityBB = e.getBoundingBox();
AABB entityBB2 = entityBB.move(0.0d, 0.13d, 0.0d);
if (e instanceof Player) {
}
if (collisionBB != null && collisionBB.intersects(entityBB2) && e.getY() + 0.13d >= y) {
double xDiff = e.getX() - x;
double zDiff = e.getZ() - z;
double horizontalDistSqr = (xDiff * xDiff) + (zDiff * zDiff);
if (horizontalDistSqr <= 1.44d) {
renderable.state = Blocks.DIRT.defaultBlockState();
return true;
}
}
}
return false;
}
public float getPickRadius() {
return 500.0f;
}
public Vec3 getLightProbePosition(float p_241842_1_) {
Vec3 superPos = super.getLightProbePosition(p_241842_1_);
return new Vec3(superPos.x, superPos.y, superPos.z);
}
public Vec3 getDismountLocationForPassenger(LivingEntity p_230268_1_) {
remove(RemovalReason.DISCARDED);
return super.getDismountLocationForPassenger(p_230268_1_);
}
public double getPassengersRidingOffset() {
return ((Float) this.entityData.get(DATA_ID_RIDE_HEIGHT)).floatValue();
}
public static DummyEntity getEntity(float rideHeight, Level world, BlockPos pos, boolean oppositeFacing) {
List<DummyEntity> dummies = world.getEntities(DUMMY_ENTITY, new AABB(pos), e -> {
return true;
});
if (!dummies.isEmpty()) {
ModernLifeCommon.LOGGER.debug("Found dummy");
return dummies.get(0);
}
ModernLifeCommon.LOGGER.debug("New dummy");
DummyEntity dummy = (DummyEntity) DUMMY_ENTITY.create(world);
dummy.setPos(pos.getX() + 0.5d, pos.getY(), pos.getZ() + 0.5d);
dummy.setRideHeight(rideHeight);
BlockState state = world.getBlockState(pos);
if (state.getOptionalValue(BlockStateProperties.HORIZONTAL_FACING).isPresent()) {
Direction facing = state.getValue(BlockStateProperties.HORIZONTAL_FACING);
if (oppositeFacing) {
facing = facing.getOpposite();
}
dummy.setYRot(facing.toYRot());
} else {
dummy.setYRot(-1.0f);
}
if (!world.isClientSide) {
world.m_7967_(dummy);
}
return dummy;
}
public void ride(Player player) {
if (getYRot() != -1.0f) {
player.setYRot(getYRot());
}
player.startRiding(this);
}
public void setRideHeight(float h) {
this.entityData.set(DATA_ID_RIDE_HEIGHT, Float.valueOf(h));
}
protected void defineSynchedData() {
this.entityData.define(DATA_ID_RIDE_HEIGHT, Float.valueOf(0.0f));
}
public void readAdditionalSaveData(CompoundTag var1) {
this.entityData.set(DATA_ID_RIDE_HEIGHT, Float.valueOf(var1.getFloat("RideHeight")));
}
public void addAdditionalSaveData(CompoundTag var1) {
var1.putFloat("RideHeight", ((Float) this.entityData.get(DATA_ID_RIDE_HEIGHT)).floatValue());
}
public Packet<?> getAddEntityPacket() {
return NetworkHooks.getEntitySpawningPacket(this);
}
}

View File

@ -1,48 +0,0 @@
package com.dairymoose.entity;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.culling.Frustum;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.client.model.data.EmptyModelData;
/* loaded from: outputsrg.jar:com/dairymoose/entity/DummyRenderer.class */
public class DummyRenderer extends EntityRenderer<DummyEntity> {
public DummyRenderer(EntityRendererProvider.Context ctx) {
super(ctx);
}
public boolean shouldRender(DummyEntity dummyEntity, Frustum p_225626_2_, double p_225626_3_, double p_225626_5_, double p_225626_7_) {
if (dummyEntity.renderables.isEmpty()) {
return false;
}
return true;
}
public void render(DummyEntity dummyEntity, float p_114486_, float partialTick, PoseStack poseStack, MultiBufferSource mbs, int combinedLight) {
if (!dummyEntity.renderables.isEmpty()) {
poseStack.pushPose();
poseStack.translate(-0.5d, 0.0d, -0.5d);
for (RenderableBlock renderable : dummyEntity.renderables) {
poseStack.pushPose();
dummyEntity.blockPosition();
poseStack.translate(renderable.relativeX, renderable.relativeY, renderable.relativeZ);
if (renderable.offset > 0.0f) {
poseStack.translate(0.0d, renderable.offset, 0.0d);
}
Minecraft.getInstance().getBlockRenderer().renderSingleBlock(renderable.state, poseStack, mbs, combinedLight, OverlayTexture.NO_OVERLAY, EmptyModelData.INSTANCE);
poseStack.popPose();
}
poseStack.popPose();
}
super.render(dummyEntity, p_114486_, partialTick, poseStack, mbs, combinedLight);
}
public ResourceLocation getTextureLocation(DummyEntity var1) {
return null;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,67 +0,0 @@
package com.dairymoose.entity;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
/* loaded from: outputsrg.jar:com/dairymoose/entity/MotorboatModel.class */
public class MotorboatModel<T extends Entity> extends EntityModel<T> {
public static final ModelLayerLocation MOTORBOAT = new ModelLayerLocation(new ResourceLocation("modernlife", "motorboat"), "main");
private final ModelPart hull_back_and_bottom;
private final ModelPart tail;
private final ModelPart glass_window;
private final ModelPart hull_top;
private final ModelPart hull_side;
private final ModelPart water_patch;
public MotorboatModel(ModelPart root) {
this.hull_back_and_bottom = root.getChild("hull_back_and_bottom");
this.tail = root.getChild("tail");
this.glass_window = root.getChild("glass_window");
this.hull_top = root.getChild("hull_top");
this.hull_side = root.getChild("hull_side");
this.water_patch = root.getChild("water_patch");
}
public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot();
PartDefinition hull_back_and_bottom = partdefinition.addOrReplaceChild("hull_back_and_bottom", CubeListBuilder.create().texOffs(0, 15).addBox(11.2365f, -8.0f, -10.5719f, 7.0f, 1.0f, 8.0f, new Cu beDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -8.0f, -2.5719f, 7.0f, 1.0f, 5.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -8.0f, 2.4281f, 7.0f, 1.0f, 8.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-15.7635f, -3.0f, 3.4281f, 9.0f, 1.0f, 6.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(9.2365f, -3.0f, 3.4281f, 9.0f, 1.0f, 6.0f, new CubeDeformation(0.0f)).texOffs(0, 24).addBox(-15.7635f, -3.0f, -9.5719f, 9.0f, 1.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 24).addBox(-6.7635f, -3.0f, -9.5719f, 9.0f, 1.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 24).addBox(2.2365f, -3.0f, -9.5719f, 7.0f, 1.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 24).addBox(-6.7635f, -3.0f, -2.5719f, 9.0f, 1.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 24).addBox(1.2365f, -3.0f, -2.5719f, 8.0f, 1.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 24).addBox(-6.7635f, -3.0f, 4.4281f, 8.0f, 1.0f, 4.0f, new CubeDeformation(0.0f)).texOffs(0, 24).addBox(1.2365f, -3.0f, 4.4281f, 8.0f, 1.0f, 4.0f, new CubeDeformation(0.0f)).texOffs(0, 24).addBox(9.2365f, -3.0f, -9.5719f, 9.0f, 1.0f, 6.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-15.7635f, -3.0f, -2.5719f, 9.0f, 1.0f, 6.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(9.2365f, -3.0f, -3.5719f, 9.0f, 1.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-14.7635f, -2.0f, -7.5719f, 33.0f, 1.0f, 15.0f, new CubeDeformation(0.0f)).texOffs(0, 19).addBox(2.2365f, -1.0f, -5.5719f, 16.0f, 1.0f, 6.0f, new CubeDeformation(0.0f)).texOffs(0, 19).addBox(2.2365f, -1.0f, 0.4281f, 16.0f, 1.0f, 5.0f, new CubeDeformation(0.0f)).texOffs(0, 19).addBox(-13.7635f, -1.0f, -5.5719f, 16.0f, 1.0f, 6.0f, new CubeDeformation(0.0f)).texOffs(0, 19).addBox(-13.7635f, -1.0f, 0.4281f, 16.0f, 1.0f, 5.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-15.7635f, -4.0f, -10.9636f, 16.0f, 1.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-15.7635f, -4.0f, 0.0364f, 16.0f, 1.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(9.2365f, -4.0f, 4.0364f, 9.0f, 1.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(0.2365f, -4.0f, 4.0364f, 9.0f, 1.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(0.2365f, -4.0f, -2.9636f, 18.0f, 1.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(0.2365f, -4.0f, -10.9636f, 10.0f, 1.0f, 8.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(10.2365f, -4.0f, -10.9636f, 8.0f, 1.0f, 8.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -5.0f, -11.5719f, 7.0f, 1.0f, 9.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -5.0f, -2.5719f, 7.0f, 1.0f, 5.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -5.0f, 2.4281f, 7.0f, 1.0f, 9.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -6.0f, -12.5719f, 7.0f, 1.0f, 9.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -6.0f, -3.5719f, 7.0f, 1.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -6.0f, 3.4281f, 7.0f, 1.0f, 9.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -7.0f, -11.5719f, 7.0f, 1.0f, 9.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -7.0f, -2.5719f, 7.0f, 1.0f, 5.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -7.0f, 2.4281f, 7.0f, 1.0f, 9.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-15.7635f, -7.0f, -11.5719f, 1.0f, 3.0f, 12.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-15.7635f, -7.0f, 0.4281f, 1.0f, 3.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-16.7635f, -7.0f, 0.4281f, 1.0f, 3.0f, 9.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-16.7635f, -7.0f, -9.5719f, 1.0f, 3.0f, 10.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-17.7635f, -7.0f, -8.5719f, 1.0f, 3.0f, 8.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-17.7635f, -7.0f, -0.5719f, 1.0f, 3.0f, 9.0f, new CubeDeformation(0.0f)).texOffs(0, 17).addBox(-18.7635f, -7.0f, 0.4281f, 1.0f, 3.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-18.7635f, -7.0f, -7.5719f, 1.0f, 3.0f, 8.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-19.7635f, -7.0f, -6.5719f, 1.0f, 3.0f, 13.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-20.7635f, -7.0f, -5.5719f, 1.0f, 3.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-23.2635f, -8.0f, -4.5f, 1.0f, 5.0f, 9.0f, new CubeDeformation(0.0f)), PartPose.offset(0.0f, 24.0f, 0.0f));
hull_back_and_bottom.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 15).addBox(3.5f, -2.5f, 3.0f, 1.0f, 5.0f, 11.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(-21.7635f, -5.5f, 0.1651f, -3.1416f, 0.7854f, 3.1416f));
hull_back_and_bottom.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(0, 15).addBox(-4.5f, -2.5f, 2.0f, 1.0f, 5.0f, 12.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(-21.7635f, -5.5f, 0.1651f, 0.0f, 0.7854f, 0.0f));
PartDefinition tail = partdefinition.addOrReplaceChild("tail", CubeListBuilder.create(), PartPose.offset(0.0f, 24.0f, 0.0f));
tail.addOrReplaceChild("cube_r3", CubeListBuilder.create().texOffs(26, 0).addBox(2.0f, -15.9f, -8.0f, 2.0f, 8.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 19).addBox(2.0f, -15.9f, 5.0f, 2.0f, 1.0f, 12.0f, new CubeDeformation(0.0f)).texOffs(0, 16).addBox(2.0f, -15.9f, -7.0f, 2.0f, 1.0f, 12.0f, new CubeDeformation(0.0f)).texOffs(26, 0).addBox(2.0f, -15.9f, 17.0f, 2.0f, 8.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(3.7365f, 0.0f, -5.0f, 0.0f, 0.0f, 0.3491f));
PartDefinition glass_window = partdefinition.addOrReplaceChild("glass_window", CubeListBuilder.create(), PartPose.offset(0.0f, 24.0f, 0.0f));
glass_window.addOrReplaceChild("cube_r4", CubeListBuilder.create().texOffs(0, 0).addBox(-18.0f, -10.75f, 6.0f, 1.0f, 4.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-18.0f, -10.75f, -5.0f, 1.0f, 4.0f, 11.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(3.7365f, 0.0f, -6.0f, 0.0f, 0.0f, 0.2618f));
partdefinition.addOrReplaceChild("hull_top", CubeListBuilder.create().texOffs(0, 16).addBox(-16.2635f, -10.0f, -0.6364f, 2.0f, 2.0f, 12.0f, new CubeDeformation(0.0f)).texOffs(0, 16).addBox(-16.2635f, -10.0f, -11.6364f, 2.0f, 2.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(0, 27).addBox(-14.2635f, -10.0f, -12.5187f, 14.0f, 3.0f, 2.0f, new CubeDeformation(0.0f)).texOffs(0, 16).addBox(-14.2635f, -11.0f, -11.1364f, 4.0f, 3.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(0, 16).addBox(-14.2635f, -11.0f, -0.1364f, 4.0f, 3.0f, 12.0f, new CubeDeformation(0.0f)).texOffs(0, 27).addBox(-14.2635f, -10.0f, 10.4813f, 14.0f, 3.0f, 2.0f, new CubeDeformation(0.0f)).texOffs(0, 16).addBox(-17.2635f, -9.0f, 0.4773f, 1.0f, 1.0f, 10.0f, new CubeDeformation(0.0f)).texOffs(0, 16).addBox(-18.2635f, -9.0f, 1.4773f, 1.0f, 1.0f, 8.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-19.2635f, -9.0f, -0.5227f, 1.0f, 1.0f, 9.0f, new CubeDeformation(0.0f)).texOffs(5, 18).addBox(-17.2635f, -9.0f, -10.5227f, 1.0f, 1.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(2, 17).addBox(-18.2635f, -9.0f, -9.5227f, 1.0f, 1.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-19.2635f, -9.0f, -8.5227f, 1.0f, 1.0f, 8.0f, new CubeDeformation(0.0f)).texOffs(0, 16).addBox(-20.2635f, -9.0f, -7.5227f, 1.0f, 1.0f, 15.0f, new CubeDeformation(0.0f)).texOffs(0, 16).addBox(-21.2635f, -9.0f, -6.5227f, 1.0f, 1.0f, 13.0f, new CubeDeformation(0.0f)).texOffs(0, 20).addBox(-22.2635f, -9.0f, -5.3864f, 1.0f, 1.0f, 11.0f, new CubeDeformation(0.0f)), PartPose.offset(0.0f, 24.0f, 0.0f));
PartDefinition hull_side = partdefinition.addOrReplaceChild("hull_side", CubeListBuilder.create().texOffs(0, 28).addBox(-14.7635f, -7.0f, -11.9906f, 26.0f, 3.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 28).addBox(-14.7635f, -6.0f, -12.9906f, 26.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offset(0.0f, 24.0f, 0.0f));
hull_side.addOrReplaceChild("cube_r5", CubeListBuilder.create().texOffs(0, 28).addBox(-19.5f, -1.5f, 0.0f, 26.0f, 3.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 28).addBox(-19.5f, -0.5f, -1.0f, 26.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(4.7365f, -5.5f, 12.0094f, 3.1416f, 0.0f, 0.0f));
partdefinition.addOrReplaceChild("water_patch", CubeListBuilder.create().texOffs(0, 1).addBox(-16.0f, -7.0f, -11.0f, 30.0f, 3.0f, 22.0f, new CubeDeformation(0.0f)), PartPose.offset(0.0f, 24.0f, 0.0f));
return LayerDefinition.create(meshdefinition, 32, 32);
}
public ModelPart waterPatch() {
return this.water_patch;
}
public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
}
public void m_7695_(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
this.hull_back_and_bottom.render(poseStack, buffer, packedLight, packedOverlay);
this.tail.render(poseStack, buffer, packedLight, packedOverlay);
this.glass_window.render(poseStack, buffer, packedLight, packedOverlay);
this.hull_top.render(poseStack, buffer, packedLight, packedOverlay);
this.hull_side.render(poseStack, buffer, packedLight, packedOverlay);
}
}

View File

@ -1,85 +0,0 @@
package com.dairymoose.entity;
import com.dairymoose.entity.MotorboatEntity;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Vector3f;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.culling.Frustum;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@OnlyIn(Dist.CLIENT)
/* loaded from: outputsrg.jar:com/dairymoose/entity/MotorboatRenderer.class */
public final class MotorboatRenderer extends EntityRenderer<MotorboatEntity> {
private float modelScale;
private final MotorboatModel motorboatModel;
private static final Logger LOGGER = LogManager.getLogger();
private static final ResourceLocation texture = new ResourceLocation("modernlife", "textures/entity/motorboat_uv.png");
public MotorboatRenderer(EntityRendererProvider.Context ctx) {
super(ctx);
this.modelScale = 1.0f;
this.motorboatModel = new MotorboatModel(ctx.bakeLayer(MotorboatModel.MOTORBOAT));
}
public boolean shouldRender(MotorboatEntity p_225626_1_, Frustum p_225626_2_, double p_225626_3_, double p_225626_5_, double p_225626_7_) {
return true;
}
public void render(MotorboatEntity motorboatEntity, float p_225623_2_, float p_225623_3_, PoseStack matrixStack, MultiBufferSource buffer, int p_225623_6_) {
motorboatEntity.position();
matrixStack.pushPose();
matrixStack.translate(0.0d, 1.5d, 0.0d);
matrixStack.mulPose(Vector3f.YP.rotationDegrees(270.0f - p_225623_2_));
float lvt_7_1_ = motorboatEntity.getHurtTime() - p_225623_3_;
float lvt_8_1_ = motorboatEntity.getDamage() - p_225623_3_;
if (lvt_8_1_ < 0.0f) {
lvt_8_1_ = 0.0f;
}
if (lvt_7_1_ > 0.0f) {
matrixStack.mulPose(Vector3f.XP.rotationDegrees((((Mth.sin(lvt_7_1_) * lvt_7_1_) * lvt_8_1_) / 10.0f) * motorboatEntity.getHurtDir()));
}
matrixStack.scale(-this.modelScale, -this.modelScale, this.modelScale);
this.motorboatModel.setupAnim(motorboatEntity, p_225623_3_, 0.0f, -0.1f, 0.0f, 0.0f);
VertexConsumer builder = buffer.getBuffer(this.motorboatModel.m_103119_(getTextureLocation(motorboatEntity)));
this.motorboatModel.m_7695_(matrixStack, builder, p_225623_6_, OverlayTexture.NO_OVERLAY, 1.0f, 1.0f, 1.0f, 1.0f);
if (!motorboatEntity.isUnderWater()) {
VertexConsumer vertexconsumer1 = buffer.getBuffer(RenderType.waterMask());
this.motorboatModel.waterPatch().render(matrixStack, vertexconsumer1, p_225623_6_, OverlayTexture.NO_OVERLAY);
}
matrixStack.popPose();
Entity controller = motorboatEntity.getControllingPassenger();
if (controller != null && motorboatEntity.tickCount % 2 == 0 && motorboatEntity.status == MotorboatEntity.Status.IN_WATER && !motorboatEntity.isOutOfFuel()) {
Vec3 vec3 = new Vec3(1.65d, 0.45d, 0.0d).yRot(-((motorboatEntity.getYRot() * 0.017453292f) - 1.5707964f));
Vec3 particleLocation = motorboatEntity.position().add(vec3);
int count = 1;
if (!motorboatEntity.isBackingUp() && motorboatEntity.getDeltaMovement().lengthSqr() > 0.0144d) {
float accelPct = motorboatEntity.getCurAccel() / motorboatEntity.getMaxAccel();
count = Math.max(1, (int) Math.ceil(12 * accelPct));
}
for (int i = 0; i < count; i++) {
double xRand = ((Math.random() * 2.0d) * 0.6d) - 0.6d;
double yRand = ((Math.random() * 2.0d) * 0.3d) - 0.3d;
double zRand = ((Math.random() * 2.0d) * 0.6d) - 0.6d;
motorboatEntity.level.addParticle(ParticleTypes.SPLASH, particleLocation.x - xRand, particleLocation.y + yRand, particleLocation.z + zRand, 1.0d, 1.0d, 1.0d);
}
}
super.render(motorboatEntity, p_225623_2_, p_225623_3_, matrixStack, buffer, p_225623_6_);
}
public ResourceLocation getTextureLocation(MotorboatEntity var1) {
return texture;
}
}

View File

@ -1,27 +0,0 @@
package com.dairymoose.entity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.block.state.BlockState;
/* loaded from: outputsrg.jar:com/dairymoose/entity/RenderableBlock.class */
public class RenderableBlock {
public BlockPos pos;
public double relativeX;
public double relativeY;
public double relativeZ;
public BlockState state;
public float offset = 0.0f;
public RenderableBlock(Entity e, BlockPos pos, BlockState state) {
this.pos = pos;
this.relativeX = pos.getX() - e.blockPosition().getX();
this.relativeY = pos.getY() - e.blockPosition().getY();
this.relativeZ = pos.getZ() - e.blockPosition().getZ();
this.state = state;
}
public String toString() {
return "RenderableBlock [pos=" + this.pos + ", state=" + this.state + "]";
}
}

View File

@ -1,61 +0,0 @@
package com.dairymoose.entity;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
/* loaded from: outputsrg.jar:com/dairymoose/entity/SpeedboatModel.class */
public class SpeedboatModel<T extends Entity> extends EntityModel<T> {
public static final ModelLayerLocation SPEEDBOAT = new ModelLayerLocation(new ResourceLocation("modernlife", "motorboat"), "main");
private final ModelPart hull_back_and_bottom;
private final ModelPart tail;
private final ModelPart glass_window;
private final ModelPart hull_top;
private final ModelPart hull_side;
public SpeedboatModel(ModelPart root) {
this.hull_back_and_bottom = root.getChild("hull_back_and_bottom");
this.tail = root.getChild("tail");
this.glass_window = root.getChild("glass_window");
this.hull_top = root.getChild("hull_top");
this.hull_side = root.getChild("hull_side");
}
public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot();
PartDefinition hull_back_and_bottom = partdefinition.addOrReplaceChild("hull_back_and_bottom", CubeListBuilder.create().texOffs(0, 15).addBox(11.2365f, -8.0f, -10.5719f, 7.0f, 1.0f, 8.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -8.0f, -2.5719f, 7.0f, 1.0f, 5.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -8.0f, 2.4281f, 7.0f, 1.0f, 8.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-15.7635f, -3.0f, 3.4281f, 9.0f, 1.0f, 6.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(9.2365f, -3.0f, 3.4281f, 9.0f, 1.0f, 6.0f, new CubeDeformation(0.0f)).texOffs(0, 24).addBox(-15.7635f, -3.0f, -9.5719f, 9.0f, 1.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 24).addBox(-6.7635f, -3.0f, -9.5719f, 9.0f, 1.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 24).addBox(1.2365f, -3.0f, -9.5719f, 8.0f, 1.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 24).addBox(-6.7635f, -3.0f, -2.5719f, 9.0f, 1.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 24).addBox(1.2365f, -3.0f, -2.5719f, 8.0f, 1.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 24).addBox(-6.7635f, -3.0f, 4.4281f, 8.0f, 1.0f, 4.0f, new CubeDeformation(0.0f)).texOffs(0, 24).addBox(1.2365f, -3.0f, 4.4281f, 8.0f, 1.0f, 4.0f, new CubeDeformation(0.0f)).texOffs(0, 24).addBox(9.2365f, -3.0f, -9.5719f, 9.0f, 1.0f, 6.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-15.7635f, -3.0f, -2.5719f, 9.0f, 1.0f, 6.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(9.2365f, -3.0f, -3.5719f, 9.0f, 1.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-14.7635f, -2.0f, -7.5719f, 33.0f, 1.0f, 15.0f, new CubeDeformation(0.0f)).texOffs(0, 19).addBox(2.2365f, -1.0f, -5.5719f, 16.0f, 1.0f, 6.0f, new CubeDeformation(0.0f)).texOffs(0, 19).addBox(2.2365f, -1.0f, 0.4281f, 16.0f, 1.0f, 5.0f, new CubeDeformation(0.0f)).texOffs(0, 19).addBox(-13.7635f, -1.0f, -5.5719f, 16.0f, 1.0f, 6.0f, new CubeDeformation(0.0f)).texOffs(0, 19).addBox(-13.7635f, -1.0f, 0.4281f, 16.0f, 1.0f, 5.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-15.7635f, -4.0f, -10.9636f, 16.0f, 1.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-15.7635f, -4.0f, 0.0364f, 16.0f, 1.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(0.2365f, -4.0f, 0.0364f, 18.0f, 1.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(0.2365f, -4.0f, -10.9636f, 18.0f, 1.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -5.0f, -11.5719f, 7.0f, 1.0f, 23.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -6.0f, -12.5719f, 7.0f, 1.0f, 25.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -7.0f, -11.5719f, 7.0f, 1.0f, 9.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -7.0f, -2.5719f, 7.0f, 1.0f, 5.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(11.2365f, -7.0f, 2.4281f, 7.0f, 1.0f, 9.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-15.7635f, -7.0f, -10.5719f, 1.0f, 3.0f, 21.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-16.7635f, -7.0f, 0.4281f, 1.0f, 3.0f, 9.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-16.7635f, -7.0f, -9.5719f, 1.0f, 3.0f, 10.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-17.7635f, -7.0f, -8.5719f, 1.0f, 3.0f, 8.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-17.7635f, -7.0f, -0.5719f, 1.0f, 3.0f, 9.0f, new CubeDeformation(0.0f)).texOffs(0, 17).addBox(-18.7635f, -7.0f, 0.4281f, 1.0f, 3.0f, 7.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-18.7635f, -7.0f, -7.5719f, 1.0f, 3.0f, 8.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-19.7635f, -7.0f, -6.5719f, 1.0f, 3.0f, 13.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-20.7635f, -7.0f, -5.5719f, 1.0f, 3.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-23.2635f, -8.0f, -4.5f, 1.0f, 5.0f, 9.0f, new CubeDeformation(0.0f)), PartPose.offset(0.0f, 24.0f, 0.0f));
hull_back_and_bottom.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 15).addBox(3.5f, -2.5f, 3.0f, 1.0f, 5.0f, 11.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(-21.7635f, -5.5f, 0.1651f, -3.1416f, 0.7854f, 3.1416f));
hull_back_and_bottom.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(0, 15).addBox(-4.5f, -2.5f, 2.0f, 1.0f, 5.0f, 12.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(-21.7635f, -5.5f, 0.1651f, 0.0f, 0.7854f, 0.0f));
PartDefinition tail = partdefinition.addOrReplaceChild("tail", CubeListBuilder.create(), PartPose.offset(0.0f, 24.0f, 0.0f));
tail.addOrReplaceChild("cube_r3", CubeListBuilder.create().texOffs(26, 0).addBox(2.0f, -15.9f, -8.0f, 2.0f, 8.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 19).addBox(2.0f, -15.9f, 5.0f, 2.0f, 1.0f, 12.0f, new CubeDeformation(0.0f)).texOffs(0, 16).addBox(2.0f, -15.9f, -7.0f, 2.0f, 1.0f, 12.0f, new CubeDeformation(0.0f)).texOffs(26, 0).addBox(2.0f, -15.9f, 17.0f, 2.0f, 8.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(3.7365f, 0.0f, -5.0f, 0.0f, 0.0f, 0.3491f));
PartDefinition glass_window = partdefinition.addOrReplaceChild("glass_window", CubeListBuilder.create(), PartPose.offset(0.0f, 24.0f, 0.0f));
glass_window.addOrReplaceChild("cube_r4", CubeListBuilder.create().texOffs(0, 0).addBox(-18.0f, -10.75f, 6.0f, 1.0f, 4.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(0, 0).addBox(-18.0f, -10.75f, -5.0f, 1.0f, 4.0f, 11.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(3.7365f, 0.0f, -6.0f, 0.0f, 0.0f, 0.2618f));
partdefinition.addOrReplaceChild("hull_top", CubeListBuilder.create().texOffs(0, 16).addBox(-16.2635f, -10.0f, -0.6364f, 2.0f, 2.0f, 12.0f, new CubeDeformation(0.0f)).texOffs(0, 16).addBox(-16.2635f, -10.0f, -11.6364f, 2.0f, 2.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(12, 27).addBox(-14.2635f, -10.0f, -12.5187f, 14.0f, 3.0f, 2.0f, new CubeDeformation(0.0f)).texOffs(0, 16).addBox(-14.2635f, -11.0f, -11.1364f, 4.0f, 3.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(0, 16).addBox(-14.2635f, -11.0f, -0.1364f, 4.0f, 3.0f, 12.0f, new CubeDeformation(0.0f)).texOffs(12, 27).addBox(-14.2635f, -10.0f, 10.4813f, 14.0f, 3.0f, 2.0f, new CubeDeformation(0.0f)).texOffs(0, 16).addBox(-17.2635f, -9.0f, 0.4773f, 1.0f, 1.0f, 10.0f, new CubeDeformation(0.0f)).texOffs(0, 16).addBox(-18.2635f, -9.0f, 1.4773f, 1.0f, 1.0f, 8.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-19.2635f, -9.0f, -0.5227f, 1.0f, 1.0f, 9.0f, new CubeDeformation(0.0f)).texOffs(5, 18).addBox(-17.2635f, -9.0f, -10.5227f, 1.0f, 1.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(2, 17).addBox(-18.2635f, -9.0f, -9.5227f, 1.0f, 1.0f, 11.0f, new CubeDeformation(0.0f)).texOffs(0, 15).addBox(-19.2635f, -9.0f, -8.5227f, 1.0f, 1.0f, 8.0f, new CubeDeformation(0.0f)).texOffs(0, 16).addBox(-20.2635f, -9.0f, -7.5227f, 1.0f, 1.0f, 15.0f, new CubeDeformation(0.0f)).texOffs(0, 16).addBox(-21.2635f, -9.0f, -6.5227f, 1.0f, 1.0f, 13.0f, new CubeDeformation(0.0f)).texOffs(0, 20).addBox(-22.2635f, -9.0f, -5.3864f, 1.0f, 1.0f, 11.0f, new CubeDeformation(0.0f)), PartPose.offset(0.0f, 24.0f, 0.0f));
PartDefinition hull_side = partdefinition.addOrReplaceChild("hull_side", CubeListBuilder.create().texOffs(0, 28).addBox(-14.7635f, -7.0f, -11.9906f, 26.0f, 3.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 28).addBox(-14.7635f, -6.0f, -12.9906f, 26.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offset(0.0f, 24.0f, 0.0f));
hull_side.addOrReplaceChild("cube_r5", CubeListBuilder.create().texOffs(0, 28).addBox(-19.5f, -1.5f, 0.0f, 26.0f, 3.0f, 1.0f, new CubeDeformation(0.0f)).texOffs(0, 28).addBox(-19.5f, -0.5f, -1.0f, 26.0f, 1.0f, 1.0f, new CubeDeformation(0.0f)), PartPose.offsetAndRotation(4.7365f, -5.5f, 12.0094f, 3.1416f, 0.0f, 0.0f));
partdefinition.addOrReplaceChild("water_patch", CubeListBuilder.create().texOffs(0, 1).addBox(-16.0f, -7.0f, -11.0f, 30.0f, 3.0f, 22.0f, new CubeDeformation(0.0f)), PartPose.offset(0.0f, 24.0f, 0.0f));
return LayerDefinition.create(meshdefinition, 32, 32);
}
public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
}
public void m_7695_(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
this.hull_back_and_bottom.render(poseStack, buffer, packedLight, packedOverlay);
this.tail.render(poseStack, buffer, packedLight, packedOverlay);
this.glass_window.render(poseStack, buffer, packedLight, packedOverlay);
this.hull_top.render(poseStack, buffer, packedLight, packedOverlay);
this.hull_side.render(poseStack, buffer, packedLight, packedOverlay);
}
}

View File

@ -1,101 +0,0 @@
package com.dairymoose.entity.projectile;
import com.mojang.authlib.GameProfile;
import java.util.UUID;
import net.minecraft.core.particles.ItemParticleOption;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.network.protocol.Packet;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraftforge.network.NetworkHooks;
/* loaded from: outputsrg.jar:com/dairymoose/entity/projectile/ThrownSeedEntity.class */
public class ThrownSeedEntity extends ThrowableItemProjectile {
public static final EntityType<ThrownSeedEntity> THROWN_SEED_ENTITY = EntityType.Builder.of(ThrownSeedEntity::new, MobCategory.MISC).sized(0.25f, 0.25f).clientTrackingRange(4).updateInterval(10).build(new ResourceLocation("modernlife", "thrown_seed").toString());
ServerPlayer dummy;
public ThrownSeedEntity(EntityType<? extends ThrownSeedEntity> entityType, Level world) {
super(entityType, world);
this.dummy = null;
}
public Packet<?> getAddEntityPacket() {
return NetworkHooks.getEntitySpawningPacket(this);
}
public ThrownSeedEntity(Level world, double x, double y, double z) {
super(THROWN_SEED_ENTITY, x, y, z, world);
this.dummy = null;
}
protected Item getDefaultItem() {
return Items.SNOWBALL;
}
@OnlyIn(Dist.CLIENT)
private ParticleOptions getParticle() {
ItemStack lvt_1_1_ = getItemRaw();
return lvt_1_1_.isEmpty() ? ParticleTypes.ITEM_SNOWBALL : new ItemParticleOption(ParticleTypes.ITEM, lvt_1_1_);
}
@OnlyIn(Dist.CLIENT)
public void handleEntityEvent(byte p_70103_1_) {
if (p_70103_1_ == 3) {
ParticleOptions lvt_2_1_ = getParticle();
for (int lvt_3_1_ = 0; lvt_3_1_ < 8; lvt_3_1_++) {
this.level.addParticle(lvt_2_1_, getX(), getY(), getZ(), 0.0d, 0.0d, 0.0d);
}
}
}
protected void m_8060_(BlockHitResult p_230299_1_) {
super.m_8060_(p_230299_1_);
ServerLevel serverLevel = this.level;
BlockState state = this.level.getBlockState(p_230299_1_.getBlockPos());
BlockState aboveState = this.level.getBlockState(p_230299_1_.getBlockPos().above());
if ((state.is(Blocks.FARMLAND) || (getItem() != null && getItem().getItem() == Items.NETHER_WART && state.is(Blocks.SOUL_SAND))) && aboveState.is(Blocks.AIR)) {
ItemStack itemStack = getItem();
if (itemStack != null && (serverLevel instanceof ServerLevel)) {
if (this.dummy == null) {
GameProfile profile = new GameProfile(UUID.randomUUID(), "[seed_spreader_player]");
this.dummy = FakePlayerFactory.get(serverLevel, profile);
}
this.dummy.setItemInHand(InteractionHand.MAIN_HAND, itemStack);
itemStack.useOn(new UseOnContext(this.dummy, InteractionHand.MAIN_HAND, p_230299_1_));
remove(RemovalReason.DISCARDED);
return;
}
return;
}
if (serverLevel instanceof ServerLevel) {
spawnAtLocation(getItem());
remove(RemovalReason.DISCARDED);
}
}
protected void m_5790_(EntityHitResult p_70227_1_) {
if (!this.level.isClientSide) {
spawnAtLocation(getItem());
remove(RemovalReason.DISCARDED);
}
}
}

View File

@ -1,19 +0,0 @@
package com.dairymoose.inventory.container;
import net.minecraft.world.inventory.DataSlot;
/* loaded from: outputsrg.jar:com/dairymoose/inventory/container/IncrementingDataHolder.class */
public class IncrementingDataHolder extends DataSlot {
/* renamed from: x */
int f0x = 0;
public int get() {
int i = this.f0x;
this.f0x = i + 1;
return i;
}
public void set(int arg0) {
}
}

View File

@ -1,165 +0,0 @@
package com.dairymoose.inventory.container;
import com.dairymoose.modernlife.core.ModernLifeCommon;
import com.dairymoose.modernlife.network.play.client.ServerboundTrashCanPacket;
import net.minecraft.world.Container;
import net.minecraft.world.SimpleContainer;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.ContainerListener;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/* loaded from: outputsrg.jar:com/dairymoose/inventory/container/TrashCanContainer.class */
public class TrashCanContainer extends AbstractContainerMenu {
public static final MenuType<TrashCanContainer> TRASH_CAN_CONTAINER_TYPE = new MenuType<>(TrashCanContainer::new);
private static final Logger LOGGER = LogManager.getLogger();
private final Container container;
private final int containerRows;
private Slot trashSlot;
Inventory playerInventory;
public TrashCanContainer(int containerId, Inventory playerInventory, Container trashCanInventory) {
this(TRASH_CAN_CONTAINER_TYPE, containerId, playerInventory, trashCanInventory, 1);
}
public TrashCanContainer(int containerId, Inventory playerInventory) {
this(TRASH_CAN_CONTAINER_TYPE, containerId, playerInventory, new SimpleContainer(8), 1);
}
public TrashCanContainer(MenuType<?> p_i50092_1_, int p_i50092_2_, Inventory playerInventory, Container trashCanInventory, int containerRows) {
super(p_i50092_1_, p_i50092_2_);
this.trashSlot = null;
AbstractContainerMenu.checkContainerSize(trashCanInventory, 8);
this.container = trashCanInventory;
this.containerRows = containerRows;
trashCanInventory.startOpen(playerInventory.player);
this.playerInventory = playerInventory;
int trashInventoryIndex = 0 + 1;
this.trashSlot = addSlot(new Slot(trashCanInventory, 0, 8, 18));
for (int i = 0; i < 7; i++) {
int i2 = trashInventoryIndex;
trashInventoryIndex++;
addSlot(new Slot(trashCanInventory, i2, 44 + (i * 18), 18));
}
for (int row = 0; row < 3; row++) {
for (int col = 0; col < 9; col++) {
addSlot(new Slot(playerInventory, col + (row * 9) + 9, 8 + (col * 18), 50 + (row * 18)));
}
}
for (int col2 = 0; col2 < 9; col2++) {
addSlot(new Slot(playerInventory, col2, 8 + (col2 * 18), 108));
}
addDataSlot(new IncrementingDataHolder());
if (!this.playerInventory.player.level.isClientSide) {
addSlotListener(new ContainerListener() { // from class: com.dairymoose.inventory.container.TrashCanContainer.1
final /* synthetic */ TrashCanContainer val$thisContainer;
C00041(TrashCanContainer this) {
this = this;
}
public void dataChanged(AbstractContainerMenu paramContainer, int index, int data) {
if (paramContainer == this) {
ItemStack paramItemStack = paramContainer.getSlot(index).getItem();
if (TrashCanContainer.this.trashSlot != null && index == TrashCanContainer.this.trashSlot.index && paramItemStack != ItemStack.EMPTY) {
ModernLifeCommon.LOGGER.debug("server trash can");
if (paramContainer instanceof TrashCanContainer) {
TrashCanContainer trashCanContainer = (TrashCanContainer) paramContainer;
if (ServerboundTrashCanPacket.playerHasItem(((TrashCanContainer) paramContainer).playerInventory.player, paramItemStack)) {
trashCanContainer.trashItem(paramItemStack);
}
}
}
}
}
public void slotChanged(AbstractContainerMenu var1, int var2, ItemStack var3) {
}
});
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: com.dairymoose.inventory.container.TrashCanContainer$1 */
/* loaded from: outputsrg.jar:com/dairymoose/inventory/container/TrashCanContainer$1.class */
public class C00041 implements ContainerListener {
final /* synthetic */ TrashCanContainer val$thisContainer;
C00041(TrashCanContainer this) {
this = this;
}
public void dataChanged(AbstractContainerMenu paramContainer, int index, int data) {
if (paramContainer == this) {
ItemStack paramItemStack = paramContainer.getSlot(index).getItem();
if (TrashCanContainer.this.trashSlot != null && index == TrashCanContainer.this.trashSlot.index && paramItemStack != ItemStack.EMPTY) {
ModernLifeCommon.LOGGER.debug("server trash can");
if (paramContainer instanceof TrashCanContainer) {
TrashCanContainer trashCanContainer = (TrashCanContainer) paramContainer;
if (ServerboundTrashCanPacket.playerHasItem(((TrashCanContainer) paramContainer).playerInventory.player, paramItemStack)) {
trashCanContainer.trashItem(paramItemStack);
}
}
}
}
}
public void slotChanged(AbstractContainerMenu var1, int var2, ItemStack var3) {
}
}
public void trashItem(ItemStack toTrash) {
for (int i = 7; i > 1; i--) {
getSlot(i).set(this.container.getItem(i - 1));
}
getSlot(1).set(toTrash);
getSlot(0).set(ItemStack.EMPTY);
}
public boolean stillValid(Player p_75145_1_) {
return this.container.stillValid(p_75145_1_);
}
public ItemStack quickMoveStack(Player p_82846_1_, int p_82846_2_) {
ItemStack lvt_3_1_ = ItemStack.EMPTY;
Slot lvt_4_1_ = (Slot) this.slots.get(p_82846_2_);
if (lvt_4_1_ != null && lvt_4_1_.hasItem()) {
ItemStack lvt_5_1_ = lvt_4_1_.getItem();
lvt_3_1_ = lvt_5_1_.copy();
if (p_82846_2_ < 8) {
if (!moveItemStackTo(lvt_5_1_, 8, this.slots.size(), true)) {
return ItemStack.EMPTY;
}
} else if (!moveItemStackTo(lvt_5_1_, 0, 8, false)) {
return ItemStack.EMPTY;
}
if (lvt_5_1_.isEmpty()) {
lvt_4_1_.set(ItemStack.EMPTY);
} else {
lvt_4_1_.setChanged();
}
}
return lvt_3_1_;
}
public void removed(Player p_75134_1_) {
super.removed(p_75134_1_);
this.container.stopOpen(p_75134_1_);
}
public Container getContainer() {
return this.container;
}
@OnlyIn(Dist.CLIENT)
public int getRowCount() {
return this.containerRows;
}
}

View File

@ -1,56 +0,0 @@
package com.dairymoose.modernlife.blocks;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.AttachFace;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/AbstractPanelBlock.class */
public class AbstractPanelBlock extends Block {
public static final EnumProperty<AttachFace> FACE = BlockStateProperties.ATTACH_FACE;
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public AbstractPanelBlock(Properties p_i48440_1_) {
super(p_i48440_1_);
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
@Deprecated
public VoxelShape getOcclusionShape(BlockState p_196247_1_, BlockGetter p_196247_2_, BlockPos p_196247_3_) {
return Shapes.empty();
}
@Nullable
public BlockState getStateForPlacement(BlockPlaceContext p_196258_1_) {
Direction horDir = p_196258_1_.getHorizontalDirection();
Direction clickedFace = p_196258_1_.getClickedFace();
p_196258_1_.getClickedPos();
p_196258_1_.isInside();
AttachFace attach = AttachFace.WALL;
if (clickedFace == Direction.UP) {
attach = AttachFace.FLOOR;
} else if (clickedFace == Direction.DOWN) {
attach = AttachFace.CEILING;
}
return (BlockState) ((BlockState) defaultBlockState().setValue(FACE, attach)).setValue(FACING, horDir.getOpposite());
}
}

View File

@ -1,48 +0,0 @@
package com.dairymoose.modernlife.blocks;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/AbstractWallBlock.class */
public abstract class AbstractWallBlock extends Block {
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
public AbstractWallBlock(Properties p_i241196_1_) {
super(p_i241196_1_);
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
return FaceAttachedHorizontalDirectionalBlock.canAttach(p_196260_2_, p_196260_3_, p_196260_1_.getValue(FACING).getOpposite());
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
Direction[] var2 = context.getNearestLookingDirections();
for (Direction lvt_5_1_ : var2) {
if (lvt_5_1_.getAxis() != Direction.Axis.Y) {
BlockState lvt_6_2_ = (BlockState) defaultBlockState().setValue(FACING, lvt_5_1_.getOpposite());
if (lvt_6_2_.canSurvive(context.getLevel(), context.getClickedPos())) {
return lvt_6_2_;
}
}
}
return defaultBlockState();
}
}

View File

@ -1,74 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/AirConditionerBlock.class */
public class AirConditionerBlock extends StandardHorizontalBlock {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of(Block.box(0.0d, 0.0d, 0.0d, 15.0d, 16.0d, 15.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public AirConditionerBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState) defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, context.getHorizontalDirection().getOpposite());
}
/* renamed from: com.dairymoose.modernlife.blocks.AirConditionerBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/AirConditionerBlock$1.class */
static /* synthetic */ class C00051 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00051.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,73 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.tileentities.AlarmClockBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/AlarmClockBlock.class */
public class AlarmClockBlock extends StandardHorizontalBlock implements EntityBlock {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(3.5d, 0.5d, 12.0d, 12.5d, 4.5d, 13.0d), Block.box(3.0d, 0.0d, 8.0d, 13.0d, 5.0d, 12.99d)}).reduce((v1, v2) -> Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR)).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public AlarmClockBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
public BlockEntity newBlockEntity(BlockPos state, BlockState world) {
return AlarmClockBlockEntity.ALARM_CLOCK.create(state, world);
}
/* renamed from: com.dairymoose.modernlife.blocks.AlarmClockBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/AlarmClockBlock$1.class */
static /* synthetic */ class C00061 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00061.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,20 +0,0 @@
package com.dairymoose.modernlife.blocks;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/AlmostFullBlock.class */
public class AlmostFullBlock extends StandardHorizontalBlock {
public AlmostFullBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
public VoxelShape getShape(BlockState p_220053_1_, BlockGetter p_220053_2_, BlockPos p_220053_3_, CollisionContext p_220053_4_) {
return Block.box(0.01d, 0.0d, 0.01d, 15.99d, 16.0d, 15.99d);
}
}

View File

@ -1,72 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/ArrowSlitBlock.class */
public class ArrowSlitBlock extends StandardHorizontalBlock {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(0.0d, 0.0d, 12.0d, 16.0d, 4.0d, 16.0d), Block.box(0.0d, 13.75d, 12.0d, 16.0d, 16.0d, 16.0d), Block.box(10.25d, 4.0d, 12.0d, 16.0d, 16.0d, 16.0d), Block.box(8.75d, 4.0d, 12.0d, 12.0d, 7.25d, 16.0d), Block.box(4.0d, 4.0d, 12.0d, 7.25d, 7.25d, 16.0d), Block.box(4.0d, 10.5d, 12.0d, 7.25d, 14.5d, 16.0d), Block.box(8.75d, 10.5d, 12.0d, 12.0d, 14.5d, 16.0d), Block.box(4.0d, 13.75d, 12.0d, 12.0d, 16.0d, 16.0d), Block.box(0.0d, 4.0d, 12.0d, 5.75d, 16.0d, 16.0d)}).reduce((v1, v2) -> Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR)).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public ArrowSlitBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState) defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, context.getHorizontalDirection());
}
/* renamed from: com.dairymoose.modernlife.blocks.ArrowSlitBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/ArrowSlitBlock$1.class */
static /* synthetic */ class C00071 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00071.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,83 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/BarrierBlock.class */
public class BarrierBlock extends StandardHorizontalBlock {
protected static final VoxelShape SHAPE_SOUTH = Block.box(0.0d, 0.0d, 12.0d, 16.0d, 16.0d, 16.0d);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public BarrierBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 20;
}
return 0;
}
public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 5;
}
return 0;
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState) defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, context.getHorizontalDirection());
}
/* renamed from: com.dairymoose.modernlife.blocks.BarrierBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/BarrierBlock$1.class */
static /* synthetic */ class C00081 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00081.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,251 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.entity.DummyEntity;
import com.dairymoose.modernlife.core.CustomBlocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.Mth;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/BathtubBlock.class */
public class BathtubBlock extends Block implements SimpleWaterloggedBlock {
protected static final VoxelShape SHAPE_EAST = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(0.0d, 0.0d, 0.0d, 16.0d, 1.0d, 16.0d), Block.box(0.0d, 1.0d, 0.0d, 3.0d, 10.0d, 16.0d), Block.box(3.0d, 1.0d, 0.0d, 16.0d, 10.0d, 2.0d), Block.box(3.0d, 1.0d, 14.0d, 16.0d, 10.0d, 16.0d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
public static final EnumProperty<TubHalf> HALF = EnumProperty.create("half", TubHalf.class);
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/BathtubBlock$TubHalf.class */
public enum TubHalf implements StringRepresentable {
back,
front;
public String getSerializedName() {
return name().toLowerCase();
}
}
public BathtubBlock(Properties p_i48413_1_) {
super(p_i48413_1_);
registerDefaultState((BlockState) ((BlockState) ((BlockState) this.stateDefinition.any().setValue(FACING, Direction.NORTH)).setValue(HALF, TubHalf.back)).setValue(WATERLOGGED, Boolean.FALSE));
}
public FluidState getFluidState(BlockState p_204507_1_) {
if (((Boolean) p_204507_1_.getValue(WATERLOGGED)).booleanValue()) {
return Fluids.FLOWING_WATER.getFlowing(3, false);
}
return super.getFluidState(p_204507_1_);
}
public BlockState rotate(BlockState p_52790_, Rotation p_52791_) {
return (BlockState) p_52790_.setValue(FACING, p_52791_.rotate(p_52790_.getValue(FACING)));
}
public BlockState mirror(BlockState p_52787_, Mirror p_52788_) {
return p_52788_ == Mirror.NONE ? p_52787_ : p_52787_.rotate(p_52788_.getRotation(p_52787_.getValue(FACING)));
}
public VoxelShape getShape(BlockState p_220053_1_, BlockGetter p_220053_2_, BlockPos p_220053_3_, CollisionContext p_220053_4_) {
Direction lvt_5_1_ = p_220053_1_.getValue(FACING);
if (p_220053_1_.getValue(HALF) == TubHalf.front) {
switch (C00091.$SwitchMap$net$minecraft$core$Direction[lvt_5_1_.ordinal()]) {
case 1:
default:
return SHAPE_EAST;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_WEST;
case 4:
return SHAPE_NORTH;
}
}
switch (C00091.$SwitchMap$net$minecraft$core$Direction[lvt_5_1_.ordinal()]) {
case 1:
default:
return SHAPE_WEST;
case 2:
return SHAPE_NORTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_SOUTH;
}
}
/* renamed from: com.dairymoose.modernlife.blocks.BathtubBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/BathtubBlock$1.class */
static /* synthetic */ class C00091 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
Direction checkDir;
TubHalf lvt_7_1_ = (TubHalf) p_196271_1_.getValue(HALF);
if (p_196271_1_.getValue(FACING) == Direction.EAST) {
checkDir = Direction.WEST;
} else if (p_196271_1_.getValue(FACING) == Direction.WEST) {
checkDir = Direction.EAST;
} else if (p_196271_1_.getValue(FACING) == Direction.NORTH) {
checkDir = Direction.SOUTH;
} else {
checkDir = Direction.NORTH;
}
if (lvt_7_1_ == TubHalf.back && p_196271_5_.relative(checkDir).equals(p_196271_6_) && !p_196271_3_.is(this)) {
return Blocks.AIR.defaultBlockState();
}
if (lvt_7_1_ == TubHalf.front && p_196271_5_.relative(checkDir.getOpposite()).equals(p_196271_6_) && !p_196271_3_.is(this)) {
return Blocks.AIR.defaultBlockState();
}
return super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
protected static void preventCreativeDropFromBottomPart(Level p_241471_0_, BlockPos p_241471_1_, BlockState p_241471_2_, Player p_241471_3_) {
TubHalf BenchHalf = (TubHalf) p_241471_2_.getValue(HALF);
if (BenchHalf == TubHalf.front) {
BlockPos blockpos = p_241471_1_.below();
BlockState blockstate = p_241471_0_.getBlockState(blockpos);
if (blockstate.getBlock() == p_241471_2_.getBlock() && blockstate.getValue(HALF) == TubHalf.back) {
p_241471_0_.setBlock(blockpos, Blocks.AIR.defaultBlockState(), 35);
p_241471_0_.levelEvent(p_241471_3_, 2001, blockpos, Block.getId(blockstate));
}
}
}
public void playerWillDestroy(Level p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, Player p_176208_4_) {
if (!p_176208_1_.isClientSide && p_176208_4_.isCreative()) {
preventCreativeDropFromBottomPart(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
super.playerWillDestroy(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
@Nullable
public BlockState getStateForPlacement(BlockPlaceContext p_196258_1_) {
BlockPos lvt_2_1_ = p_196258_1_.getClickedPos();
if (lvt_2_1_.getY() < p_196258_1_.getLevel().getMaxBuildHeight() && p_196258_1_.getLevel().getBlockState(lvt_2_1_.relative(p_196258_1_.getHorizontalDirection())).canBeReplaced(p_196258_1_)) {
Level lvt_3_1_ = p_196258_1_.getLevel();
boolean z = lvt_3_1_.hasNeighborSignal(lvt_2_1_) || lvt_3_1_.hasNeighborSignal(lvt_2_1_.above());
return (BlockState) ((BlockState) defaultBlockState().setValue(FACING, p_196258_1_.getHorizontalDirection().getOpposite())).setValue(HALF, TubHalf.back);
}
return null;
}
public ItemStack pickupBlock(LevelAccessor p_154560_, BlockPos p_154561_, BlockState p_154562_) {
if (((Boolean) p_154562_.getValue(BlockStateProperties.WATERLOGGED)).booleanValue()) {
p_154560_.setBlock(p_154561_, (BlockState) p_154562_.setValue(BlockStateProperties.WATERLOGGED, false), 3);
return new ItemStack(Items.WATER_BUCKET);
}
return ItemStack.EMPTY;
}
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos p_225533_3_, Player player, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
if (player.getVehicle() != null && p_225533_1_.getValue(HALF) == TubHalf.front) {
if (((Boolean) p_225533_1_.getValue(WATERLOGGED)).booleanValue()) {
pickupBlock(p_225533_2_, p_225533_3_, p_225533_1_);
BlockPos otherPos = p_225533_3_.relative(p_225533_1_.getValue(FACING));
BlockState otherState = p_225533_2_.getBlockState(otherPos);
if (otherState.is(CustomBlocks.BLOCK_BATHTUB.get())) {
pickupBlock(p_225533_2_, otherPos, otherState);
}
} else {
placeLiquid(p_225533_2_, p_225533_3_, p_225533_1_, Fluids.WATER.getSource().defaultFluidState());
BlockPos otherPos2 = p_225533_3_.relative(p_225533_1_.getValue(FACING));
BlockState otherState2 = p_225533_2_.getBlockState(otherPos2);
if (otherState2.is(CustomBlocks.BLOCK_BATHTUB.get())) {
placeLiquid(p_225533_2_, otherPos2, otherState2, Fluids.WATER.getSource().defaultFluidState());
}
p_225533_2_.playSound((Player) null, p_225533_3_, SoundEvents.GENERIC_SPLASH, SoundSource.BLOCKS, 1.0f, 1.0f);
}
} else if (!p_225533_2_.isClientSide) {
DummyEntity dummy = DummyEntity.getEntity(-0.1f, p_225533_2_, p_225533_3_, true);
dummy.ride(player);
}
return InteractionResult.CONSUME;
}
public void setPlacedBy(Level p_180633_1_, BlockPos p_180633_2_, BlockState p_180633_3_, LivingEntity p_180633_4_, ItemStack p_180633_5_) {
p_180633_1_.setBlock(p_180633_2_.relative(p_180633_4_.getDirection()), (BlockState) p_180633_3_.setValue(HALF, TubHalf.front), 3);
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
BlockPos lvt_4_1_ = p_196260_3_.below();
BlockState lvt_5_1_ = p_196260_2_.getBlockState(lvt_4_1_);
return p_196260_1_.getValue(HALF) == TubHalf.back ? lvt_5_1_.isFaceSturdy(p_196260_2_, lvt_4_1_, Direction.UP) : lvt_5_1_.is(this);
}
public PushReaction getPistonPushReaction(BlockState p_149656_1_) {
return PushReaction.DESTROY;
}
@OnlyIn(Dist.CLIENT)
public long getSeed(BlockState p_209900_1_, BlockPos p_209900_2_) {
return Mth.getSeed(p_209900_2_.getX(), p_209900_2_.below(p_209900_1_.getValue(HALF) == TubHalf.back ? 0 : 1).getY(), p_209900_2_.getZ());
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_206840_1_) {
p_206840_1_.add(new Property[]{HALF, FACING, WATERLOGGED});
}
}

View File

@ -1,145 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.tileentities.CCTVCameraBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/CCTVCameraBlock.class */
public class CCTVCameraBlock extends Block implements EntityBlock {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(6.5d, 5.0d, 0.0d, 9.5d, 8.5d, 5.0d), Block.box(6.5d, 7.75d, 4.4d, 9.5d, 10.5d, 10.1d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public CCTVCameraBlock(Properties props) {
super(props);
registerDefaultState((BlockState) this.stateDefinition.any().setValue(FACING, Direction.SOUTH));
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
@Deprecated
public void onRemove(BlockState p_196243_1_, Level p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
BlockEntity tileEntity = p_196243_2_.getBlockEntity(p_196243_3_);
if (tileEntity instanceof CCTVCameraBlockEntity) {
CCTVCameraBlockEntity.cctvCameras.remove(tileEntity);
}
super.onRemove(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
if (p_196271_1_.getValue(FACING).getOpposite() == p_196271_2_ && !p_196271_1_.canSurvive(p_196271_4_, p_196271_5_)) {
return Blocks.AIR.defaultBlockState();
}
return super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
public void setPlacedBy(Level p_180633_1_, BlockPos p_180633_2_, BlockState p_180633_3_, LivingEntity p_180633_4_, ItemStack p_180633_5_) {
BlockEntity tileEntity = p_180633_1_.getBlockEntity(p_180633_2_);
if (tileEntity instanceof CCTVCameraBlockEntity) {
CCTVCameraBlockEntity cameraBlockEntity = (CCTVCameraBlockEntity) tileEntity;
cameraBlockEntity.setInternalId(CCTVCameraBlockEntity.cctvCameras.size() + 1);
}
}
/* renamed from: com.dairymoose.modernlife.blocks.CCTVCameraBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/CCTVCameraBlock$1.class */
static /* synthetic */ class C00101 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00101.$SwitchMap$net$minecraft$core$Direction[bs.getValue(FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
CCTVCameraBlockEntity toReturn = (CCTVCameraBlockEntity) CCTVCameraBlockEntity.CCTV_CAMERA.create(pos, state);
return toReturn;
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FACING});
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
return FaceAttachedHorizontalDirectionalBlock.canAttach(p_196260_2_, p_196260_3_, p_196260_1_.getValue(FACING).getOpposite());
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
Direction[] var2 = context.getNearestLookingDirections();
for (Direction lvt_5_1_ : var2) {
if (lvt_5_1_.getAxis() != Direction.Axis.Y) {
BlockState lvt_6_2_ = (BlockState) defaultBlockState().setValue(FACING, lvt_5_1_.getOpposite());
if (lvt_6_2_.canSurvive(context.getLevel(), context.getClickedPos())) {
return lvt_6_2_;
}
}
}
return defaultBlockState();
}
}

View File

@ -1,259 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.core.CustomBlocks;
import com.dairymoose.modernlife.core.ModernLifeClient;
import com.dairymoose.modernlife.tileentities.CanvasBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.text.DecimalFormat;
import java.util.List;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.Container;
import net.minecraft.world.Containers;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/CanvasBlock.class */
public class CanvasBlock extends Block implements EntityBlock {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of(Block.box(0.0d, 0.0d, 0.0d, 16.0d, 16.0d, 1.5d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
protected static final VoxelShape SHAPE_SOUTH_SIZE_0 = (VoxelShape) Stream.of(Block.box(0.0d, 0.0d, 0.0d, 15.99d, 15.99d, 1.5d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST_SIZE_0 = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH_SIZE_0);
protected static final VoxelShape SHAPE_NORTH_SIZE_0 = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST_SIZE_0);
protected static final VoxelShape SHAPE_EAST_SIZE_0 = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH_SIZE_0);
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public static final IntegerProperty SIZE = IntegerProperty.create("size", 0, 7);
public static final int MAX_SIZE = ((Integer) SIZE.getPossibleValues().stream().max((i, i2) -> {
return i.intValue() - i2.intValue();
}).get()).intValue();
public CanvasBlock() {
super(Properties.of(Material.CLOTH_DECORATION).sound(SoundType.BAMBOO).strength(1.0f, 10.0f));
registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any().setValue(FACING, Direction.SOUTH)).setValue(SIZE, 1));
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
public void onRemove(BlockState p_196243_1_, Level p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_1_.is(p_196243_4_.getBlock())) {
Container blockEntity = (Container) p_196243_2_.getBlockEntity(p_196243_3_);
if (blockEntity != null) {
Containers.dropContents(p_196243_2_, p_196243_3_, blockEntity);
p_196243_2_.updateNeighbourForOutputSignal(p_196243_3_, this);
}
super.onRemove(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
}
}
public void setPlacedBy(Level worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) {
if (!worldIn.isClientSide) {
BlockEntity e = worldIn.getBlockEntity(pos);
if (e instanceof CanvasBlockEntity) {
CanvasBlockEntity tile = (CanvasBlockEntity) e;
tile.setItem(0, itemStack.copy());
}
}
}
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
Long canvasUniqueId = null;
if (itemStack.getTag() != null && itemStack.getTag().contains("UniqueId")) {
list.add(new TextComponent("A work of art"));
long uniqueId = itemStack.getTag().getLong("UniqueId");
list.add(new TextComponent("ID = " + uniqueId));
canvasUniqueId = Long.valueOf(uniqueId);
} else {
list.add(new TextComponent("For use with an easel"));
}
if (canvasUniqueId != null) {
int width = ModernLifeClient.getCanvasWidth(canvasUniqueId.longValue());
int height = ModernLifeClient.getCanvasHeight(canvasUniqueId.longValue());
list.add(new TextComponent(width + "x" + height + " pixels"));
}
if (itemStack.getTag() != null && itemStack.getTag().contains("Size")) {
int size = itemStack.getTag().getInt("Size");
list.add(new TextComponent(""));
if (size == 1) {
list.add(new TextComponent("Normal print"));
return;
}
if (size == 2) {
list.add(new TextComponent("Large print"));
return;
}
if (size == 3) {
list.add(new TextComponent("Extra Large print"));
return;
}
if (size == 4) {
list.add(new TextComponent("Massive print"));
return;
}
if (size == 5) {
list.add(new TextComponent("Large square print"));
return;
}
if (size == 6) {
list.add(new TextComponent("Extra Large square print"));
return;
}
if (size == 7) {
list.add(new TextComponent("Massive square print"));
return;
}
if (size == 0) {
list.add(new TextComponent("Custom print"));
CompoundTag nbt = itemStack.getTag();
DecimalFormat df = new DecimalFormat("#.##");
if (nbt.contains("BlockWidth") && nbt.contains("BlockHeight")) {
float blockWidth = nbt.getFloat("BlockWidth");
float blockHeight = nbt.getFloat("BlockHeight");
list.add(new TextComponent(df.format(blockWidth) + "x" + df.format(blockHeight)));
}
if (nbt.contains("xOffset") && nbt.contains("yOffset")) {
float xOffset = nbt.getFloat("xOffset");
float yOffset = nbt.getFloat("yOffset");
if (xOffset != 0.0f || yOffset != 0.0f) {
list.add(new TextComponent("(" + df.format(xOffset) + ", " + df.format(yOffset) + ")"));
}
}
}
}
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
if (p_196271_1_.getValue(FACING).getOpposite() == p_196271_2_ && !p_196271_1_.canSurvive(p_196271_4_, p_196271_5_)) {
return Blocks.AIR.defaultBlockState();
}
return super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
/* renamed from: com.dairymoose.modernlife.blocks.CanvasBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/CanvasBlock$1.class */
static /* synthetic */ class C00111 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
if (((Integer) bs.getValue(SIZE)).intValue() == 0) {
switch (C00111.$SwitchMap$net$minecraft$core$Direction[bs.getValue(FACING).ordinal()]) {
case 1:
return SHAPE_NORTH_SIZE_0;
case 2:
return SHAPE_SOUTH_SIZE_0;
case 3:
return SHAPE_EAST_SIZE_0;
case 4:
return SHAPE_WEST_SIZE_0;
}
}
switch (C00111.$SwitchMap$net$minecraft$core$Direction[bs.getValue(FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
CanvasBlockEntity toReturn = (CanvasBlockEntity) CanvasBlockEntity.CANVAS.create(pos, state);
return toReturn;
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FACING, SIZE});
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
return FaceAttachedHorizontalDirectionalBlock.canAttach(p_196260_2_, p_196260_3_, p_196260_1_.getValue(FACING).getOpposite());
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
int size;
Direction[] var2 = context.getNearestLookingDirections();
for (Direction lvt_5_1_ : var2) {
if (lvt_5_1_.getAxis() != Direction.Axis.Y) {
BlockState lvt_6_2_ = (BlockState) defaultBlockState().setValue(FACING, lvt_5_1_.getOpposite());
if (lvt_6_2_.canSurvive(context.getLevel(), context.getClickedPos())) {
ItemStack itemStack = context.getItemInHand();
if (itemStack != null && itemStack.getItem() == CustomBlocks.ITEM_CANVAS.get() && itemStack.getTag() != null && itemStack.getTag().contains("Size") && (size = itemStack.getTag().getInt("Size")) >= 0 && size <= MAX_SIZE) {
lvt_6_2_ = (BlockState) lvt_6_2_.setValue(SIZE, Integer.valueOf(size));
}
return lvt_6_2_;
}
}
}
return defaultBlockState();
}
}

View File

@ -1,378 +0,0 @@
package com.dairymoose.modernlife.blocks;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/CatwalkBlock.class */
public class CatwalkBlock extends Block {
protected static final VoxelShape SHAPE_WEST_LONG_WALL = (VoxelShape) Stream.of(Block.box(0.8d, 1.0d, 0.0d, 2.4d, 16.0d, 16.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_EAST_LONG_WALL = (VoxelShape) Stream.of(Block.box(13.6d, 1.0d, 0.0d, 15.2d, 16.0d, 16.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_NORTH_LONG_WALL = (VoxelShape) Stream.of(Block.box(0.0d, 1.0d, 0.8d, 16.0d, 16.0d, 2.4d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_SOUTH_LONG_WALL = (VoxelShape) Stream.of(Block.box(0.0d, 1.0d, 13.6d, 16.0d, 16.0d, 15.2d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST_WALL = (VoxelShape) Stream.of(Block.box(0.8d, 1.0d, 0.8d, 2.4d, 16.0d, 15.2d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_EAST_WALL = (VoxelShape) Stream.of(Block.box(13.6d, 1.0d, 0.8d, 15.2d, 16.0d, 13.6d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_NORTH_WALL = (VoxelShape) Stream.of(Block.box(2.4d, 1.0d, 0.8d, 13.6d, 16.0d, 2.4d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_SOUTH_WALL = (VoxelShape) Stream.of(Block.box(2.4d, 1.0d, 13.6d, 15.2d, 16.0d, 15.2d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_FLOOR_BIG = (VoxelShape) Stream.of(Block.box(0.0d, 0.0d, 0.0d, 16.0d, 1.0d, 16.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_FLOOR = (VoxelShape) Stream.of(Block.box(0.8d, 0.0d, 0.8d, 15.2d, 1.0d, 15.2d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_X_AXIS = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{SHAPE_NORTH_WALL, SHAPE_SOUTH_WALL, SHAPE_FLOOR}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_Z_AXIS = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{SHAPE_EAST_WALL, SHAPE_WEST_WALL, SHAPE_FLOOR}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_ONE_BORDER_N = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{SHAPE_SOUTH_WALL, SHAPE_FLOOR}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_ONE_BORDER_E = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{SHAPE_WEST_WALL, SHAPE_FLOOR}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_ONE_BORDER_W = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{SHAPE_EAST_WALL, SHAPE_FLOOR}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_ONE_BORDER_S = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{SHAPE_NORTH_WALL, SHAPE_FLOOR}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_NORTH_END = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{SHAPE_NORTH_WALL, SHAPE_EAST_WALL, SHAPE_WEST_WALL, SHAPE_FLOOR}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_EAST_END = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{SHAPE_EAST_WALL, SHAPE_NORTH_WALL, SHAPE_SOUTH_WALL, SHAPE_FLOOR}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_SOUTH_END = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{SHAPE_SOUTH_WALL, SHAPE_EAST_WALL, SHAPE_WEST_WALL, SHAPE_FLOOR}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST_END = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{SHAPE_WEST_WALL, SHAPE_NORTH_WALL, SHAPE_SOUTH_WALL, SHAPE_FLOOR}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_NE_CORNER = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{SHAPE_NORTH_WALL, SHAPE_EAST_WALL, SHAPE_FLOOR}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_NW_CORNER = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{SHAPE_NORTH_WALL, SHAPE_WEST_WALL, SHAPE_FLOOR}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_SE_CORNER = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{SHAPE_SOUTH_WALL, SHAPE_EAST_WALL, SHAPE_FLOOR}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_SW_CORNER = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{SHAPE_SOUTH_WALL, SHAPE_WEST_WALL, SHAPE_FLOOR}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_BOX = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{SHAPE_WEST_WALL, SHAPE_EAST_WALL, SHAPE_NORTH_WALL, SHAPE_SOUTH_WALL, SHAPE_FLOOR}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
public static final EnumProperty<CatwalkType> TYPE = EnumProperty.create("type", CatwalkType.class);
public static final BooleanProperty NE_POST = BooleanProperty.create("ne_post");
public static final BooleanProperty SE_POST = BooleanProperty.create("se_post");
public static final BooleanProperty SW_POST = BooleanProperty.create("sw_post");
public static final BooleanProperty NW_POST = BooleanProperty.create("nw_post");
public static final BooleanProperty ALTERED = BooleanProperty.create("altered");
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/CatwalkBlock$CatwalkType.class */
public enum CatwalkType implements StringRepresentable {
single,
mid,
one_border_n,
one_border_e,
one_border_s,
one_border_w,
x_axis,
z_axis,
s_end,
w_end,
n_end,
e_end,
ne_corner,
se_corner,
nw_corner,
sw_corner;
public String getSerializedName() {
return name().toLowerCase();
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch ((CatwalkType) bs.getValue(TYPE)) {
case single:
return SHAPE_BOX;
case mid:
return SHAPE_FLOOR;
case one_border_n:
return SHAPE_ONE_BORDER_N;
case one_border_e:
return SHAPE_ONE_BORDER_E;
case one_border_s:
return SHAPE_ONE_BORDER_S;
case one_border_w:
return SHAPE_ONE_BORDER_W;
case x_axis:
return SHAPE_X_AXIS;
case z_axis:
return SHAPE_Z_AXIS;
case s_end:
return SHAPE_SOUTH_END;
case w_end:
return SHAPE_WEST_END;
case n_end:
return SHAPE_NORTH_END;
case e_end:
return SHAPE_EAST_END;
case ne_corner:
return SHAPE_NE_CORNER;
case nw_corner:
return SHAPE_NW_CORNER;
case se_corner:
return SHAPE_SE_CORNER;
case sw_corner:
return SHAPE_SW_CORNER;
default:
return SHAPE_BOX;
}
}
public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult p_225533_6_) {
if (player.isSteppingCarefully() && hand == InteractionHand.MAIN_HAND && player.getItemInHand(hand).isEmpty()) {
if (!level.isClientSide) {
CatwalkType initialType = (CatwalkType) state.getValue(TYPE);
Direction dir = player.getDirection();
CatwalkType newType = null;
if (initialType == CatwalkType.w_end && dir == Direction.NORTH) {
newType = CatwalkType.nw_corner;
} else if (initialType == CatwalkType.w_end && dir == Direction.SOUTH) {
newType = CatwalkType.sw_corner;
} else if (initialType == CatwalkType.w_end) {
newType = CatwalkType.x_axis;
} else if (initialType == CatwalkType.e_end && dir == Direction.NORTH) {
newType = CatwalkType.ne_corner;
} else if (initialType == CatwalkType.e_end && dir == Direction.SOUTH) {
newType = CatwalkType.se_corner;
} else if (initialType == CatwalkType.e_end) {
newType = CatwalkType.x_axis;
} else if (initialType == CatwalkType.s_end && dir == Direction.EAST) {
newType = CatwalkType.se_corner;
} else if (initialType == CatwalkType.s_end && dir == Direction.WEST) {
newType = CatwalkType.sw_corner;
} else if (initialType == CatwalkType.s_end) {
newType = CatwalkType.z_axis;
} else if (initialType == CatwalkType.n_end && dir == Direction.EAST) {
newType = CatwalkType.ne_corner;
} else if (initialType == CatwalkType.n_end && dir == Direction.WEST) {
newType = CatwalkType.nw_corner;
} else if (initialType == CatwalkType.n_end) {
newType = CatwalkType.z_axis;
} else if (initialType == CatwalkType.x_axis && dir == Direction.NORTH) {
newType = CatwalkType.one_border_s;
} else if (initialType == CatwalkType.x_axis && dir == Direction.SOUTH) {
newType = CatwalkType.one_border_n;
} else if (initialType == CatwalkType.z_axis && dir == Direction.WEST) {
newType = CatwalkType.one_border_e;
} else if (initialType == CatwalkType.z_axis && dir == Direction.EAST) {
newType = CatwalkType.one_border_w;
} else if (initialType == CatwalkType.one_border_e || initialType == CatwalkType.one_border_w || initialType == CatwalkType.one_border_n || initialType == CatwalkType.one_border_s) {
newType = CatwalkType.mid;
} else if (initialType == CatwalkType.ne_corner && dir == Direction.WEST) {
newType = CatwalkType.one_border_s;
} else if (initialType == CatwalkType.ne_corner && dir == Direction.SOUTH) {
newType = CatwalkType.one_border_w;
} else if (initialType == CatwalkType.nw_corner && dir == Direction.EAST) {
newType = CatwalkType.one_border_s;
} else if (initialType == CatwalkType.nw_corner && dir == Direction.SOUTH) {
newType = CatwalkType.one_border_e;
} else if (initialType == CatwalkType.se_corner && dir == Direction.WEST) {
newType = CatwalkType.one_border_n;
} else if (initialType == CatwalkType.se_corner && dir == Direction.NORTH) {
newType = CatwalkType.one_border_w;
} else if (initialType == CatwalkType.sw_corner && dir == Direction.EAST) {
newType = CatwalkType.one_border_n;
} else if (initialType == CatwalkType.sw_corner && dir == Direction.NORTH) {
newType = CatwalkType.one_border_e;
}
if (newType != initialType && newType != null) {
level.setBlock(pos, (BlockState) ((BlockState) state.setValue(ALTERED, true)).setValue(TYPE, newType), 2);
}
}
return InteractionResult.CONSUME;
}
return InteractionResult.PASS;
}
@Nullable
public BlockState getStateForPlacement(BlockPlaceContext context) {
return getNewState(context.getLevel(), context.getClickedPos());
}
public BlockState updateShape(BlockState state, Direction dir, BlockState updater, LevelAccessor world, BlockPos pos, BlockPos updaterPos) {
if (((Boolean) state.getValue(ALTERED)).booleanValue()) {
return state;
}
return getNewState(world, pos);
}
protected BlockState applyCatwalkPosts(BlockState state, boolean useNePost, boolean useNwPost, boolean useSePost, boolean useSwPost) {
return (BlockState) ((BlockState) ((BlockState) ((BlockState) state.setValue(NE_POST, Boolean.valueOf(useNePost))).setValue(NW_POST, Boolean.valueOf(useNwPost))).setValue(SE_POST, Boolean.valueOf(useSePost))).setValue(SW_POST, Boolean.valueOf(useSwPost));
}
protected BlockState getNewState(LevelAccessor world, BlockPos pos) {
BlockState nState = world.getBlockState(pos.north());
BlockState eState = world.getBlockState(pos.east());
BlockState sState = world.getBlockState(pos.south());
BlockState wState = world.getBlockState(pos.west());
int adjacentTableCount = 0;
boolean nTable = nState.is(this);
boolean eTable = eState.is(this);
boolean sTable = sState.is(this);
boolean wTable = wState.is(this);
BlockState neState = world.getBlockState(pos.north().east());
BlockState nwState = world.getBlockState(pos.north().west());
BlockState seState = world.getBlockState(pos.south().east());
BlockState swState = world.getBlockState(pos.south().west());
boolean neTable = neState.is(this);
boolean nwTable = nwState.is(this);
boolean seTable = seState.is(this);
boolean swTable = swState.is(this);
boolean useNePost = false;
boolean useNwPost = false;
boolean useSePost = false;
boolean useSwPost = false;
if (nTable && eTable && !neTable) {
useNePost = true;
}
if (nTable && wTable && !nwTable) {
useNwPost = true;
}
if (sTable && eTable && !seTable) {
useSePost = true;
}
if (sTable && wTable && !swTable) {
useSwPost = true;
}
if (nTable) {
adjacentTableCount = 0 + 1;
}
if (eTable) {
adjacentTableCount++;
}
if (sTable) {
adjacentTableCount++;
}
if (wTable) {
adjacentTableCount++;
}
if (adjacentTableCount >= 2) {
if (nTable && eTable && !sTable && !wTable) {
if (neTable) {
return (BlockState) defaultBlockState().setValue(TYPE, CatwalkType.sw_corner);
}
return (BlockState) ((BlockState) defaultBlockState().setValue(TYPE, CatwalkType.sw_corner)).setValue(NE_POST, true);
}
if (nTable && wTable && !sTable && !eTable) {
if (nwTable) {
return (BlockState) defaultBlockState().setValue(TYPE, CatwalkType.se_corner);
}
return (BlockState) ((BlockState) defaultBlockState().setValue(TYPE, CatwalkType.se_corner)).setValue(NW_POST, true);
}
if (sTable && eTable && !nTable && !wTable) {
if (seTable) {
return (BlockState) defaultBlockState().setValue(TYPE, CatwalkType.nw_corner);
}
return (BlockState) ((BlockState) defaultBlockState().setValue(TYPE, CatwalkType.nw_corner)).setValue(SE_POST, true);
}
if (sTable && wTable && !nTable && !eTable) {
if (swTable) {
return (BlockState) defaultBlockState().setValue(TYPE, CatwalkType.ne_corner);
}
return (BlockState) ((BlockState) defaultBlockState().setValue(TYPE, CatwalkType.ne_corner)).setValue(SW_POST, true);
}
if (adjacentTableCount == 2 && wTable && eTable) {
return (BlockState) defaultBlockState().setValue(TYPE, CatwalkType.x_axis);
}
if (adjacentTableCount == 2 && nTable && sTable) {
return (BlockState) defaultBlockState().setValue(TYPE, CatwalkType.z_axis);
}
if (adjacentTableCount == 3) {
if (wTable && nTable && eTable) {
return applyCatwalkPosts((BlockState) defaultBlockState().setValue(TYPE, CatwalkType.one_border_n), useNePost, useNwPost, useSePost, useSwPost);
}
if (nTable && eTable && sTable) {
return applyCatwalkPosts((BlockState) defaultBlockState().setValue(TYPE, CatwalkType.one_border_e), useNePost, useNwPost, useSePost, useSwPost);
}
if (eTable && sTable && wTable) {
return applyCatwalkPosts((BlockState) defaultBlockState().setValue(TYPE, CatwalkType.one_border_s), useNePost, useNwPost, useSePost, useSwPost);
}
if (sTable && wTable && nTable) {
return applyCatwalkPosts((BlockState) defaultBlockState().setValue(TYPE, CatwalkType.one_border_w), useNePost, useNwPost, useSePost, useSwPost);
}
}
if (adjacentTableCount == 4 && !seTable && !swTable && !neTable && !nwTable) {
return applyCatwalkPosts((BlockState) defaultBlockState().setValue(TYPE, CatwalkType.mid), useNePost, useNwPost, useSePost, useSwPost);
}
return applyCatwalkPosts((BlockState) defaultBlockState().setValue(TYPE, CatwalkType.mid), useNePost, useNwPost, useSePost, useSwPost);
}
if (adjacentTableCount == 1) {
if (nTable) {
return (BlockState) defaultBlockState().setValue(TYPE, CatwalkType.s_end);
}
if (eTable) {
return (BlockState) defaultBlockState().setValue(TYPE, CatwalkType.w_end);
}
if (sTable) {
return (BlockState) defaultBlockState().setValue(TYPE, CatwalkType.n_end);
}
if (wTable) {
return (BlockState) defaultBlockState().setValue(TYPE, CatwalkType.e_end);
}
}
return applyCatwalkPosts(defaultBlockState(), useNePost, useNwPost, useSePost, useSwPost);
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{TYPE, NE_POST, NW_POST, SE_POST, SW_POST, ALTERED});
}
public CatwalkBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
registerDefaultState((BlockState) ((BlockState) ((BlockState) ((BlockState) ((BlockState) ((BlockState) defaultBlockState().setValue(TYPE, CatwalkType.single)).setValue(NE_POST, false)).setValue(NW_POST, false)).setValue(SE_POST, false)).setValue(SW_POST, false)).setValue(ALTERED, false));
}
}

View File

@ -1,84 +0,0 @@
package com.dairymoose.modernlife.blocks;
import java.util.List;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.AttachFace;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/CeilingFanBlock.class */
public class CeilingFanBlock extends FaceAttachedHorizontalDirectionalBlock {
protected static final VoxelShape SHAPE_NORTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(7.25d, 14.0d, 7.25d, 8.75d, 16.0d, 8.75d), Block.box(0.0d, 13.95d, 0.15d, 16.0d, 14.95d, 16.15d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
public static final IntegerProperty SPEED = IntegerProperty.create("speed", 0, 1);
public BlockState rotate(BlockState state, Rotation rotation) {
return state;
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state;
}
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Requires redstone power to operate"));
}
public CeilingFanBlock(Properties props) {
super(props);
registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any().setValue(SPEED, 0)).setValue(FaceAttachedHorizontalDirectionalBlock.FACE, AttachFace.CEILING));
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
int speedValue = 0;
BlockPos pos = context.getClickedPos();
boolean signal = context.getLevel().hasNeighborSignal(pos);
if (signal) {
speedValue = 1;
}
return (BlockState) defaultBlockState().setValue(SPEED, Integer.valueOf(speedValue));
}
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block block, BlockPos neighborPos, boolean p_220069_6_) {
int speedValue = 0;
boolean signal = world.hasNeighborSignal(pos);
if (signal) {
speedValue = 1;
}
if (block != this && speedValue != ((Integer) state.getValue(SPEED)).intValue()) {
world.setBlock(pos, (BlockState) state.setValue(SPEED, Integer.valueOf(speedValue)), 2);
}
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FaceAttachedHorizontalDirectionalBlock.FACE, SPEED});
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
return SHAPE_NORTH;
}
}

View File

@ -1,101 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.entity.DummyEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/ChairBlock.class */
public class ChairBlock extends StandardHorizontalBlock {
private static final Logger LOGGER = LogManager.getLogger();
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(2.0d, 10.0d, 13.0d, 14.0d, 24.0d, 14.0d), Block.box(2.0d, 0.0d, 2.0d, 14.0d, 9.0d, 14.0d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public ChairBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
registerDefaultState(defaultBlockState());
}
@Deprecated
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos p_225533_3_, Player player, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
if (!p_225533_2_.isClientSide) {
DummyEntity dummy = DummyEntity.getEntity(0.4f, p_225533_2_, p_225533_3_, true);
dummy.ride(player);
}
return InteractionResult.CONSUME;
}
public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 20;
}
return 0;
}
public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 5;
}
return 0;
}
/* renamed from: com.dairymoose.modernlife.blocks.ChairBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/ChairBlock$1.class */
static /* synthetic */ class C00131 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00131.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,189 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.blocks.gui.chess.CheckState;
import com.dairymoose.modernlife.blocks.gui.chess.ChessScreen;
import com.dairymoose.modernlife.renderer.tileentity.ChessBoardBlockEntityRenderer;
import com.dairymoose.modernlife.tileentities.ChessBoardBlockEntity;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.Container;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/ChessBoardBlock.class */
public class ChessBoardBlock extends Block implements EntityBlock {
protected static final VoxelShape SHAPE = Block.box(2.0d, 0.0d, 2.0d, 14.0d, 1.0d, 14.0d);
public ChessBoardBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: com.dairymoose.modernlife.blocks.ChessBoardBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/ChessBoardBlock$1.class */
public class RunnableC00141 implements Runnable {
final /* synthetic */ BlockPos val$pos;
RunnableC00141(BlockPos blockPos, BlockPos val$pos) {
this.val$pos = val$pos;
BlockPos pos = blockPos;
}
@Override // java.lang.Runnable
public void run() {
ChessScreen screen = new ChessScreen(val$pos);
Minecraft.getInstance().setScreen(screen);
}
}
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos pos, Player p_225533_4_, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
if (p_225533_2_.isClientSide) {
DistExecutor.runWhenOn(Dist.CLIENT, () -> {
return new Runnable() { // from class: com.dairymoose.modernlife.blocks.ChessBoardBlock.1
final /* synthetic */ BlockPos val$pos = null;
void RunnableC00141(BlockPos pos2) {
pos = pos2;
}
@Override // java.lang.Runnable
public void run() {
ChessScreen screen = new ChessScreen(pos);
Minecraft.getInstance().setScreen(screen);
}
};
});
}
return InteractionResult.CONSUME;
}
public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
return 20;
}
public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
return 5;
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
ChessBoardBlockEntity toReturn = (ChessBoardBlockEntity) ChessBoardBlockEntity.CHESS_BOARD.create(pos, state);
return toReturn;
}
public void setPlacedBy(Level worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) {
if (!worldIn.isClientSide) {
BlockEntity e = worldIn.getBlockEntity(pos);
if (e instanceof ChessBoardBlockEntity) {
ChessBoardBlockEntity tile = (ChessBoardBlockEntity) e;
tile.setItem(0, itemStack.copy());
}
}
}
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
if (itemStack.getTag() != null && itemStack.getTag().contains("BoardState")) {
CompoundTag boardState = itemStack.getTag().getCompound("BoardState");
int currentTurn = boardState.getInt("CurrentTurn");
String whitePlayer = boardState.getString("WhitePlayer");
String blackPlayer = boardState.getString("BlackPlayer");
int newCheckState = boardState.getInt("NewCheckState");
boolean gameOver = false;
if (newCheckState == CheckState.BLACK_CHECKMATE.ordinal()) {
gameOver = true;
list.add(new TextComponent("White won the game!"));
} else if (newCheckState == CheckState.WHITE_CHECKMATE.ordinal()) {
gameOver = true;
list.add(new TextComponent("Black won the game!"));
} else {
list.add(new TextComponent("Game in progress..."));
}
list.add(new TextComponent(""));
list.add(new TextComponent("Turn counter: " + currentTurn));
list.add(new TextComponent("White player: " + whitePlayer));
list.add(new TextComponent("Black player: " + blackPlayer));
if (!gameOver) {
boolean isWhiteTurn = boardState.getBoolean("IsWhiteTurn");
if (isWhiteTurn) {
list.add(new TextComponent("White's turn"));
return;
} else {
list.add(new TextComponent("Black's turn"));
return;
}
}
return;
}
list.add(new TextComponent("Place it down and begin a new game!"));
}
public void onRemove(BlockState p_196243_1_, Level p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_1_.is(p_196243_4_.getBlock())) {
Container blockEntity = p_196243_2_.getBlockEntity(p_196243_3_);
if (blockEntity instanceof Container) {
if (p_196243_2_.isClientSide) {
DistExecutor.runWhenOn(Dist.CLIENT, () -> {
return new Runnable() { // from class: com.dairymoose.modernlife.blocks.ChessBoardBlock.2
final /* synthetic */ BlockPos val$p_196243_3_;
RunnableC00152(BlockPos p_196243_3_2) {
p_196243_3_ = p_196243_3_2;
}
@Override // java.lang.Runnable
public void run() {
ChessBoardBlockEntityRenderer.stateMap.remove(p_196243_3_);
}
};
});
}
Containers.dropContents(p_196243_2_, p_196243_3_2, blockEntity);
p_196243_2_.updateNeighbourForOutputSignal(p_196243_3_2, this);
}
super.onRemove(p_196243_1_, p_196243_2_, p_196243_3_2, p_196243_4_, p_196243_5_);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: com.dairymoose.modernlife.blocks.ChessBoardBlock$2 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/ChessBoardBlock$2.class */
public class RunnableC00152 implements Runnable {
final /* synthetic */ BlockPos val$p_196243_3_;
RunnableC00152(BlockPos p_196243_3_2) {
p_196243_3_ = p_196243_3_2;
}
@Override // java.lang.Runnable
public void run() {
ChessBoardBlockEntityRenderer.stateMap.remove(p_196243_3_);
}
}
public VoxelShape getShape(BlockState p_220053_1_, BlockGetter p_220053_2_, BlockPos p_220053_3_, CollisionContext p_220053_4_) {
return SHAPE;
}
}

View File

@ -1,74 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/CoffeeMugBlock.class */
public class CoffeeMugBlock extends StandardHorizontalBlock {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(7.85d, 2.4d, 6.5d, 8.15d, 2.65d, 7.0d), Block.box(7.85d, 0.4d, 6.25d, 8.15d, 2.65d, 6.5d), Block.box(7.85d, 0.4d, 6.5d, 8.15d, 0.65d, 7.0d), Block.box(7.0d, 0.0d, 7.0d, 9.0d, 3.0d, 9.0d)}).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public CoffeeMugBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState) defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, context.getHorizontalDirection());
}
/* renamed from: com.dairymoose.modernlife.blocks.CoffeeMugBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/CoffeeMugBlock$1.class */
static /* synthetic */ class C00161 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00161.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,32 +0,0 @@
package com.dairymoose.modernlife.blocks;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/CoffeeTableBlock.class */
public class CoffeeTableBlock extends SmallTableBlock {
protected static final VoxelShape SHAPE_NORMAL = (VoxelShape) Stream.of(Block.box(0.01d, 0.0d, 0.01d, 15.99d, 8.0d, 15.99d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
public CoffeeTableBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
public CoffeeTableBlock(Properties p_i48377_1_, boolean skipDefaultState) {
super(p_i48377_1_, skipDefaultState);
}
@Override // com.dairymoose.modernlife.blocks.SmallTableBlock
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
return SHAPE_NORMAL;
}
}

View File

@ -1,74 +0,0 @@
package com.dairymoose.modernlife.blocks;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/DeckBlock.class */
public class DeckBlock extends Block {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(2.5d, 13.5d, 0.0d, 5.5d, 15.5d, 16.0d), Block.box(10.5d, 13.5d, 0.0d, 13.5d, 15.5d, 16.0d), Block.box(0.0d, 14.0d, 0.5d, 16.0d, 16.0d, 3.5d), Block.box(0.0d, 14.0d, 4.5d, 16.0d, 16.0d, 7.5d), Block.box(0.0d, 14.0d, 8.5d, 16.0d, 16.0d, 11.5d), Block.box(0.0d, 14.0d, 12.5d, 16.0d, 16.0d, 15.5d)}).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape WITH_SUPPORT = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{SHAPE_SOUTH, Block.box(6.0d, 0.0d, 6.0d, 10.0d, 14.0d, 10.0d)}).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
public static final BooleanProperty SUPPORT = BooleanProperty.create("support");
public DeckBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
registerDefaultState((BlockState) this.stateDefinition.any().setValue(SUPPORT, Boolean.FALSE));
}
public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 20;
}
return 0;
}
public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 5;
}
return 0;
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
if (p_196271_4_.getBlockState(p_196271_5_.below()).m_204336_(BlockTags.WOODEN_FENCES)) {
return (BlockState) defaultBlockState().setValue(SUPPORT, true);
}
return defaultBlockState();
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
if (context.getLevel().getBlockState(context.getClickedPos().below()).m_204336_(BlockTags.WOODEN_FENCES)) {
return (BlockState) defaultBlockState().setValue(SUPPORT, true);
}
return defaultBlockState();
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{SUPPORT});
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
if (((Boolean) bs.getValue(SUPPORT)).booleanValue()) {
return WITH_SUPPORT;
}
return SHAPE_SOUTH;
}
}

View File

@ -1,300 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.core.CustomBlocks;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.npc.Villager;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.ExplosionDamageCalculator;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.BedBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BedPart;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.level.pathfinder.PathComputationType;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/DeluxeBedBlock.class */
public class DeluxeBedBlock extends BedBlock {
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
public static final EnumProperty<CornerType> CORNER = EnumProperty.create("corner", CornerType.class);
public static final EnumProperty<BedPart> PART = BlockStateProperties.BED_PART;
public static final BooleanProperty OCCUPIED = BlockStateProperties.OCCUPIED;
protected static final VoxelShape SOUTH_AABB = Block.box(0.01d, 0.0d, 0.01d, 15.99d, 11.0d, 15.99d);
protected static final VoxelShape NORTH_AABB = Block.box(0.01d, 0.0d, 0.01d, 15.99d, 11.0d, 15.99d);
protected static final VoxelShape WEST_AABB = Block.box(0.01d, 0.0d, 0.01d, 15.99d, 11.0d, 15.99d);
protected static final VoxelShape EAST_AABB = Block.box(0.01d, 0.0d, 0.01d, 15.99d, 11.0d, 15.99d);
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/DeluxeBedBlock$CornerType.class */
public enum CornerType implements StringRepresentable {
bottom_left,
bottom_right,
top_left,
top_right;
public String getSerializedName() {
return name().toLowerCase();
}
}
public DeluxeBedBlock(Properties p_i48413_1_) {
super(DyeColor.GRAY, p_i48413_1_);
registerDefaultState((BlockState) ((BlockState) ((BlockState) ((BlockState) this.stateDefinition.any().setValue(FACING, Direction.NORTH)).setValue(CORNER, CornerType.bottom_left)).setValue(PART, BedPart.FOOT)).setValue(OCCUPIED, false));
}
public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 20;
}
return 0;
}
public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 5;
}
return 0;
}
public RenderShape getRenderShape(BlockState p_149645_1_) {
return RenderShape.MODEL;
}
public VoxelShape getShape(BlockState p_220053_1_, BlockGetter p_220053_2_, BlockPos p_220053_3_, CollisionContext p_220053_4_) {
Direction lvt_5_1_ = p_220053_1_.getValue(FACING);
switch (lvt_5_1_.ordinal()) {
case 1:
default:
return EAST_AABB;
case 2:
return SOUTH_AABB;
case 3:
return WEST_AABB;
case 4:
return NORTH_AABB;
}
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
Direction checkDir;
Direction checkDirLateral;
CornerType lvt_7_1_ = (CornerType) p_196271_1_.getValue(CORNER);
if (p_196271_1_.getValue(FACING) == Direction.EAST) {
checkDir = Direction.EAST;
} else if (p_196271_1_.getValue(FACING) == Direction.WEST) {
checkDir = Direction.WEST;
} else if (p_196271_1_.getValue(FACING) == Direction.NORTH) {
checkDir = Direction.NORTH;
} else {
checkDir = Direction.SOUTH;
}
if (p_196271_1_.getValue(FACING) == Direction.EAST) {
checkDirLateral = Direction.SOUTH;
} else if (p_196271_1_.getValue(FACING) == Direction.WEST) {
checkDirLateral = Direction.NORTH;
} else if (p_196271_1_.getValue(FACING) == Direction.NORTH) {
checkDirLateral = Direction.EAST;
} else {
checkDirLateral = Direction.WEST;
}
if ((lvt_7_1_ == CornerType.bottom_left || lvt_7_1_ == CornerType.top_left) && p_196271_5_.relative(checkDirLateral).equals(p_196271_6_) && !p_196271_3_.is(CustomBlocks.BLOCK_DELUXE_BED.get())) {
return Blocks.AIR.defaultBlockState();
}
if ((lvt_7_1_ == CornerType.bottom_right || lvt_7_1_ == CornerType.top_right) && p_196271_5_.relative(checkDirLateral.getOpposite()).equals(p_196271_6_) && !p_196271_3_.is(CustomBlocks.BLOCK_DELUXE_BED.get())) {
return Blocks.AIR.defaultBlockState();
}
if ((lvt_7_1_ == CornerType.bottom_left || lvt_7_1_ == CornerType.bottom_right) && p_196271_5_.relative(checkDir).equals(p_196271_6_) && !p_196271_3_.is(CustomBlocks.BLOCK_DELUXE_BED.get())) {
return Blocks.AIR.defaultBlockState();
}
if ((lvt_7_1_ == CornerType.top_left || lvt_7_1_ == CornerType.top_right) && p_196271_5_.relative(checkDir.getOpposite()).equals(p_196271_6_) && !p_196271_3_.is(CustomBlocks.BLOCK_DELUXE_BED.get())) {
return Blocks.AIR.defaultBlockState();
}
return p_196271_1_;
}
protected static void preventCreativeDropFromBottomPart(Level p_241471_0_, BlockPos p_241471_1_, BlockState p_241471_2_, Player p_241471_3_) {
CornerType doubleblockhalf = (CornerType) p_241471_2_.getValue(CORNER);
if (doubleblockhalf == CornerType.bottom_left) {
BlockPos blockpos = p_241471_1_.below();
BlockState blockstate = p_241471_0_.getBlockState(blockpos);
if (blockstate.getBlock() == p_241471_2_.getBlock() && blockstate.getValue(CORNER) == CornerType.bottom_left) {
p_241471_0_.setBlock(blockpos, Blocks.AIR.defaultBlockState(), 35);
p_241471_0_.levelEvent(p_241471_3_, 2001, blockpos, Block.getId(blockstate));
}
}
}
public void playerWillDestroy(Level p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, Player p_176208_4_) {
if (!p_176208_1_.isClientSide && p_176208_4_.isCreative()) {
preventCreativeDropFromBottomPart(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
super.playerWillDestroy(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
@Nullable
public BlockState getStateForPlacement(BlockPlaceContext p_196258_1_) {
BlockPos lvt_2_1_ = p_196258_1_.getClickedPos();
if (lvt_2_1_.getY() < p_196258_1_.getLevel().getMaxBuildHeight() && p_196258_1_.getLevel().getBlockState(lvt_2_1_.relative(p_196258_1_.getHorizontalDirection())).canBeReplaced(p_196258_1_) && p_196258_1_.getLevel().getBlockState(lvt_2_1_.relative(p_196258_1_.getHorizontalDirection()).relative(p_196258_1_.getHorizontalDirection().getClockWise())).canBeReplaced(p_196258_1_) && p_196258_1_.getLevel().getBlockState(lvt_2_1_.relative(p_196258_1_.getHorizontalDirection().getClockWise())).canBeReplaced(p_196258_1_)) {
Level lvt_3_1_ = p_196258_1_.getLevel();
boolean z = lvt_3_1_.hasNeighborSignal(lvt_2_1_) || lvt_3_1_.hasNeighborSignal(lvt_2_1_.above());
return (BlockState) ((BlockState) defaultBlockState().setValue(FACING, p_196258_1_.getHorizontalDirection())).setValue(CORNER, CornerType.bottom_left);
}
return null;
}
public BlockState rotate(BlockState p_52790_, Rotation p_52791_) {
return (BlockState) p_52790_.setValue(FACING, p_52791_.rotate(p_52790_.getValue(FACING)));
}
public BlockState mirror(BlockState p_52787_, Mirror p_52788_) {
return p_52788_ == Mirror.NONE ? p_52787_ : p_52787_.rotate(p_52788_.getRotation(p_52787_.getValue(FACING)));
}
public void setPlacedBy(Level p_180633_1_, BlockPos p_180633_2_, BlockState p_180633_3_, LivingEntity p_180633_4_, ItemStack p_180633_5_) {
p_180633_1_.setBlock(p_180633_2_.relative(p_180633_4_.getDirection()), (BlockState) p_180633_3_.setValue(CORNER, CornerType.top_left), 3);
p_180633_1_.setBlock(p_180633_2_.relative(p_180633_4_.getDirection()).relative(p_180633_4_.getDirection().getClockWise()), (BlockState) p_180633_3_.setValue(CORNER, CornerType.top_right), 3);
p_180633_1_.setBlock(p_180633_2_.relative(p_180633_4_.getDirection().getClockWise()), (BlockState) p_180633_3_.setValue(CORNER, CornerType.bottom_right), 3);
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
BlockPos lvt_4_1_ = p_196260_3_.below();
p_196260_2_.getBlockState(lvt_4_1_);
return true;
}
public PushReaction getPistonPushReaction(BlockState p_149656_1_) {
return PushReaction.DESTROY;
}
@OnlyIn(Dist.CLIENT)
public long getSeed(BlockState p_209900_1_, BlockPos p_209900_2_) {
return 0L;
}
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos p_225533_3_, Player p_225533_4_, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
if (p_225533_2_.isClientSide) {
return InteractionResult.CONSUME;
}
if (p_225533_1_.getValue(CORNER) != CornerType.top_left && p_225533_1_.getValue(CORNER) != CornerType.top_right) {
p_225533_3_ = p_225533_3_.relative(p_225533_1_.getValue(FACING));
p_225533_1_ = p_225533_2_.getBlockState(p_225533_3_);
if (!p_225533_1_.is(this)) {
return InteractionResult.CONSUME;
}
}
if (((Boolean) p_225533_1_.getValue(OCCUPIED)).booleanValue()) {
if (p_225533_1_.getValue(CORNER) == CornerType.top_left) {
p_225533_3_ = p_225533_3_.relative(p_225533_1_.getValue(FACING).getClockWise());
p_225533_1_ = p_225533_2_.getBlockState(p_225533_3_);
if (!p_225533_1_.is(this)) {
return InteractionResult.CONSUME;
}
} else if (p_225533_1_.getValue(CORNER) == CornerType.top_right) {
p_225533_3_ = p_225533_3_.relative(p_225533_1_.getValue(FACING).getCounterClockWise());
p_225533_1_ = p_225533_2_.getBlockState(p_225533_3_);
if (!p_225533_1_.is(this)) {
return InteractionResult.CONSUME;
}
}
}
if (!canSetSpawn(p_225533_2_)) {
p_225533_2_.removeBlock(p_225533_3_, false);
BlockPos lvt_7_1_ = p_225533_3_.relative(p_225533_1_.getValue(FACING).getOpposite());
if (p_225533_2_.getBlockState(lvt_7_1_).is(this)) {
p_225533_2_.removeBlock(lvt_7_1_, false);
}
p_225533_2_.explode((Entity) null, DamageSource.badRespawnPointExplosion(), (ExplosionDamageCalculator) null, p_225533_3_.getX() + 0.5d, p_225533_3_.getY() + 0.5d, p_225533_3_.getZ() + 0.5d, 5.0f, true, Explosion.BlockInteraction.DESTROY);
return InteractionResult.SUCCESS;
}
if (((Boolean) p_225533_1_.getValue(OCCUPIED)).booleanValue()) {
if (!kickVillagerOutOfBed(p_225533_2_, p_225533_3_)) {
p_225533_4_.displayClientMessage(new TranslatableComponent("block.minecraft.bed.occupied"), true);
}
return InteractionResult.SUCCESS;
}
p_225533_4_.startSleepInBed(p_225533_3_).ifLeft(p_220173_1_ -> {
if (p_220173_1_ != null) {
p_225533_4_.displayClientMessage(p_220173_1_.getMessage(), true);
}
});
return InteractionResult.SUCCESS;
}
public boolean isPathfindable(BlockState p_196266_1_, BlockGetter p_196266_2_, BlockPos p_196266_3_, PathComputationType p_196266_4_) {
return false;
}
public static boolean canSetSpawn(Level p_235330_0_) {
return p_235330_0_.dimensionType().bedWorks();
}
private boolean kickVillagerOutOfBed(Level p_226861_1_, BlockPos p_226861_2_) {
List<Villager> lvt_3_1_ = p_226861_1_.m_6443_(Villager.class, new AABB(p_226861_2_), (v0) -> {
return v0.isSleeping();
});
if (lvt_3_1_.isEmpty()) {
return false;
}
lvt_3_1_.get(0).stopSleeping();
return true;
}
public void fallOn(Level p_180658_1_, BlockState state, BlockPos p_180658_2_, Entity p_180658_3_, float p_180658_4_) {
super.fallOn(p_180658_1_, state, p_180658_2_, p_180658_3_, p_180658_4_ * 0.5f);
}
public void updateEntityAfterFallOn(BlockGetter p_176216_1_, Entity p_176216_2_) {
if (p_176216_2_.isSuppressingBounce()) {
super.updateEntityAfterFallOn(p_176216_1_, p_176216_2_);
} else {
bounceUp(p_176216_2_);
}
}
private void bounceUp(Entity p_226860_1_) {
Vec3 lvt_2_1_ = p_226860_1_.getDeltaMovement();
if (lvt_2_1_.y < 0.0d) {
double lvt_3_1_ = p_226860_1_ instanceof LivingEntity ? 1.0d : 0.8d;
p_226860_1_.setDeltaMovement(lvt_2_1_.x, (-lvt_2_1_.y) * 0.6600000262260437d * lvt_3_1_, lvt_2_1_.z);
}
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_206840_1_) {
p_206840_1_.add(new Property[]{CORNER, FACING, PART, OCCUPIED});
}
}

View File

@ -1,78 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.tileentities.WallShelfBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/DoubleWallShelfBlock.class */
public class DoubleWallShelfBlock extends WallShelfBlock implements EntityBlock {
protected static final VoxelShape SHAPE_SOUTH_DOUBLE = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(0.0d, 1.0d, 0.0d, 16.0d, 5.5d, 6.0d), Block.box(0.0d, 9.0d, 0.0d, 16.0d, 13.5d, 6.0d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST_DOUBLE = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH_DOUBLE);
protected static final VoxelShape SHAPE_NORTH_DOUBLE = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST_DOUBLE);
protected static final VoxelShape SHAPE_EAST_DOUBLE = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH_DOUBLE);
public DoubleWallShelfBlock(Properties props) {
super(props);
}
@Override // com.dairymoose.modernlife.blocks.WallShelfBlock
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
WallShelfBlockEntity toReturn = (WallShelfBlockEntity) WallShelfBlockEntity.DOUBLE_WALL_SHELF.create(pos, state);
return toReturn;
}
/* renamed from: com.dairymoose.modernlife.blocks.DoubleWallShelfBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/DoubleWallShelfBlock$1.class */
static /* synthetic */ class C00171 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
@Override // com.dairymoose.modernlife.blocks.WallShelfBlock
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00171.$SwitchMap$net$minecraft$core$Direction[bs.getValue(WallShelfBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH_DOUBLE;
case 2:
return SHAPE_SOUTH_DOUBLE;
case 3:
return SHAPE_EAST_DOUBLE;
case 4:
return SHAPE_WEST_DOUBLE;
default:
return WallShelfBlock.SHAPE_NORTH;
}
}
}

View File

@ -1,74 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/DualMonitorBlock.class */
public class DualMonitorBlock extends StandardHorizontalBlock {
protected static final VoxelShape SHAPE_NORTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Shapes.join(Block.box(-0.5281250000000002d, 0.0d, 6.880624999999999d, 0.546875d, 0.25d, 9.880624999999998d), Block.box(-0.5031249999999998d, 1.9517372179744426d, 4.892322582022786d, 0.4968749999999993d, 2.2017372179744426d, 6.992322582022786d), BooleanOp.OR), Shapes.join(Block.box(-8.003125d, 1.625d, 8.193125d, 7.996874999999999d, 11.624999999999998d, 8.293125000000002d), Block.box(-8.003125d, 1.625d, 8.543125d, 7.996874999999999d, 11.624999999999998d, 8.718124999999997d), BooleanOp.OR), Shapes.join(Block.box(7.996874999999999d, 1.625d, 8.543125d, 23.996875d, 11.624999999999998d, 8.718124999999997d), Shapes.join(Block.box(7.996874999999999d, 1.625d, 8.193125d, 23.996875d, 11.624999999999998d, 8.293125000000002d), Shapes.join(Block.box(15.471874999999999d, 0.0d, 6.880624999999999d, 16.546875d, 0.25d, 9.880624999999998d), Block.box(15.496875d, -0.15000000000000036d, 6.8706249999999995d, 16.496875d, 1.9500000000000002d, 7.1206249999999995d), BooleanOp.OR), BooleanOp.OR), BooleanOp.OR)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
protected static final VoxelShape SHAPE_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
public DualMonitorBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState) defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, context.getHorizontalDirection().getOpposite());
}
/* renamed from: com.dairymoose.modernlife.blocks.DualMonitorBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/DualMonitorBlock$1.class */
static /* synthetic */ class C00181 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00181.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,244 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.blocks.gui.EaselScreen;
import com.dairymoose.modernlife.blocks.gui.EaselSizeScreen;
import com.dairymoose.modernlife.core.CustomBlocks;
import com.dairymoose.modernlife.core.ModernLifeClient;
import com.dairymoose.modernlife.core.ModernLifeCommon;
import com.dairymoose.modernlife.core.ModernLifeConfig;
import com.dairymoose.modernlife.tileentities.EaselBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.Container;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/EaselBlock.class */
public class EaselBlock extends Block implements EntityBlock {
protected static final VoxelShape SHAPE_NORTH = Block.box(3.5d, 0.0d, 3.2d, 14.0d, 23.0d, 12.8d);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
protected static final VoxelShape SHAPE_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public static final BooleanProperty EMPTY = BooleanProperty.create("empty");
public EaselBlock() {
super(Properties.of(Material.WOOD).sound(SoundType.WOOD).strength(2.5f, 0.0f));
registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any().setValue(FACING, Direction.NORTH)).setValue(EMPTY, Boolean.TRUE));
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 20;
}
return 0;
}
public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 5;
}
return 0;
}
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Place a canvas on it to begin painting"));
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
return (p_196260_2_.isEmptyBlock(p_196260_3_.below()) || p_196260_2_.getBlockState(p_196260_3_.below()).is(CustomBlocks.BLOCK_EASEL.get())) ? false : true;
}
public void onRemove(BlockState p_196243_1_, Level p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_1_.is(p_196243_4_.getBlock())) {
Container blockEntity = (Container) p_196243_2_.getBlockEntity(p_196243_3_);
if (blockEntity != null) {
Containers.dropContents(p_196243_2_, p_196243_3_, blockEntity);
p_196243_2_.updateNeighbourForOutputSignal(p_196243_3_, this);
}
super.onRemove(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
}
}
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos p_225533_3_, Player p_225533_4_, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
if (p_225533_4_.getMainHandItem().getItem() == CustomBlocks.ITEM_CANVAS.get()) {
if (((Boolean) p_225533_1_.getValue(EMPTY)).booleanValue()) {
if (!p_225533_2_.isClientSide) {
BlockEntity tileEntity = p_225533_2_.getBlockEntity(p_225533_3_);
if (tileEntity instanceof EaselBlockEntity) {
EaselBlockEntity easelBlockEntity = (EaselBlockEntity) tileEntity;
if ((p_225533_2_ instanceof ServerLevel) && easelBlockEntity != null) {
easelBlockEntity.setItem(0, p_225533_4_.getMainHandItem().copy());
p_225533_4_.getMainHandItem().setCount(0);
BlockState newState = (BlockState) p_225533_1_.setValue(EMPTY, false);
p_225533_2_.setBlockAndUpdate(p_225533_3_, newState);
((ServerLevel) p_225533_2_).sendBlockUpdated(p_225533_3_, p_225533_1_, newState, 2);
}
}
}
return InteractionResult.CONSUME;
}
} else if (p_225533_4_.getMainHandItem().getItem() == Items.AIR && p_225533_4_.isSteppingCarefully()) {
if (!((Boolean) p_225533_1_.getValue(EMPTY)).booleanValue()) {
if (!p_225533_2_.isClientSide) {
BlockEntity tileEntity2 = p_225533_2_.getChunkAt(p_225533_3_).getBlockEntity(p_225533_3_);
ModernLifeCommon.LOGGER.debug("tileEntity = " + tileEntity2);
if (tileEntity2 instanceof EaselBlockEntity) {
EaselBlockEntity easelBlockEntity2 = (EaselBlockEntity) tileEntity2;
if ((p_225533_2_ instanceof ServerLevel) && easelBlockEntity2 != null) {
ItemStack canvasItem = easelBlockEntity2.getItem(0).copy();
easelBlockEntity2.setItem(0, ItemStack.EMPTY);
p_225533_2_.setBlockAndUpdate(p_225533_3_, (BlockState) p_225533_1_.setValue(EMPTY, true));
if (canvasItem != null) {
p_225533_4_.setItemInHand(InteractionHand.MAIN_HAND, canvasItem);
}
}
}
}
return InteractionResult.CONSUME;
}
} else if (!((Boolean) p_225533_1_.getValue(EMPTY)).booleanValue()) {
if (p_225533_2_.isClientSide) {
DistExecutor.runWhenOn(Dist.CLIENT, () -> {
return new Runnable() { // from class: com.dairymoose.modernlife.blocks.EaselBlock.1
@Override // java.lang.Runnable
public void run() {
EaselScreen screen = new EaselScreen(p_225533_2_, p_225533_3_);
BlockEntity tileEntity3 = p_225533_2_.getBlockEntity(p_225533_3_);
ModernLifeCommon.LOGGER.debug("tileEntity = " + tileEntity3);
if (tileEntity3 instanceof EaselBlockEntity) {
EaselBlockEntity easelBlockEntity3 = (EaselBlockEntity) tileEntity3;
ItemStack item = easelBlockEntity3.getItem(0);
ModernLifeCommon.LOGGER.debug("item = " + item);
if (item.getItem() == CustomBlocks.ITEM_CANVAS.get()) {
ModernLifeCommon.LOGGER.debug("canvas = " + tileEntity3);
if (item.hasTag() && item.getTag().contains("UniqueId")) {
long uniqueId = item.getTag().getLong("UniqueId");
byte[] imageData = ModernLifeClient.getCanvasData(uniqueId);
if (imageData != null && imageData.length > 0) {
int texW = ModernLifeClient.getCanvasWidth(uniqueId);
int texH = ModernLifeClient.getCanvasHeight(uniqueId);
screen.setTextureSize(texW, texH);
screen.setInitialData(imageData);
ModernLifeCommon.LOGGER.debug("initialData = " + imageData.length);
}
} else if (((Boolean) ModernLifeConfig.CLIENT.showEaselResolutionScreen.get()).booleanValue()) {
EaselSizeScreen sizeScreen = new EaselSizeScreen(p_225533_2_, p_225533_3_);
Minecraft.getInstance().setScreen(sizeScreen);
return;
} else {
ModernLifeCommon.LOGGER.debug("empty canvas size = " + ModernLifeConfig.CLIENT.emptyCanvasEaselSize.get());
screen.setTextureSize(((Integer) ModernLifeConfig.CLIENT.emptyCanvasEaselSize.get()).intValue(), ((Integer) ModernLifeConfig.CLIENT.emptyCanvasEaselSize.get()).intValue());
}
}
}
screen.setBlockPos(p_225533_3_);
Minecraft.getInstance().setScreen(screen);
}
};
});
}
return InteractionResult.CONSUME;
}
return InteractionResult.PASS;
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
EaselBlockEntity toReturn = (EaselBlockEntity) EaselBlockEntity.EASEL.create(pos, state);
return toReturn;
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FACING, EMPTY});
}
/* renamed from: com.dairymoose.modernlife.blocks.EaselBlock$2 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/EaselBlock$2.class */
static /* synthetic */ class C00202 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00202.$SwitchMap$net$minecraft$core$Direction[bs.getValue(FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState) defaultBlockState().setValue(FACING, context.getHorizontalDirection());
}
}

View File

@ -1,135 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.tileentities.ExtractorBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.List;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.stats.Stats;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.HopperBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/ExtractorBlock.class */
public class ExtractorBlock extends HopperBlock implements EntityBlock {
protected static final VoxelShape SHAPE_NORTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(1.0d, 0.0d, -1.0d, 15.0d, 14.0d, 3.0d), Block.box(3.0d, 2.0d, 8.0d, 13.0d, 12.0d, 9.0d), Block.box(7.0d, 13.975d, -4.0d, 9.0d, 14.975d, 1.0d), Block.box(7.0d, -0.975d, -4.0d, 9.0d, 0.025d, 1.0d), Block.box(0.025d, 6.0d, -4.0d, 1.025d, 8.0d, 1.0d), Block.box(14.975d, 6.0d, -4.0d, 15.975d, 8.0d, 1.0d), Block.box(4.0d, 3.0d, 9.0d, 12.0d, 11.0d, 16.0d), Block.box(2.0d, 2.0d, -0.95d, 3.0d, 13.0d, 9.0d), Block.box(13.0d, 2.0d, -0.95d, 14.0d, 13.0d, 9.0d), Block.box(3.0d, 12.0d, -0.95d, 13.0d, 13.0d, 9.0d), Block.box(2.0d, 1.0d, -0.95d, 14.0d, 2.0d, 9.0d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
protected static final VoxelShape SHAPE_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
public ExtractorBlock() {
super(Properties.of(Material.METAL, MaterialColor.STONE).requiresCorrectToolForDrops().strength(3.0f, 4.8f).sound(SoundType.METAL).noOcclusion());
registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any().setValue(HopperBlock.FACING, Direction.NORTH)).setValue(HopperBlock.ENABLED, true));
}
public ExtractorBlock(Properties props) {
super(props);
registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any().setValue(HopperBlock.FACING, Direction.NORTH)).setValue(HopperBlock.ENABLED, true));
}
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return ModernLifeUtil.createTickerHelper(type, ExtractorBlockEntity.EXTRACTOR, ExtractorBlockEntity::tick);
}
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Extracts items from attached chests or from the space in front of it"));
}
public VoxelShape getShape(BlockState p_220053_1_, BlockGetter p_220053_2_, BlockPos p_220053_3_, CollisionContext p_220053_4_) {
switch (p_220053_1_.getValue(HopperBlock.FACING).ordinal()) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_NORTH;
case 3:
return SHAPE_SOUTH;
case 4:
return SHAPE_WEST;
case 5:
return SHAPE_EAST;
default:
return SHAPE_NORTH;
}
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return ExtractorBlockEntity.EXTRACTOR.create(pos, state);
}
public void setPlacedBy(Level p_180633_1_, BlockPos p_180633_2_, BlockState p_180633_3_, LivingEntity p_180633_4_, ItemStack p_180633_5_) {
if (p_180633_5_.hasCustomHoverName()) {
ExtractorBlockEntity blockEntity = (ExtractorBlockEntity) p_180633_1_.getBlockEntity(p_180633_2_);
if (blockEntity instanceof ExtractorBlockEntity) {
blockEntity.setCustomName(p_180633_5_.getHoverName());
}
}
}
public void onRemove(BlockState p_196243_1_, Level p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_1_.is(p_196243_4_.getBlock())) {
ExtractorBlockEntity blockEntity = (ExtractorBlockEntity) p_196243_2_.getBlockEntity(p_196243_3_);
if (blockEntity instanceof ExtractorBlockEntity) {
Containers.dropContents(p_196243_2_, p_196243_3_, blockEntity);
p_196243_2_.updateNeighbourForOutputSignal(p_196243_3_, this);
}
super.onRemove(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
}
}
public void entityInside(BlockState p_196262_1_, Level p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) {
ExtractorBlockEntity blockEntity = (ExtractorBlockEntity) p_196262_2_.getBlockEntity(p_196262_3_);
if (blockEntity instanceof ExtractorBlockEntity) {
blockEntity.entityInside(p_196262_4_);
}
}
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos p_225533_3_, Player p_225533_4_, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
if (p_225533_2_.isClientSide) {
return InteractionResult.SUCCESS;
}
ExtractorBlockEntity blockEntity = (ExtractorBlockEntity) p_225533_2_.getBlockEntity(p_225533_3_);
if (blockEntity instanceof ExtractorBlockEntity) {
p_225533_4_.openMenu(blockEntity);
p_225533_4_.awardStat(Stats.INSPECT_HOPPER);
}
return InteractionResult.CONSUME;
}
public BlockState getStateForPlacement(BlockPlaceContext p_196258_1_) {
Direction direction = p_196258_1_.getHorizontalDirection();
return (BlockState) ((BlockState) defaultBlockState().setValue(HopperBlock.FACING, direction)).setValue(HopperBlock.ENABLED, true);
}
}

View File

@ -1,74 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/FlatScreenTvBlock.class */
public class FlatScreenTvBlock extends StandardHorizontalBlock {
protected static final VoxelShape SHAPE_NORTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(6.0d, 0.0d, 6.0d, 10.0d, 2.0d, 10.0d), Block.box(-11.1d, 1.525d, 7.0d, 27.075d, 22.65d, 9.0d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
protected static final VoxelShape SHAPE_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
public FlatScreenTvBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState) defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, context.getHorizontalDirection().getOpposite());
}
/* renamed from: com.dairymoose.modernlife.blocks.FlatScreenTvBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/FlatScreenTvBlock$1.class */
static /* synthetic */ class C00211 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00211.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,74 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/FloorMatBlock.class */
public class FloorMatBlock extends StandardHorizontalBlock {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of(Block.box(0.0d, 0.0d, 3.0d, 16.0d, 1.0d, 13.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public FloorMatBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState) defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, context.getHorizontalDirection());
}
/* renamed from: com.dairymoose.modernlife.blocks.FloorMatBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/FloorMatBlock$1.class */
static /* synthetic */ class C00221 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00221.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,165 +0,0 @@
package com.dairymoose.modernlife.blocks;
import net.minecraft.core.BlockPos;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.Property;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/GlassCoffeeTableBlock.class */
public class GlassCoffeeTableBlock extends CoffeeTableBlock {
public static final EnumProperty<GlassTableType> TYPE = EnumProperty.create("type", GlassTableType.class);
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/GlassCoffeeTableBlock$GlassTableType.class */
public enum GlassTableType implements StringRepresentable {
single,
mid,
three_way_n,
three_way_e,
three_way_s,
three_way_w,
one_border_n,
one_border_e,
one_border_s,
one_border_w,
x_axis,
z_axis,
s_end,
w_end,
n_end,
e_end,
ne_corner,
se_corner,
nw_corner,
sw_corner,
ne_four_corner,
se_four_corner,
nw_four_corner,
sw_four_corner;
public String getSerializedName() {
return name().toLowerCase();
}
}
@Override // com.dairymoose.modernlife.blocks.SmallTableBlock
protected BlockState getNewState(LevelAccessor world, BlockPos pos) {
BlockState nState = world.getBlockState(pos.north());
BlockState eState = world.getBlockState(pos.east());
BlockState sState = world.getBlockState(pos.south());
BlockState wState = world.getBlockState(pos.west());
int adjacentTableCount = 0;
boolean nTable = nState.is(this);
boolean eTable = eState.is(this);
boolean sTable = sState.is(this);
boolean wTable = wState.is(this);
BlockState neState = world.getBlockState(pos.north().east());
BlockState nwState = world.getBlockState(pos.north().west());
BlockState seState = world.getBlockState(pos.south().east());
BlockState swState = world.getBlockState(pos.south().west());
boolean neTable = neState.is(this);
boolean nwTable = nwState.is(this);
boolean seTable = seState.is(this);
boolean swTable = swState.is(this);
if (nTable) {
adjacentTableCount = 0 + 1;
}
if (eTable) {
adjacentTableCount++;
}
if (sTable) {
adjacentTableCount++;
}
if (wTable) {
adjacentTableCount++;
}
if (adjacentTableCount >= 2) {
if (nTable && eTable && !sTable && !wTable) {
if (neTable) {
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.sw_four_corner);
}
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.sw_corner);
}
if (nTable && wTable && !sTable && !eTable) {
if (nwTable) {
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.se_four_corner);
}
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.se_corner);
}
if (sTable && eTable && !nTable && !wTable) {
if (seTable) {
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.nw_four_corner);
}
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.nw_corner);
}
if (sTable && wTable && !nTable && !eTable) {
if (swTable) {
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.ne_four_corner);
}
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.ne_corner);
}
if (adjacentTableCount == 2 && wTable && eTable) {
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.x_axis);
}
if (adjacentTableCount == 2 && nTable && sTable) {
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.z_axis);
}
if (adjacentTableCount == 3) {
if (wTable && nTable && eTable) {
if (nwTable || neTable) {
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.one_border_n);
}
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.three_way_n);
}
if (nTable && eTable && sTable) {
if (seTable || neTable) {
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.one_border_e);
}
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.three_way_e);
}
if (eTable && sTable && wTable) {
if (seTable || swTable) {
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.one_border_s);
}
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.three_way_s);
}
if (sTable && wTable && nTable) {
if (swTable || nwTable) {
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.one_border_w);
}
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.three_way_w);
}
}
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.mid);
}
if (adjacentTableCount == 1) {
if (nTable) {
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.s_end);
}
if (eTable) {
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.w_end);
}
if (sTable) {
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.n_end);
}
if (wTable) {
return (BlockState) defaultBlockState().setValue(TYPE, GlassTableType.e_end);
}
}
return defaultBlockState();
}
@Override // com.dairymoose.modernlife.blocks.SmallTableBlock
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{TYPE});
}
public GlassCoffeeTableBlock(Properties p_i48377_1_) {
super(p_i48377_1_, true);
registerDefaultState((BlockState) defaultBlockState().setValue(TYPE, GlassTableType.single));
}
}

View File

@ -1,106 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.AttachFace;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/GlassPanelBlock.class */
public class GlassPanelBlock extends AbstractPanelBlock {
protected static final VoxelShape SHAPE_FLOOR_NORTH = (VoxelShape) Stream.of(Block.box(0.0d, 0.0d, 0.0d, 16.0d, 1.0d, 16.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WALL_NORTH = (VoxelShape) Stream.of(Block.box(0.0d, 0.0d, 15.0d, 16.0d, 16.0d, 16.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WALL_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WALL_NORTH);
protected static final VoxelShape SHAPE_WALL_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WALL_EAST);
protected static final VoxelShape SHAPE_WALL_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WALL_SOUTH);
protected static final VoxelShape SHAPE_CEILING_NORTH = (VoxelShape) Stream.of(Block.box(0.0d, 15.0d, 0.0d, 16.0d, 16.0d, 16.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
public GlassPanelBlock(Properties props) {
super(props);
registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any().setValue(AbstractPanelBlock.FACING, Direction.NORTH)).setValue(AbstractPanelBlock.FACE, AttachFace.FLOOR));
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{AbstractPanelBlock.FACING, AbstractPanelBlock.FACE});
}
/* renamed from: com.dairymoose.modernlife.blocks.GlassPanelBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/GlassPanelBlock$1.class */
static /* synthetic */ class C00231 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction;
/* renamed from: $SwitchMap$net$minecraft$world$level$block$state$properties$AttachFace */
static final /* synthetic */ int[] f2x6a19ab39 = new int[AttachFace.values().length];
static {
try {
f2x6a19ab39[AttachFace.FLOOR.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
f2x6a19ab39[AttachFace.WALL.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
f2x6a19ab39[AttachFace.CEILING.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
$SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e4) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 2;
} catch (NoSuchFieldError e5) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 3;
} catch (NoSuchFieldError e6) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 4;
} catch (NoSuchFieldError e7) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00231.f2x6a19ab39[bs.getValue(AbstractPanelBlock.FACE).ordinal()]) {
case 1:
return SHAPE_FLOOR_NORTH;
case 2:
switch (C00231.$SwitchMap$net$minecraft$core$Direction[bs.getValue(AbstractPanelBlock.FACING).ordinal()]) {
case 1:
return SHAPE_WALL_NORTH;
case 2:
return SHAPE_WALL_EAST;
case 3:
return SHAPE_WALL_WEST;
case 4:
return SHAPE_WALL_SOUTH;
}
case 3:
break;
default:
return SHAPE_FLOOR_NORTH;
}
return SHAPE_CEILING_NORTH;
}
}

View File

@ -1,364 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.core.CustomBlocks;
import com.dairymoose.modernlife.core.McpConstants;
import com.dairymoose.modernlife.core.ModernLifeCommon;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.ExperienceOrb;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LiquidBlock;
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.AttachFace;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.FlowingFluid;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.material.LavaFluid;
import net.minecraft.world.level.material.WaterFluid;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.EntityCollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/GrateBlock.class */
public class
GrateBlock extends AbstractPanelBlock implements SimpleWaterloggedBlock {
private boolean allowAllLiquids = true;
private static final int MS_PER_TICK = 50;
private static final float GRATE_SLOWDOWN_FACTOR = 1.0f;
private final ScheduledExecutorService scheduler;
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
public static final IntegerProperty LEVEL = IntegerProperty.create("level", 0, 8);
public static final EnumProperty<FluidType> FLUIDTYPE = EnumProperty.create("fluidtype", FluidType.class);
private static final HashSet<BlockPos> respawning = new HashSet<>();
private static final HashMap<BlockPos, Integer> waterLevel = new HashMap<>();
protected static final VoxelShape SHAPE_FLOOR_NORTH = (VoxelShape) Stream.of(Block.box(0.0d, 0.0d, 0.0d, 16.0d, 1.0d, 16.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WALL_NORTH = (VoxelShape) Stream.of(Block.box(0.0d, 0.0d, 15.0d, 16.0d, 16.0d, 16.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WALL_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WALL_NORTH);
protected static final VoxelShape SHAPE_WALL_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WALL_EAST);
protected static final VoxelShape SHAPE_WALL_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WALL_SOUTH);
protected static final VoxelShape SHAPE_CEILING_NORTH = (VoxelShape) Stream.of(Block.box(0.0d, 15.0d, 0.0d, 16.0d, 16.0d, 16.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/GrateBlock$FluidType.class */
public enum FluidType implements StringRepresentable {
water,
lava;
public String getSerializedName() {
return name().toLowerCase();
}
}
public GrateBlock(Properties props) {
super(props);
this.allowAllLiquids = true;
this.scheduler = Executors.newScheduledThreadPool(1);
registerDefaultState((BlockState) ((BlockState) ((BlockState) ((BlockState) this.stateDefinition.any().setValue(AbstractPanelBlock.FACING, Direction.NORTH)).setValue(AbstractPanelBlock.FACE, AttachFace.FLOOR)).setValue(WATERLOGGED, false)).setValue(LEVEL, 0));
}
public ItemStack pickupBlock(LevelAccessor p_154560_, BlockPos p_154561_, BlockState p_154562_) {
ItemStack fluid = pickupBlock(p_154560_, p_154561_, p_154562_);
BlockState newState = p_154560_.getBlockState(p_154561_);
if (!((Boolean) newState.getValue(WATERLOGGED)).booleanValue()) {
ModernLifeCommon.LOGGER.debug("Set level to 0");
p_154560_.setBlock(p_154561_, (BlockState) newState.setValue(LEVEL, 0), 3);
}
return fluid;
}
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Allows water and items to flow through freely"));
}
public boolean placeLiquid(LevelAccessor p_204509_1_, BlockPos p_204509_2_, BlockState p_204509_3_, FluidState p_204509_4_) {
if ((p_204509_4_.getType() instanceof WaterFluid) || (p_204509_4_.getType() instanceof LavaFluid)) {
if (p_204509_1_ instanceof ServerLevel) {
ServerLevel world = (ServerLevel) p_204509_1_;
FluidType f = FluidType.water;
if (p_204509_4_.getType() instanceof WaterFluid) {
f = FluidType.water;
} else if (p_204509_4_.getType() instanceof LavaFluid) {
f = FluidType.lava;
}
int newLevel = p_204509_4_.getAmount();
ModernLifeCommon.LOGGER.debug("placeLiquid update: " + p_204509_4_);
if (p_204509_4_.isSource()) {
world.setBlock(p_204509_2_, (BlockState) ((BlockState) ((BlockState) p_204509_3_.setValue(WATERLOGGED, true)).setValue(FLUIDTYPE, f)).setValue(LEVEL, Integer.valueOf(newLevel)), 3);
return true;
}
world.setBlock(p_204509_2_, (BlockState) ((BlockState) p_204509_3_.setValue(LEVEL, Integer.valueOf(newLevel))).setValue(FLUIDTYPE, f), 3);
return true;
}
return true;
}
return false;
}
public boolean canPlaceLiquid(BlockGetter p_204510_1_, BlockPos p_204510_2_, BlockState p_204510_3_, Fluid p_204510_4_) {
if (this.allowAllLiquids) {
return true;
}
return canPlaceLiquid(p_204510_1_, p_204510_2_, p_204510_3_, p_204510_4_);
}
public BlockState updateShape(BlockState grate, Direction dir, BlockState updater, LevelAccessor world, BlockPos gratePos, BlockPos updaterPos) {
ModernLifeCommon.LOGGER.debug("world = " + world);
ModernLifeCommon.LOGGER.debug("updateShape, bs1: " + grate + " with pos = " + gratePos);
ModernLifeCommon.LOGGER.debug("updateShape, bs2: " + updater + " with pos = " + updaterPos);
ModernLifeCommon.LOGGER.debug("direction = " + dir);
final BlockPos originalGratePos = gratePos.mutable();
final GrateBlock grateBlock = this;
this.scheduler.schedule(new Runnable() { // from class: com.dairymoose.modernlife.blocks.GrateBlock.1
@Override // java.lang.Runnable
public void run() {
Method newLiquidMethod = null;
try {
try {
int currentLevel = ((Integer) grate.getValue(GrateBlock.LEVEL)).intValue();
try {
newLiquidMethod = FlowingFluid.class.getDeclaredMethod(McpConstants.FLOWING_FLUID_getNewLiquid, LevelReader.class, BlockPos.class, BlockState.class);
} catch (NoSuchMethodException e) {
}
if (newLiquidMethod == null) {
newLiquidMethod = FlowingFluid.class.getDeclaredMethod("getNewLiquid", LevelReader.class, BlockPos.class, BlockState.class);
}
newLiquidMethod.setAccessible(true);
FluidState newFluid = (FluidState) newLiquidMethod.invoke(Fluids.FLOWING_WATER, world, originalGratePos, grate);
int newLevel = newFluid.getAmount();
if (newLevel < currentLevel) {
BlockState newGrateState = world.getBlockState(originalGratePos);
if (newGrateState.is(CustomBlocks.BLOCK_METAL_GRATE.get()) && !((Boolean) newGrateState.getValue(GrateBlock.WATERLOGGED)).booleanValue()) {
world.setBlock(originalGratePos, (BlockState) grate.setValue(GrateBlock.LEVEL, Integer.valueOf(newLevel)), 3);
}
ModernLifeCommon.LOGGER.debug("Set to new state: " + grate.setValue(GrateBlock.LEVEL, Integer.valueOf(newLevel)));
}
allowAllLiquids = true;
} catch (Throwable th) {
allowAllLiquids = true;
throw th;
}
} catch (IllegalAccessException | IllegalArgumentException | NoSuchMethodException | SecurityException | InvocationTargetException e1) {
ModernLifeCommon.LOGGER.error("getNewLiquid error", e1);
allowAllLiquids = true;
}
}
}, (int) (MS_PER_TICK * updater.getFluidState().getType().getTickDelay(world) * GRATE_SLOWDOWN_FACTOR), TimeUnit.MILLISECONDS);
return grate;
}
public VoxelShape getCollisionShape(BlockState state, BlockGetter blockReader, BlockPos blockPos, CollisionContext ctx) {
Entity collisionEntity = null;
if (ctx instanceof EntityCollisionContext) {
collisionEntity = ((EntityCollisionContext) ctx).getEntity() != null ? ((EntityCollisionContext) ctx).getEntity() : null;
}
if (ctx == CollisionContext.empty() || (collisionEntity != null && ((collisionEntity instanceof ItemEntity) || (collisionEntity instanceof ExperienceOrb)))) {
return Shapes.empty();
}
return super.getCollisionShape(state, blockReader, blockPos, ctx);
}
@Override // com.dairymoose.modernlife.blocks.AbstractPanelBlock
public BlockState getStateForPlacement(BlockPlaceContext context) {
FluidType f = FluidType.water;
Level world = context.getLevel();
BlockPos pos = context.getClickedPos();
BlockState oldState = world.getBlockState(pos);
if (oldState.getFluidState().getType() instanceof WaterFluid) {
f = FluidType.water;
} else if (oldState.getFluidState().getType() instanceof LavaFluid) {
f = FluidType.lava;
}
boolean waterlogged = false;
if (!oldState.getFluidState().isEmpty() && oldState.getFluidState().isSource()) {
waterlogged = true;
}
return (BlockState) ((BlockState) ((BlockState) super.getStateForPlacement(context).setValue(LEVEL, Integer.valueOf(oldState.getFluidState().getAmount()))).setValue(FLUIDTYPE, f)).setValue(WATERLOGGED, Boolean.valueOf(waterlogged));
}
@Deprecated
public void onPlace(BlockState newState, Level world, BlockPos pos, BlockState oldState, boolean p_220082_5_) {
ModernLifeCommon.LOGGER.debug("onPlace newState = " + newState + ", bool=" + p_220082_5_);
if (!(oldState.getBlock() instanceof LiquidBlock) || !oldState.getFluidState().isEmpty()) {
}
int level = ((Integer) newState.getValue(LEVEL)).intValue();
if (level >= 0) {
this.scheduler.schedule(new Runnable() { // from class: com.dairymoose.modernlife.blocks.GrateBlock.2
@Override // java.lang.Runnable
public void run() {
FlowingFluid fluid = Fluids.WATER;
if (newState.getValue(GrateBlock.FLUIDTYPE) == FluidType.water) {
fluid = Fluids.WATER;
} else if (newState.getValue(GrateBlock.FLUIDTYPE) == FluidType.lava) {
fluid = Fluids.LAVA;
}
int level2 = ((Integer) newState.getValue(GrateBlock.LEVEL)).intValue();
Method m = null;
try {
try {
m = FlowingFluid.class.getDeclaredMethod(McpConstants.FLOWING_FLUID_spread, LevelAccessor.class, BlockPos.class, FluidState.class);
} catch (NoSuchMethodException e) {
}
if (m == null) {
m = FlowingFluid.class.getDeclaredMethod("spread", LevelAccessor.class, BlockPos.class, FluidState.class);
}
m.setAccessible(true);
Fluids.EMPTY.defaultFluidState();
if (level2 > 0 && (fluid instanceof FlowingFluid)) {
FluidState fs = fluid.getFlowing(level2, false);
m.invoke(fluid, world, pos, fs);
}
} catch (IllegalAccessException | IllegalArgumentException | NoSuchMethodException | SecurityException | InvocationTargetException e2) {
ModernLifeCommon.LOGGER.error("Fluid error", e2);
}
world.updateNeighborsAt(pos, newState.getBlock());
}
}, MS_PER_TICK * getFluidState(newState).getType().getTickDelay(world), TimeUnit.MILLISECONDS);
} else {
world.updateNeighborsAt(pos, newState.getBlock());
}
}
@Deprecated
public FluidState getFluidState(BlockState state) {
if (((Boolean) state.getValue(WATERLOGGED)).booleanValue() && state.getValue(FLUIDTYPE) == FluidType.water) {
return Fluids.WATER.getSource(false);
}
if (((Boolean) state.getValue(WATERLOGGED)).booleanValue() && state.getValue(FLUIDTYPE) == FluidType.lava) {
return Fluids.LAVA.getSource(false);
}
if (((Integer) state.getValue(LEVEL)).intValue() > 0 && state.getValue(FLUIDTYPE) == FluidType.water) {
return Fluids.WATER.getFlowing(((Integer) state.getValue(LEVEL)).intValue(), false);
}
if (((Integer) state.getValue(LEVEL)).intValue() > 0 && state.getValue(FLUIDTYPE) == FluidType.lava) {
return Fluids.LAVA.getFlowing(((Integer) state.getValue(LEVEL)).intValue(), false);
}
return Fluids.EMPTY.defaultFluidState();
}
public void onRemove(BlockState oldState, Level p_196243_2_, BlockPos pos, BlockState newState, boolean p_196243_5_) {
ModernLifeCommon.LOGGER.debug("Being changed to : " + newState);
if (newState.is(Blocks.WATER) || newState.is(Blocks.AIR)) {
ModernLifeCommon.LOGGER.debug("Respawn: " + oldState);
}
if (newState.is(Blocks.LAVA)) {
}
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{AbstractPanelBlock.FACING, AbstractPanelBlock.FACE, WATERLOGGED, LEVEL, FLUIDTYPE});
}
/* renamed from: com.dairymoose.modernlife.blocks.GrateBlock$3 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/GrateBlock$3.class */
static /* synthetic */ class C00263 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction;
/* renamed from: $SwitchMap$net$minecraft$world$level$block$state$properties$AttachFace */
static final /* synthetic */ int[] f3x6a19ab39 = new int[AttachFace.values().length];
static {
try {
f3x6a19ab39[AttachFace.FLOOR.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
f3x6a19ab39[AttachFace.WALL.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
f3x6a19ab39[AttachFace.CEILING.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
$SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e4) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 2;
} catch (NoSuchFieldError e5) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 3;
} catch (NoSuchFieldError e6) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 4;
} catch (NoSuchFieldError e7) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00263.f3x6a19ab39[bs.getValue(AbstractPanelBlock.FACE).ordinal()]) {
case 1:
return SHAPE_FLOOR_NORTH;
case 2:
switch (C00263.$SwitchMap$net$minecraft$core$Direction[bs.getValue(AbstractPanelBlock.FACING).ordinal()]) {
case 1:
return SHAPE_WALL_NORTH;
case 2:
return SHAPE_WALL_EAST;
case 3:
return SHAPE_WALL_WEST;
case 4:
return SHAPE_WALL_SOUTH;
}
case 3:
break;
default:
return SHAPE_FLOOR_NORTH;
}
return SHAPE_CEILING_NORTH;
}
}

View File

@ -1,81 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.List;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/GuitarAmplifierBlock.class */
public class GuitarAmplifierBlock extends StandardHorizontalBlock {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(4.75d, 12.5d, 7.5d, 11.25d, 13.0d, 8.5d), Block.box(3.0d, 12.0d, 7.5d, 5.0d, 12.5d, 8.5d), Block.box(11.0d, 12.0d, 7.5d, 13.0d, 12.5d, 8.5d), Block.box(2.0d, 0.0d, 5.0d, 14.0d, 12.0d, 11.0d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public GuitarAmplifierBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Play a guitar nearby to add a distortion effect"));
}
/* renamed from: com.dairymoose.modernlife.blocks.GuitarAmplifierBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/GuitarAmplifierBlock$1.class */
static /* synthetic */ class C00271 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00271.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,133 +0,0 @@
package com.dairymoose.modernlife.blocks;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/HotWaterHeaterBlock.class */
public class HotWaterHeaterBlock extends Block {
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
public static final EnumProperty<DoubleBlockHalf> HALF = BlockStateProperties.DOUBLE_BLOCK_HALF;
protected static final VoxelShape SOUTH_AABB = Block.box(1.0d, 0.0d, 1.0d, 15.0d, 16.0d, 15.0d);
protected static final VoxelShape NORTH_AABB = Block.box(1.0d, 0.0d, 1.0d, 15.0d, 16.0d, 15.0d);
protected static final VoxelShape WEST_AABB = Block.box(1.0d, 0.0d, 1.0d, 15.0d, 16.0d, 15.0d);
protected static final VoxelShape EAST_AABB = Block.box(1.0d, 0.0d, 1.0d, 15.0d, 16.0d, 15.0d);
public HotWaterHeaterBlock(Properties p_i48413_1_) {
super(p_i48413_1_);
registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any().setValue(FACING, Direction.NORTH)).setValue(HALF, DoubleBlockHalf.LOWER));
}
public VoxelShape getShape(BlockState p_220053_1_, BlockGetter p_220053_2_, BlockPos p_220053_3_, CollisionContext p_220053_4_) {
Direction lvt_5_1_ = p_220053_1_.getValue(FACING);
switch (lvt_5_1_.ordinal()) {
case 1:
default:
return EAST_AABB;
case 2:
return SOUTH_AABB;
case 3:
return WEST_AABB;
case 4:
return NORTH_AABB;
}
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
Comparable comparable = (DoubleBlockHalf) p_196271_1_.getValue(HALF);
if (p_196271_2_.getAxis() == Direction.Axis.Y) {
if ((comparable == DoubleBlockHalf.LOWER) == (p_196271_2_ == Direction.UP)) {
return (!p_196271_3_.is(this) || p_196271_3_.getValue(HALF) == comparable) ? Blocks.AIR.defaultBlockState() : (BlockState) p_196271_1_.setValue(FACING, p_196271_3_.getValue(FACING));
}
}
return (comparable == DoubleBlockHalf.LOWER && p_196271_2_ == Direction.DOWN && !p_196271_1_.canSurvive(p_196271_4_, p_196271_5_)) ? Blocks.AIR.defaultBlockState() : super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
protected static void preventCreativeDropFromBottomPart(Level p_241471_0_, BlockPos p_241471_1_, BlockState p_241471_2_, Player p_241471_3_) {
DoubleBlockHalf doubleblockhalf = p_241471_2_.getValue(HALF);
if (doubleblockhalf == DoubleBlockHalf.UPPER) {
BlockPos blockpos = p_241471_1_.below();
BlockState blockstate = p_241471_0_.getBlockState(blockpos);
if (blockstate.getBlock() == p_241471_2_.getBlock() && blockstate.getValue(HALF) == DoubleBlockHalf.LOWER) {
p_241471_0_.setBlock(blockpos, Blocks.AIR.defaultBlockState(), 35);
p_241471_0_.levelEvent(p_241471_3_, 2001, blockpos, Block.getId(blockstate));
}
}
}
public void playerWillDestroy(Level p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, Player p_176208_4_) {
if (!p_176208_1_.isClientSide && p_176208_4_.isCreative()) {
preventCreativeDropFromBottomPart(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
super.playerWillDestroy(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
public BlockState rotate(BlockState p_52790_, Rotation p_52791_) {
return (BlockState) p_52790_.setValue(FACING, p_52791_.rotate(p_52790_.getValue(FACING)));
}
public BlockState mirror(BlockState p_52787_, Mirror p_52788_) {
return p_52788_ == Mirror.NONE ? p_52787_ : p_52787_.rotate(p_52788_.getRotation(p_52787_.getValue(FACING)));
}
@Nullable
public BlockState getStateForPlacement(BlockPlaceContext p_196258_1_) {
BlockPos lvt_2_1_ = p_196258_1_.getClickedPos();
if (lvt_2_1_.getY() < p_196258_1_.getLevel().getMaxBuildHeight() && p_196258_1_.getLevel().getBlockState(lvt_2_1_.above()).canBeReplaced(p_196258_1_)) {
Level lvt_3_1_ = p_196258_1_.getLevel();
boolean z = lvt_3_1_.hasNeighborSignal(lvt_2_1_) || lvt_3_1_.hasNeighborSignal(lvt_2_1_.above());
return (BlockState) ((BlockState) defaultBlockState().setValue(FACING, p_196258_1_.getHorizontalDirection())).setValue(HALF, DoubleBlockHalf.LOWER);
}
return null;
}
public void setPlacedBy(Level p_180633_1_, BlockPos p_180633_2_, BlockState p_180633_3_, LivingEntity p_180633_4_, ItemStack p_180633_5_) {
p_180633_1_.setBlock(p_180633_2_.above(), (BlockState) p_180633_3_.setValue(HALF, DoubleBlockHalf.UPPER), 3);
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
BlockPos lvt_4_1_ = p_196260_3_.below();
BlockState lvt_5_1_ = p_196260_2_.getBlockState(lvt_4_1_);
return p_196260_1_.getValue(HALF) == DoubleBlockHalf.LOWER ? lvt_5_1_.isFaceSturdy(p_196260_2_, lvt_4_1_, Direction.UP) : lvt_5_1_.is(this);
}
public PushReaction getPistonPushReaction(BlockState p_149656_1_) {
return PushReaction.DESTROY;
}
@OnlyIn(Dist.CLIENT)
public long getSeed(BlockState p_209900_1_, BlockPos p_209900_2_) {
return Mth.getSeed(p_209900_2_.getX(), p_209900_2_.below(p_209900_1_.getValue(HALF) == DoubleBlockHalf.LOWER ? 0 : 1).getY(), p_209900_2_.getZ());
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_206840_1_) {
p_206840_1_.add(new Property[]{HALF, FACING});
}
}

View File

@ -1,74 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/JailBarsBlock.class */
public class JailBarsBlock extends StandardHorizontalBlock {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of(Block.box(0.0d, 0.0d, 0.0d, 16.0d, 16.0d, 3.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public JailBarsBlock(Properties props) {
super(props);
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState) defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, context.getHorizontalDirection());
}
/* renamed from: com.dairymoose.modernlife.blocks.JailBarsBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/JailBarsBlock$1.class */
static /* synthetic */ class C00281 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00281.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,70 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/KitchenCabinetBlock.class */
public class KitchenCabinetBlock extends NightStandBlock {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(9.55d, 1.8d, 16.0d, 10.8d, 2.8d, 16.5d), Block.box(0.0d, 0.0d, 0.0d, 16.0d, 16.0d, 15.0d), Block.box(0.25d, 0.5d, 15.0d, 8.0d, 15.5d, 15.5d), Block.box(1.25d, 1.5d, 15.5d, 7.0d, 14.5d, 16.1d), Block.box(0.75d, 1.0d, 15.5d, 7.5d, 15.0d, 16.075d), Block.box(9.25d, 1.5d, 15.5d, 14.75d, 14.5d, 16.1d), Block.box(8.75d, 1.0d, 15.5d, 15.25d, 15.0d, 16.05d), Block.box(8.25d, 0.5d, 15.0d, 15.75d, 15.5d, 15.5d), Block.box(5.4d, 1.85d, 16.0d, 6.65d, 2.85d, 16.5d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public KitchenCabinetBlock(Properties properties) {
super(properties);
this.containerDisplayLabel = "Kitchen Cabinet";
}
/* renamed from: com.dairymoose.modernlife.blocks.KitchenCabinetBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/KitchenCabinetBlock$1.class */
static /* synthetic */ class C00291 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
@Override // com.dairymoose.modernlife.blocks.NightStandBlock
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00291.$SwitchMap$net$minecraft$core$Direction[bs.getValue(NightStandBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,70 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/KitchenDrawerCabinetBlock.class */
public class KitchenDrawerCabinetBlock extends NightStandBlock {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(0.05d, 0.15d, 15.51d, 15.95d, 15.975d, 15.51d), Block.box(0.0d, 0.0d, 0.0d, 16.0d, 16.0d, 15.5d), Block.box(1.0d, 1.0d, 15.5d, 15.0d, 11.0d, 16.0d), Block.box(1.0d, 11.5d, 15.5d, 15.0d, 15.0d, 16.0d), Block.box(6.25d, 12.75d, 16.0d, 6.75d, 13.25d, 16.5d), Block.box(6.25d, 12.75d, 16.5d, 10.25d, 13.25d, 17.0d), Block.box(9.75d, 12.75d, 16.0d, 10.25d, 13.25d, 16.5d), Block.box(14.0d, 8.5d, 16.25d, 14.5d, 10.5d, 16.5d), Block.box(14.0d, 10.25d, 16.0d, 14.5d, 10.5d, 16.25d), Block.box(14.0d, 8.5d, 16.0d, 14.5d, 8.75d, 16.25d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public KitchenDrawerCabinetBlock(Properties properties) {
super(properties);
this.containerDisplayLabel = "Kitchen Drawer Cabinet";
}
/* renamed from: com.dairymoose.modernlife.blocks.KitchenDrawerCabinetBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/KitchenDrawerCabinetBlock$1.class */
static /* synthetic */ class C00301 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
@Override // com.dairymoose.modernlife.blocks.NightStandBlock
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00301.$SwitchMap$net$minecraft$core$Direction[bs.getValue(NightStandBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,68 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/KitchenSinkBlock.class */
public class KitchenSinkBlock extends StandardHorizontalBlock {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(6.0d, 5.25d, 1.0d, 7.0d, 6.25d, 2.0d), Block.box(0.0d, 2.15d, -0.02499999999999858d, 16.05d, 3.25d, 16.05d), Block.box(0.04999999999999982d, 0.0d, 0.025000000000000355d, 2.95d, 3.0999999999999996d, 16.0d), Block.box(13.05d, 0.0d, 0.025000000000000355d, 16.0d, 3.0999999999999996d, 16.0d), Block.box(3.0d, 0.0d, 13.05d, 13.0d, 3.0999999999999996d, 16.0d), Block.box(0.2749999999999986d, -0.04999999999999999d, 0.32500000000000107d, 15.75d, 0.09999999999999964d, 15.625d), Block.box(3.0d, 0.0d, 0.025000000000000355d, 13.05d, 3.0999999999999996d, 2.9499999999999993d), Block.box(5.5d, 3.25d, 0.25d, 10.5d, 5.25d, 3.0d), Block.box(7.525d, 6.775000000000009d, 7.549999999999999d, 8.475d, 7.300000000000008d, 8.55d), Block.box(7.625d, 6.7250000000000085d, 7.649999999999999d, 8.375d, 6.800000000000008d, 8.450000000000001d), Block.box(9.25d, 6.26d, 1.25d, 9.75d, 6.26d, 1.75d), Block.box(9.0d, 5.25d, 1.0d, 10.0d, 6.25d, 2.0d), Block.box(6.25d, 6.26d, 1.25d, 6.75d, 6.26d, 1.75d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public KitchenSinkBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
/* renamed from: com.dairymoose.modernlife.blocks.KitchenSinkBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/KitchenSinkBlock$1.class */
static /* synthetic */ class C00311 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00311.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,110 +0,0 @@
package com.dairymoose.modernlife.blocks;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/LanternPostBlock.class */
public class LanternPostBlock extends Block {
protected static final VoxelShape SHAPE_NORTH = Block.box(4.0d, 0.0d, 4.0d, 12.0d, 16.0d, 12.0d);
protected static final VoxelShape SUPPORT_CENTER_SHAPE = Block.box(7.0d, 0.0d, 7.0d, 9.0d, 16.0d, 9.0d);
public static final EnumProperty<DoubleBlockHalf> HALF = BlockStateProperties.DOUBLE_BLOCK_HALF;
public LanternPostBlock(Properties p_i48413_1_) {
super(p_i48413_1_);
registerDefaultState((BlockState) this.stateDefinition.any().setValue(HALF, DoubleBlockHalf.LOWER));
}
public VoxelShape getShape(BlockState state, BlockGetter p_220053_2_, BlockPos p_220053_3_, CollisionContext context) {
if (state.getValue(HALF) == DoubleBlockHalf.UPPER && context == CollisionContext.empty()) {
return SUPPORT_CENTER_SHAPE;
}
return SHAPE_NORTH;
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
Comparable comparable = (DoubleBlockHalf) p_196271_1_.getValue(HALF);
if (p_196271_2_.getAxis() == Direction.Axis.Y) {
if ((comparable == DoubleBlockHalf.LOWER) == (p_196271_2_ == Direction.UP)) {
return (!p_196271_3_.is(this) || p_196271_3_.getValue(HALF) == comparable) ? Blocks.AIR.defaultBlockState() : p_196271_1_;
}
}
return (comparable == DoubleBlockHalf.LOWER && p_196271_2_ == Direction.DOWN && !p_196271_1_.canSurvive(p_196271_4_, p_196271_5_)) ? Blocks.AIR.defaultBlockState() : super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
protected static void preventCreativeDropFromBottomPart(Level p_241471_0_, BlockPos p_241471_1_, BlockState p_241471_2_, Player p_241471_3_) {
DoubleBlockHalf doubleblockhalf = p_241471_2_.getValue(HALF);
if (doubleblockhalf == DoubleBlockHalf.UPPER) {
BlockPos blockpos = p_241471_1_.below();
BlockState blockstate = p_241471_0_.getBlockState(blockpos);
if (blockstate.getBlock() == p_241471_2_.getBlock() && blockstate.getValue(HALF) == DoubleBlockHalf.LOWER) {
p_241471_0_.setBlock(blockpos, Blocks.AIR.defaultBlockState(), 35);
p_241471_0_.levelEvent(p_241471_3_, 2001, blockpos, Block.getId(blockstate));
}
}
}
public void playerWillDestroy(Level p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, Player p_176208_4_) {
if (!p_176208_1_.isClientSide && p_176208_4_.isCreative()) {
preventCreativeDropFromBottomPart(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
super.playerWillDestroy(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
@Nullable
public BlockState getStateForPlacement(BlockPlaceContext p_196258_1_) {
BlockPos lvt_2_1_ = p_196258_1_.getClickedPos();
if (lvt_2_1_.getY() < p_196258_1_.getLevel().getMaxBuildHeight() && p_196258_1_.getLevel().getBlockState(lvt_2_1_.above()).canBeReplaced(p_196258_1_)) {
Level lvt_3_1_ = p_196258_1_.getLevel();
boolean z = lvt_3_1_.hasNeighborSignal(lvt_2_1_) || lvt_3_1_.hasNeighborSignal(lvt_2_1_.above());
return (BlockState) defaultBlockState().setValue(HALF, DoubleBlockHalf.LOWER);
}
return null;
}
public void setPlacedBy(Level p_180633_1_, BlockPos p_180633_2_, BlockState p_180633_3_, LivingEntity p_180633_4_, ItemStack p_180633_5_) {
p_180633_1_.setBlock(p_180633_2_.above(), (BlockState) p_180633_3_.setValue(HALF, DoubleBlockHalf.UPPER), 3);
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
BlockPos lvt_4_1_ = p_196260_3_.below();
BlockState lvt_5_1_ = p_196260_2_.getBlockState(lvt_4_1_);
return p_196260_1_.getValue(HALF) == DoubleBlockHalf.LOWER ? lvt_5_1_.isFaceSturdy(p_196260_2_, lvt_4_1_, Direction.UP) : lvt_5_1_.is(this);
}
public PushReaction getPistonPushReaction(BlockState p_149656_1_) {
return PushReaction.DESTROY;
}
@OnlyIn(Dist.CLIENT)
public long getSeed(BlockState p_209900_1_, BlockPos p_209900_2_) {
return Mth.getSeed(p_209900_2_.getX(), p_209900_2_.below(p_209900_1_.getValue(HALF) == DoubleBlockHalf.LOWER ? 0 : 1).getY(), p_209900_2_.getZ());
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_206840_1_) {
p_206840_1_.add(new Property[]{HALF});
}
}

View File

@ -1,183 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.List;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.AttachFace;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/LightBulbBlock.class */
public class LightBulbBlock extends FaceAttachedHorizontalDirectionalBlock {
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
protected static final VoxelShape SHAPE_CEILING = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(6.75d, 11.924999999999995d, 6.725d, 9.25d, 13.149999999999995d, 9.25d), Block.box(7.162500000000001d, 10.950000000000001d, 7.137500000000001d, 8.8375d, 11.925d, 8.837499999999999d), Block.box(6.987500000000001d, 12.950000000000001d, 6.987500000000001d, 9.012500000000001d, 13.950000000000001d, 8.987499999999999d), Block.box(7.162500000000001d, 13.950000000000001d, 7.137500000000001d, 8.8375d, 14.400000000000002d, 8.812499999999998d), Block.box(7.4d, 14.4d, 7.35d, 8.675d, 16.0d, 8.6d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected final VoxelShape SHAPE_WALL_NORTH;
protected final VoxelShape SHAPE_WALL_EAST;
protected final VoxelShape SHAPE_WALL_SOUTH;
protected final VoxelShape SHAPE_WALL_WEST;
protected final VoxelShape SHAPE_FLOOR;
public BlockState rotate(BlockState state, Rotation rotation) {
return state;
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state;
}
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Requires redstone power to operate"));
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: com.dairymoose.modernlife.blocks.LightBulbBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/LightBulbBlock$1.class */
public class C00321 implements StatePredicate {
C00321() {
}
public boolean test(BlockState state, BlockGetter reader, BlockPos pos) {
if (((Boolean) state.getValue(LightBulbBlock.POWERED)).booleanValue()) {
return true;
}
return false;
}
}
public LightBulbBlock(Properties props) {
super(props.lightLevel(LightBulbBlock::getLightLevel).emissiveRendering(new StatePredicate() { // from class: com.dairymoose.modernlife.blocks.LightBulbBlock.1
public boolean test(BlockState state, BlockGetter reader, BlockPos pos) {
if (((Boolean) state.getValue(LightBulbBlock.POWERED)).booleanValue()) {
return true;
}
return false;
}
}));
this.SHAPE_WALL_NORTH = ModernLifeUtil.RotateVoxelShapeXAxis(SHAPE_CEILING);
this.SHAPE_WALL_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(this.SHAPE_WALL_NORTH);
this.SHAPE_WALL_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(this.SHAPE_WALL_EAST);
this.SHAPE_WALL_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(this.SHAPE_WALL_SOUTH);
this.SHAPE_FLOOR = ModernLifeUtil.RotateVoxelShapeXAxis(this.SHAPE_WALL_NORTH);
registerDefaultState((BlockState) ((BlockState) ((BlockState) this.stateDefinition.any().setValue(FaceAttachedHorizontalDirectionalBlock.FACE, AttachFace.CEILING)).setValue(HorizontalDirectionalBlock.FACING, Direction.NORTH)).setValue(POWERED, false));
}
public static int getLightLevel(BlockState state) {
if (((Boolean) state.getValue(POWERED)).booleanValue()) {
return 15;
}
return 0;
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
BlockPos pos = context.getClickedPos();
boolean signal = context.getLevel().hasNeighborSignal(pos);
BlockState superState = super.getStateForPlacement(context);
if (superState == null) {
superState = defaultBlockState();
}
return (BlockState) superState.setValue(POWERED, Boolean.valueOf(signal));
}
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block block, BlockPos neighborPos, boolean p_220069_6_) {
boolean signal = world.hasNeighborSignal(pos);
if (block != this && signal != ((Boolean) state.getValue(POWERED)).booleanValue()) {
world.setBlock(pos, (BlockState) state.setValue(POWERED, Boolean.valueOf(signal)), 2);
}
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FaceAttachedHorizontalDirectionalBlock.FACE, HorizontalDirectionalBlock.FACING, POWERED});
}
/* renamed from: com.dairymoose.modernlife.blocks.LightBulbBlock$2 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/LightBulbBlock$2.class */
static /* synthetic */ class C00332 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction;
/* renamed from: $SwitchMap$net$minecraft$world$level$block$state$properties$AttachFace */
static final /* synthetic */ int[] f4x6a19ab39 = new int[AttachFace.values().length];
static {
try {
f4x6a19ab39[AttachFace.CEILING.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
f4x6a19ab39[AttachFace.WALL.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
f4x6a19ab39[AttachFace.FLOOR.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
$SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e4) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 2;
} catch (NoSuchFieldError e5) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 3;
} catch (NoSuchFieldError e6) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 4;
} catch (NoSuchFieldError e7) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00332.f4x6a19ab39[bs.getValue(FaceAttachedHorizontalDirectionalBlock.FACE).ordinal()]) {
case 1:
return SHAPE_CEILING;
case 2:
switch (C00332.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return this.SHAPE_WALL_NORTH;
case 2:
return this.SHAPE_WALL_EAST;
case 3:
return this.SHAPE_WALL_WEST;
case 4:
return this.SHAPE_WALL_SOUTH;
}
case 3:
break;
default:
return SHAPE_CEILING;
}
return this.SHAPE_FLOOR;
}
}

View File

@ -1,162 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/LightSwitchBlock.class */
public class LightSwitchBlock extends Block {
protected static final VoxelShape SHAPE_SOUTH = Block.box(6.0d, 5.2d, 0.0d, 10.0d, 11.4d, 2.1d);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
public LightSwitchBlock() {
super(Properties.of(Material.METAL).sound(SoundType.METAL).strength(2.0f, 0.0f));
registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any().setValue(FACING, Direction.SOUTH)).setValue(POWERED, Boolean.FALSE));
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
if (p_196271_1_.getValue(FACING).getOpposite() == p_196271_2_ && !p_196271_1_.canSurvive(p_196271_4_, p_196271_5_)) {
return Blocks.AIR.defaultBlockState();
}
return super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos p_225533_3_, Player p_225533_4_, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
if (p_225533_2_.isClientSide) {
return InteractionResult.SUCCESS;
}
BlockState lvt_7_1_ = pull(p_225533_1_, p_225533_2_, p_225533_3_);
float lvt_8_1_ = ((Boolean) lvt_7_1_.getValue(POWERED)).booleanValue() ? 0.6f : 0.5f;
p_225533_2_.playSound((Player) null, p_225533_3_, SoundEvents.LEVER_CLICK, SoundSource.BLOCKS, 0.3f, lvt_8_1_);
return InteractionResult.CONSUME;
}
public BlockState pull(BlockState p_226939_1_, Level p_226939_2_, BlockPos p_226939_3_) {
BlockState p_226939_1_2 = (BlockState) p_226939_1_.m_61122_(POWERED);
p_226939_2_.setBlock(p_226939_3_, p_226939_1_2, 3);
updateNeighbours(p_226939_1_2, p_226939_2_, p_226939_3_);
return p_226939_1_2;
}
public void onRemove(BlockState p_196243_1_, Level p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_5_ && !p_196243_1_.is(p_196243_4_.getBlock())) {
if (((Boolean) p_196243_1_.getValue(POWERED)).booleanValue()) {
updateNeighbours(p_196243_1_, p_196243_2_, p_196243_3_);
}
super.onRemove(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
}
}
public int getSignal(BlockState p_180656_1_, BlockGetter p_180656_2_, BlockPos p_180656_3_, Direction p_180656_4_) {
return ((Boolean) p_180656_1_.getValue(POWERED)).booleanValue() ? 15 : 0;
}
public int getDirectSignal(BlockState p_176211_1_, BlockGetter p_176211_2_, BlockPos p_176211_3_, Direction p_176211_4_) {
return (((Boolean) p_176211_1_.getValue(POWERED)).booleanValue() && p_176211_1_.getValue(FACING) == p_176211_4_) ? 15 : 0;
}
private void updateNeighbours(BlockState p_196378_1_, Level p_196378_2_, BlockPos p_196378_3_) {
p_196378_2_.updateNeighborsAt(p_196378_3_, this);
p_196378_2_.updateNeighborsAt(p_196378_3_.relative(p_196378_1_.getValue(FACING).getOpposite()), this);
}
/* renamed from: com.dairymoose.modernlife.blocks.LightSwitchBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/LightSwitchBlock$1.class */
static /* synthetic */ class C00341 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00341.$SwitchMap$net$minecraft$core$Direction[bs.getValue(FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FACING, POWERED});
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
return FaceAttachedHorizontalDirectionalBlock.canAttach(p_196260_2_, p_196260_3_, p_196260_1_.getValue(FACING).getOpposite());
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
Direction[] var2 = context.getNearestLookingDirections();
for (Direction lvt_5_1_ : var2) {
if (lvt_5_1_.getAxis() != Direction.Axis.Y) {
BlockState lvt_6_2_ = (BlockState) defaultBlockState().setValue(FACING, lvt_5_1_.getOpposite());
if (lvt_6_2_.canSurvive(context.getLevel(), context.getClickedPos())) {
return lvt_6_2_;
}
}
}
return defaultBlockState();
}
}

View File

@ -1,61 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/MetalDuctBlock.class */
public class MetalDuctBlock extends Block {
protected static final VoxelShape SHAPE_Y = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(4.5d, 15.25d, 4.0d, 11.5d, 16.25d, 12.0d), Block.box(3.5d, 0.0d, 3.0d, 12.5d, 4.5d, 13.0d), Block.box(3.5d, 5.5d, 3.0d, 12.5d, 10.0d, 13.0d), Block.box(3.5d, 11.0d, 3.0d, 12.5d, 15.5d, 13.0d), Block.box(4.5d, 4.5d, 4.0d, 11.5d, 5.5d, 12.0d), Block.box(4.5d, 10.0d, 4.0d, 11.5d, 11.0d, 12.0d)}).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_Z = ModernLifeUtil.RotateVoxelShapeXAxis(SHAPE_Y);
protected static final VoxelShape SHAPE_X = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_Z);
public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS;
public MetalDuctBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
registerDefaultState((BlockState) this.stateDefinition.any().setValue(AXIS, Direction.Axis.Y));
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
if (bs.getValue(AXIS) == Direction.Axis.X) {
return SHAPE_X;
}
if (bs.getValue(AXIS) == Direction.Axis.Z) {
return SHAPE_Z;
}
return SHAPE_Y;
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{AXIS});
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
if (context.getClickedFace() == Direction.NORTH || context.getClickedFace() == Direction.SOUTH) {
return (BlockState) defaultBlockState().setValue(AXIS, Direction.Axis.Z);
}
if (context.getClickedFace() == Direction.EAST || context.getClickedFace() == Direction.WEST) {
return (BlockState) defaultBlockState().setValue(AXIS, Direction.Axis.X);
}
if (context.getClickedFace() == Direction.UP || context.getClickedFace() == Direction.DOWN) {
return (BlockState) defaultBlockState().setValue(AXIS, Direction.Axis.Y);
}
return defaultBlockState();
}
}

View File

@ -1,169 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.core.CustomBlocks;
import com.dairymoose.modernlife.tileentities.MicrowaveBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.Optional;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.SimpleContainer;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.item.crafting.CampfireCookingRecipe;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/MicrowaveBlock.class */
public class MicrowaveBlock extends StandardHorizontalBlock implements EntityBlock {
protected static final VoxelShape SHAPE_NORTH = (VoxelShape) Stream.of(Block.box(1.0d, 0.0d, 2.0d, 15.0d, 10.0d, 14.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
protected static final VoxelShape SHAPE_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
public static final BooleanProperty OPEN_DOOR = BooleanProperty.create("open_door");
public MicrowaveBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
registerDefaultState((BlockState) super.defaultBlockState().setValue(OPEN_DOOR, false));
}
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return ModernLifeUtil.createTickerHelper(type, MicrowaveBlockEntity.MICROWAVE, MicrowaveBlockEntity::tick);
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
MicrowaveBlockEntity toReturn = (MicrowaveBlockEntity) MicrowaveBlockEntity.MICROWAVE.create(pos, state);
return toReturn;
}
public void onRemove(BlockState newBlockState, Level world, BlockPos pos, BlockState oldBlockState, boolean b) {
if (!newBlockState.is(oldBlockState.getBlock())) {
BlockEntity tileEntity = world.getBlockEntity(pos);
if (tileEntity instanceof MicrowaveBlockEntity) {
Containers.dropContents(world, pos, (MicrowaveBlockEntity) tileEntity);
world.updateNeighbourForOutputSignal(pos, this);
}
super.onRemove(newBlockState, world, pos, oldBlockState, b);
}
}
public static int calculateTime(Optional<CampfireCookingRecipe> optionalCookingRecipe) {
if (optionalCookingRecipe.isPresent()) {
return optionalCookingRecipe.get().m_43753_() / 9;
}
return 0;
}
public InteractionResult use(BlockState blockState, Level world, BlockPos blockPos, Player player, InteractionHand hand, BlockHitResult rayTrace) {
if (!world.isClientSide) {
if (blockState.is(CustomBlocks.BLOCK_MICROWAVE.get()) && !((Boolean) blockState.getValue(OPEN_DOOR)).booleanValue()) {
world.setBlockAndUpdate(blockPos, (BlockState) blockState.setValue(OPEN_DOOR, true));
} else {
boolean tookItem = false;
ItemStack itemStack = player.getItemInHand(hand);
if (!itemStack.isEmpty()) {
Optional<CampfireCookingRecipe> optional = world.getRecipeManager().getRecipeFor(RecipeType.CAMPFIRE_COOKING, new SimpleContainer(new ItemStack[]{itemStack}), world);
if (optional.isPresent()) {
BlockEntity tileEntity = world.getBlockEntity(blockPos);
if (tileEntity instanceof MicrowaveBlockEntity) {
MicrowaveBlockEntity microwaveBlockEntity = (MicrowaveBlockEntity) tileEntity;
if (microwaveBlockEntity.isEmpty()) {
ItemStack oneItem = itemStack.split(1);
microwaveBlockEntity.cookItem(oneItem, calculateTime(optional));
}
microwaveBlockEntity.setChanged();
}
}
} else {
BlockEntity tileEntity2 = world.getBlockEntity(blockPos);
if (tileEntity2 instanceof MicrowaveBlockEntity) {
MicrowaveBlockEntity microwaveBlockEntity2 = (MicrowaveBlockEntity) tileEntity2;
if (!microwaveBlockEntity2.isEmpty() && player.isSteppingCarefully()) {
tookItem = true;
player.addItem(microwaveBlockEntity2.getItem(0).copy());
microwaveBlockEntity2.setItem(0, ItemStack.EMPTY);
}
microwaveBlockEntity2.setChanged();
}
}
if (!tookItem) {
world.setBlockAndUpdate(blockPos, (BlockState) blockState.setValue(OPEN_DOOR, false));
}
world.sendBlockUpdated(blockPos, blockState, blockState, 2);
}
}
return InteractionResult.CONSUME;
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{HorizontalDirectionalBlock.FACING, OPEN_DOOR});
}
/* renamed from: com.dairymoose.modernlife.blocks.MicrowaveBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/MicrowaveBlock$1.class */
static /* synthetic */ class C00351 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00351.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState) defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, context.getHorizontalDirection());
}
}

View File

@ -1,90 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.entity.DummyEntity;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/MiniStoolBlock.class */
public class MiniStoolBlock extends Block {
protected static final VoxelShape SHAPE_NORMAL = (VoxelShape) Stream.of(Block.box(2.0d, 0.0d, 2.0d, 14.0d, 9.0d, 14.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_EXTENDED = (VoxelShape) Stream.of(Block.box(2.0d, 0.0d, 2.0d, 14.0d, 16.0d, 14.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
public static final BooleanProperty EXTENDED = BlockStateProperties.EXTENDED;
public MiniStoolBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
registerDefaultState((BlockState) defaultBlockState().setValue(EXTENDED, false));
}
public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 20;
}
return 0;
}
public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 5;
}
return 0;
}
public BlockState updateShape(BlockState state, Direction dir, BlockState updater, LevelAccessor world, BlockPos pos, BlockPos updaterPos) {
if (!world.getBlockState(pos.above()).isAir()) {
return (BlockState) defaultBlockState().setValue(EXTENDED, true);
}
return defaultBlockState();
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{EXTENDED});
}
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos p_225533_3_, Player player, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
if (!p_225533_2_.isClientSide) {
DummyEntity dummy = DummyEntity.getEntity(0.4f, p_225533_2_, p_225533_3_, false);
dummy.ride(player);
}
return InteractionResult.CONSUME;
}
@Nullable
public BlockState getStateForPlacement(BlockPlaceContext context) {
if (!context.getLevel().getBlockState(context.getClickedPos().above()).isAir()) {
return (BlockState) defaultBlockState().setValue(EXTENDED, true);
}
return defaultBlockState();
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
if (((Boolean) bs.getValue(EXTENDED)).booleanValue()) {
return SHAPE_EXTENDED;
}
return SHAPE_NORMAL;
}
}

View File

@ -1,150 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.core.CustomBlocks;
import com.dairymoose.modernlife.tileentities.MirrorBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/MirrorBlock.class */
public class MirrorBlock extends Block implements EntityBlock {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of(Block.box(0.0d, 0.0d, 0.0d, 16.0d, 16.0d, 1.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public MirrorBlock(Properties p_i48440_1_) {
super(p_i48440_1_);
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos p_225533_3_, Player p_225533_4_, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
if (p_225533_1_.is(CustomBlocks.BLOCK_CCTV_SCREEN.get())) {
BlockEntity tileEntity = p_225533_2_.getBlockEntity(p_225533_3_);
if (tileEntity instanceof MirrorBlockEntity) {
MirrorBlockEntity mirrorBlockEntity = (MirrorBlockEntity) tileEntity;
if (p_225533_4_.isSteppingCarefully()) {
mirrorBlockEntity.cctvScreenCurrentCamera--;
} else {
mirrorBlockEntity.cctvScreenCurrentCamera++;
}
if (!p_225533_2_.isClientSide) {
((ServerLevel) p_225533_2_).sendBlockUpdated(p_225533_3_, p_225533_1_, p_225533_1_, 2);
mirrorBlockEntity.setChanged();
}
}
}
return InteractionResult.CONSUME;
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
return FaceAttachedHorizontalDirectionalBlock.canAttach(p_196260_2_, p_196260_3_, p_196260_1_.getValue(FACING).getOpposite());
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
Direction[] var2 = context.getNearestLookingDirections();
for (Direction lvt_5_1_ : var2) {
if (lvt_5_1_.getAxis() != Direction.Axis.Y) {
BlockState lvt_6_2_ = (BlockState) defaultBlockState().setValue(FACING, lvt_5_1_.getOpposite());
if (lvt_6_2_.canSurvive(context.getLevel(), context.getClickedPos())) {
return lvt_6_2_;
}
}
}
return defaultBlockState();
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
if (p_196271_1_.getValue(FACING).getOpposite() == p_196271_2_ && !p_196271_1_.canSurvive(p_196271_4_, p_196271_5_)) {
return Blocks.AIR.defaultBlockState();
}
return super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
/* renamed from: com.dairymoose.modernlife.blocks.MirrorBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/MirrorBlock$1.class */
static /* synthetic */ class C00361 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00361.$SwitchMap$net$minecraft$core$Direction[bs.getValue(FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FACING});
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
MirrorBlockEntity toReturn = (MirrorBlockEntity) MirrorBlockEntity.MIRROR.create(pos, state);
return toReturn;
}
}

View File

@ -1,312 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.core.CsvSourcedHashSet;
import com.dairymoose.modernlife.core.ModernLifeCommon;
import com.dairymoose.modernlife.core.ModernLifeConfig;
import com.dairymoose.modernlife.tileentities.ModernBookshelfBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/ModernBookshelfBlock.class */
public class ModernBookshelfBlock extends Block implements EntityBlock {
public static CsvSourcedHashSet whitelist;
public static CsvSourcedHashSet blacklist;
public static CsvSourcedHashSet textToSearch;
public static CsvSourcedHashSet textToAvoid;
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of(Block.box(0.0d, 0.0d, 0.0d, 16.0d, 16.0d, 9.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public static long usedBookTimestamp = 0;
public static int oldItemSlot = -1;
public static BlockPos lastBlockPos = null;
public static ItemStack clientAwaitingBook = null;
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public ModernBookshelfBlock(Properties props) {
super(props);
registerDefaultState((BlockState) this.stateDefinition.any().setValue(FACING, Direction.SOUTH));
if (whitelist == null) {
whitelist = new CsvSourcedHashSet((String) ModernLifeConfig.COMMON.bookshelfWhitelist.get());
}
if (blacklist == null) {
blacklist = new CsvSourcedHashSet((String) ModernLifeConfig.COMMON.bookshelfBlacklist.get());
}
if (textToSearch == null) {
textToSearch = new CsvSourcedHashSet((String) ModernLifeConfig.COMMON.bookshelfSearchText.get());
}
if (textToAvoid == null) {
textToAvoid = new CsvSourcedHashSet((String) ModernLifeConfig.COMMON.bookshelfAvoidText.get());
}
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 20;
}
return 0;
}
public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 5;
}
return 0;
}
public float getEnchantPowerBonus(BlockState state, LevelReader world, BlockPos pos) {
return 2.0f;
}
private boolean textToSearchHasMatch(String toSearch) {
Iterator<String> it = textToSearch.iterator();
while (it.hasNext()) {
String s = it.next();
if (toSearch.contains(s)) {
return true;
}
}
return false;
}
private boolean textToAvoidHasMatch(String toSearch) {
Iterator<String> it = textToAvoid.iterator();
while (it.hasNext()) {
String s = it.next();
if (toSearch.contains(s)) {
return true;
}
}
return false;
}
private void getBookFromSlot(Player player, ModernBookshelfBlockEntity modernBookshelfBlockEntity, int slot) {
player.addItem(modernBookshelfBlockEntity.getItem(slot).copy());
modernBookshelfBlockEntity.setItem(slot, ItemStack.EMPTY);
modernBookshelfBlockEntity.setChanged();
}
public InteractionResult use(BlockState blockState, Level world, BlockPos blockPos, Player player, InteractionHand hand, BlockHitResult rayTrace) {
int slot;
ItemStack itemStack = player.getItemInHand(hand);
BlockEntity tileEntity = world.getBlockEntity(blockPos);
ModernBookshelfBlockEntity modernBookshelfBlockEntity = null;
if (tileEntity instanceof ModernBookshelfBlockEntity) {
modernBookshelfBlockEntity = (ModernBookshelfBlockEntity) tileEntity;
}
boolean tookItem = false;
boolean placedItem = false;
if (modernBookshelfBlockEntity != null) {
if (!player.isSteppingCarefully() && !itemStack.isEmpty()) {
String displayName = itemStack.getDisplayName().getString().toLowerCase();
String registryNamespace = itemStack.getItem().getRegistryName().getNamespace();
String registryPath = itemStack.getItem().getRegistryName().getPath();
String registryPathLowercase = registryPath.toLowerCase();
String fullRegistryText = registryNamespace + ":" + registryPath;
boolean itemIsWhitelisted = false;
boolean itemIsBlacklisted = false;
if (blacklist.contains(fullRegistryText)) {
itemIsBlacklisted = true;
}
if (whitelist.contains(fullRegistryText)) {
itemIsWhitelisted = true;
}
if (!modernBookshelfBlockEntity.isFull()) {
if (itemIsBlacklisted) {
placedItem = false;
} else {
boolean itemMatchesSearchCondition = ((!textToSearchHasMatch(displayName) && !textToSearchHasMatch(registryPathLowercase)) || textToAvoidHasMatch(displayName) || textToAvoidHasMatch(registryPathLowercase)) ? false : true;
if (itemIsWhitelisted || itemMatchesSearchCondition) {
placedItem = true;
}
if (placedItem && !world.isClientSide) {
ItemStack oneItem = itemStack.split(1);
modernBookshelfBlockEntity.placeItem(oneItem);
placedItem = true;
modernBookshelfBlockEntity.setChanged();
}
}
}
} else if (player.isSteppingCarefully() && !modernBookshelfBlockEntity.isEmpty()) {
tookItem = true;
int hitIndex = modernBookshelfBlockEntity.getHitIndex(player, rayTrace);
if (hitIndex != -1) {
getBookFromSlot(player, modernBookshelfBlockEntity, hitIndex);
} else if (!world.isClientSide && (slot = modernBookshelfBlockEntity.getNextOccupiedSlot()) != -1) {
getBookFromSlot(player, modernBookshelfBlockEntity, slot);
}
}
if (!placedItem && !tookItem && rayTrace != null) {
oldItemSlot = -1;
int hitIndex2 = modernBookshelfBlockEntity.getHitIndex(player, rayTrace);
if (hitIndex2 != -1) {
ItemStack pickedBook = modernBookshelfBlockEntity.getItem(hitIndex2);
if (!pickedBook.isEmpty()) {
ItemStack originalItem = player.getItemInHand(hand);
int freeSlot = player.getInventory().getFreeSlot();
if (freeSlot != -1) {
usedBookTimestamp = System.currentTimeMillis();
modernBookshelfBlockEntity.setItem(hitIndex2, ItemStack.EMPTY);
modernBookshelfBlockEntity.bookNames.set(hitIndex2, "");
oldItemSlot = freeSlot;
lastBlockPos = blockPos;
if (!world.isClientSide) {
player.setItemInHand(hand, pickedBook);
player.addItem(originalItem);
try {
pickedBook.use(world, player, hand);
} catch (Exception e) {
ModernLifeCommon.LOGGER.error("Use book error", e);
}
} else {
clientAwaitingBook = pickedBook;
}
}
}
}
}
}
if (!world.isClientSide) {
world.sendBlockUpdated(blockPos, blockState, blockState, 2);
}
return InteractionResult.CONSUME;
}
public void onRemove(BlockState p_196243_1_, Level p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_1_.is(p_196243_4_.getBlock())) {
BlockEntity lvt_6_1_ = p_196243_2_.getBlockEntity(p_196243_3_);
if (lvt_6_1_ instanceof ModernBookshelfBlockEntity) {
Containers.dropContents(p_196243_2_, p_196243_3_, (ModernBookshelfBlockEntity) lvt_6_1_);
p_196243_2_.updateNeighbourForOutputSignal(p_196243_3_, this);
}
super.onRemove(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
}
}
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Right click to place a book on the shelf"));
list.add(new TextComponent("Shift-right-click with an empty hand to remove a book"));
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
if (p_196271_1_.getValue(FACING).getOpposite() == p_196271_2_ && !p_196271_1_.canSurvive(p_196271_4_, p_196271_5_)) {
return Blocks.AIR.defaultBlockState();
}
return super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
/* renamed from: com.dairymoose.modernlife.blocks.ModernBookshelfBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/ModernBookshelfBlock$1.class */
static /* synthetic */ class C00371 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00371.$SwitchMap$net$minecraft$core$Direction[bs.getValue(FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
ModernBookshelfBlockEntity toReturn = (ModernBookshelfBlockEntity) ModernBookshelfBlockEntity.MODERN_BOOKSHELF.create(pos, state);
return toReturn;
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FACING});
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
return FaceAttachedHorizontalDirectionalBlock.canAttach(p_196260_2_, p_196260_3_, p_196260_1_.getValue(FACING).getOpposite());
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
Direction[] var2 = context.getNearestLookingDirections();
for (Direction lvt_5_1_ : var2) {
if (lvt_5_1_.getAxis() != Direction.Axis.Y) {
BlockState lvt_6_2_ = (BlockState) defaultBlockState().setValue(FACING, lvt_5_1_.getOpposite());
if (lvt_6_2_.canSurvive(context.getLevel(), context.getClickedPos())) {
return lvt_6_2_;
}
}
}
return defaultBlockState();
}
}

View File

@ -1,74 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/MonitorBlock.class */
public class MonitorBlock extends StandardHorizontalBlock {
protected static final VoxelShape SHAPE_NORTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(6.0d, 0.0d, 6.375d, 10.0d, 1.85d, 9.55d), Block.box(-0.175d, 1.575d, 7.5d, 16.275d, 11.675d, 8.5d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
protected static final VoxelShape SHAPE_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
public MonitorBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState) defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, context.getHorizontalDirection().getOpposite());
}
/* renamed from: com.dairymoose.modernlife.blocks.MonitorBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/MonitorBlock$1.class */
static /* synthetic */ class C00381 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00381.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,159 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/MusicStandBlock.class */
public class MusicStandBlock extends Block {
protected static final VoxelShape SHAPE_NORTH = Block.box(3.0d, 0.0d, 11.0d, 13.0d, 16.0d, 16.0d);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
protected static final VoxelShape SHAPE_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
public static final EnumProperty<DoubleBlockHalf> HALF = BlockStateProperties.DOUBLE_BLOCK_HALF;
public MusicStandBlock(Properties p_i48413_1_) {
super(p_i48413_1_);
registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any().setValue(FACING, Direction.NORTH)).setValue(HALF, DoubleBlockHalf.LOWER));
}
public VoxelShape getShape(BlockState p_220053_1_, BlockGetter p_220053_2_, BlockPos p_220053_3_, CollisionContext p_220053_4_) {
Direction lvt_5_1_ = p_220053_1_.getValue(FACING);
switch (C00391.$SwitchMap$net$minecraft$core$Direction[lvt_5_1_.ordinal()]) {
case 1:
default:
return SHAPE_SOUTH;
case 2:
return SHAPE_EAST;
case 3:
return SHAPE_WEST;
case 4:
return SHAPE_NORTH;
}
}
/* renamed from: com.dairymoose.modernlife.blocks.MusicStandBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/MusicStandBlock$1.class */
static /* synthetic */ class C00391 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
Comparable comparable = (DoubleBlockHalf) p_196271_1_.getValue(HALF);
if (p_196271_2_.getAxis() == Direction.Axis.Y) {
if ((comparable == DoubleBlockHalf.LOWER) == (p_196271_2_ == Direction.UP)) {
return (!p_196271_3_.is(this) || p_196271_3_.getValue(HALF) == comparable) ? Blocks.AIR.defaultBlockState() : (BlockState) p_196271_1_.setValue(FACING, p_196271_3_.getValue(FACING));
}
}
return (comparable == DoubleBlockHalf.LOWER && p_196271_2_ == Direction.DOWN && !p_196271_1_.canSurvive(p_196271_4_, p_196271_5_)) ? Blocks.AIR.defaultBlockState() : super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
protected static void preventCreativeDropFromBottomPart(Level p_241471_0_, BlockPos p_241471_1_, BlockState p_241471_2_, Player p_241471_3_) {
DoubleBlockHalf doubleblockhalf = p_241471_2_.getValue(HALF);
if (doubleblockhalf == DoubleBlockHalf.UPPER) {
BlockPos blockpos = p_241471_1_.below();
BlockState blockstate = p_241471_0_.getBlockState(blockpos);
if (blockstate.getBlock() == p_241471_2_.getBlock() && blockstate.getValue(HALF) == DoubleBlockHalf.LOWER) {
p_241471_0_.setBlock(blockpos, Blocks.AIR.defaultBlockState(), 35);
p_241471_0_.levelEvent(p_241471_3_, 2001, blockpos, Block.getId(blockstate));
}
}
}
public void playerWillDestroy(Level p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, Player p_176208_4_) {
if (!p_176208_1_.isClientSide && p_176208_4_.isCreative()) {
preventCreativeDropFromBottomPart(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
super.playerWillDestroy(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
public BlockState rotate(BlockState p_52790_, Rotation p_52791_) {
return (BlockState) p_52790_.setValue(FACING, p_52791_.rotate(p_52790_.getValue(FACING)));
}
public BlockState mirror(BlockState p_52787_, Mirror p_52788_) {
return p_52788_ == Mirror.NONE ? p_52787_ : p_52787_.rotate(p_52788_.getRotation(p_52787_.getValue(FACING)));
}
@Nullable
public BlockState getStateForPlacement(BlockPlaceContext p_196258_1_) {
BlockPos lvt_2_1_ = p_196258_1_.getClickedPos();
if (lvt_2_1_.getY() < p_196258_1_.getLevel().getMaxBuildHeight() && p_196258_1_.getLevel().getBlockState(lvt_2_1_.above()).canBeReplaced(p_196258_1_)) {
Level lvt_3_1_ = p_196258_1_.getLevel();
boolean z = lvt_3_1_.hasNeighborSignal(lvt_2_1_) || lvt_3_1_.hasNeighborSignal(lvt_2_1_.above());
return (BlockState) ((BlockState) defaultBlockState().setValue(FACING, p_196258_1_.getHorizontalDirection().getOpposite())).setValue(HALF, DoubleBlockHalf.LOWER);
}
return null;
}
public void setPlacedBy(Level p_180633_1_, BlockPos p_180633_2_, BlockState p_180633_3_, LivingEntity p_180633_4_, ItemStack p_180633_5_) {
p_180633_1_.setBlock(p_180633_2_.above(), (BlockState) p_180633_3_.setValue(HALF, DoubleBlockHalf.UPPER), 3);
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
BlockPos lvt_4_1_ = p_196260_3_.below();
BlockState lvt_5_1_ = p_196260_2_.getBlockState(lvt_4_1_);
return p_196260_1_.getValue(HALF) == DoubleBlockHalf.LOWER ? lvt_5_1_.isFaceSturdy(p_196260_2_, lvt_4_1_, Direction.UP) : lvt_5_1_.is(this);
}
public PushReaction getPistonPushReaction(BlockState p_149656_1_) {
return PushReaction.DESTROY;
}
@OnlyIn(Dist.CLIENT)
public long getSeed(BlockState p_209900_1_, BlockPos p_209900_2_) {
return Mth.getSeed(p_209900_2_.getX(), p_209900_2_.below(p_209900_1_.getValue(HALF) == DoubleBlockHalf.LOWER ? 0 : 1).getY(), p_209900_2_.getZ());
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_206840_1_) {
p_206840_1_.add(new Property[]{HALF, FACING});
}
}

View File

@ -1,187 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.tileentities.NightStandBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.List;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.ChestMenu;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/NightStandBlock.class */
public class NightStandBlock extends Block implements EntityBlock {
protected String containerDisplayLabel;
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(0.0d, 2.0d, 0.0d, 16.0d, 16.0d, 14.0d), Block.box(5.0d, 11.6d, 15.0d, 11.0d, 12.6d, 16.0d), Block.box(15.0d, 0.0d, 0.0d, 16.0d, 2.0d, 1.0d), Block.box(0.0d, 0.0d, 13.0d, 1.0d, 2.0d, 14.0d), Block.box(0.0d, 0.0d, 0.0d, 1.0d, 2.0d, 1.0d), Block.box(15.0d, 0.0d, 13.0d, 16.0d, 2.0d, 14.0d), Block.box(5.0d, 5.475d, 14.0d, 6.0d, 6.475d, 15.0d), Block.box(5.0d, 5.475d, 15.0d, 11.0d, 6.475d, 16.0d), Block.box(10.0d, 5.475d, 14.0d, 11.0d, 6.475d, 15.0d), Block.box(5.0d, 11.6d, 14.0d, 6.0d, 12.6d, 15.0d), Block.box(10.0d, 11.6d, 14.0d, 11.0d, 12.6d, 15.0d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Stores up to 18 items"));
}
public NightStandBlock() {
super(Properties.of(Material.WOOD).sound(SoundType.WOOD).strength(1.5f));
this.containerDisplayLabel = "Night Stand";
registerDefaultState((BlockState) this.stateDefinition.any().setValue(FACING, Direction.SOUTH));
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 20;
}
return 0;
}
public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 5;
}
return 0;
}
public NightStandBlock(Properties props) {
super(props);
this.containerDisplayLabel = "Night Stand";
registerDefaultState((BlockState) this.stateDefinition.any().setValue(FACING, Direction.SOUTH));
}
public void onRemove(BlockState p_196243_1_, Level p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_1_.is(p_196243_4_.getBlock())) {
BlockEntity lvt_6_1_ = p_196243_2_.getBlockEntity(p_196243_3_);
if (lvt_6_1_ instanceof NightStandBlockEntity) {
Containers.dropContents(p_196243_2_, p_196243_3_, (NightStandBlockEntity) lvt_6_1_);
p_196243_2_.updateNeighbourForOutputSignal(p_196243_3_, this);
}
super.onRemove(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
}
}
public MenuProvider getMenuProvider(BlockState p_220052_1_, final Level p_220052_2_, final BlockPos p_220052_3_) {
return new MenuProvider() { // from class: com.dairymoose.modernlife.blocks.NightStandBlock.1
/* renamed from: createMenu */
public AbstractContainerMenu createMenu(int paramInt, Inventory paramInventory, Player paramPlayer) {
BlockEntity tileEntity = p_220052_2_.getBlockEntity(p_220052_3_);
if (tileEntity instanceof NightStandBlockEntity) {
NightStandBlockEntity nightStandBlockEntity = (NightStandBlockEntity) tileEntity;
return new ChestMenu(MenuType.GENERIC_9x2, paramInt, paramInventory, nightStandBlockEntity, 2);
}
return null;
}
public Component getDisplayName() {
return new TextComponent(NightStandBlock.this.containerDisplayLabel);
}
};
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
NightStandBlockEntity toReturn = (NightStandBlockEntity) NightStandBlockEntity.NIGHT_STAND.create(pos, state);
return toReturn;
}
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos p_225533_3_, Player p_225533_4_, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
MenuProvider lvt_7_1_ = getMenuProvider(p_225533_1_, p_225533_2_, p_225533_3_);
if (lvt_7_1_ != null) {
p_225533_4_.openMenu(lvt_7_1_);
}
return InteractionResult.CONSUME;
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FACING});
}
/* renamed from: com.dairymoose.modernlife.blocks.NightStandBlock$2 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/NightStandBlock$2.class */
static /* synthetic */ class C00412 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00412.$SwitchMap$net$minecraft$core$Direction[bs.getValue(FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
context.getLevel().getFluidState(context.getClickedPos());
return (BlockState) defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite());
}
}

View File

@ -1,49 +0,0 @@
package com.dairymoose.modernlife.blocks;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/OakPostBlock.class */
public class OakPostBlock extends Block {
protected static final VoxelShape SHAPE = Block.box(6.0d, 0.0d, 6.0d, 10.0d, 10.0d, 10.0d);
public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS;
public OakPostBlock() {
super(Properties.of(Material.WOOD).sound(SoundType.WOOD));
registerDefaultState((BlockState) this.stateDefinition.any().setValue(AXIS, Direction.Axis.Y));
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{AXIS});
}
public VoxelShape getShape(BlockState p_220053_1_, BlockGetter p_220053_2_, BlockPos p_220053_3_, CollisionContext p_220053_4_) {
return SHAPE;
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
if (context.getClickedFace() == Direction.NORTH || context.getClickedFace() == Direction.SOUTH) {
return (BlockState) defaultBlockState().setValue(AXIS, Direction.Axis.Z);
}
if (context.getClickedFace() == Direction.EAST || context.getClickedFace() == Direction.WEST) {
return (BlockState) defaultBlockState().setValue(AXIS, Direction.Axis.X);
}
if (context.getClickedFace() == Direction.UP || context.getClickedFace() == Direction.DOWN) {
return (BlockState) defaultBlockState().setValue(AXIS, Direction.Axis.Y);
}
return defaultBlockState();
}
}

View File

@ -1,54 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.entity.BicycleEntity;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/PavedRoadBlock.class */
public class PavedRoadBlock extends Block {
public PavedRoadBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Slightly increases movement speed of vehicles"));
}
public static void steppedOn(Entity entity) {
if (entity.getVehicle() != null || entity.isVehicle()) {
float fallDist = entity.fallDistance;
if (entity.isVehicle()) {
Vec3 mov = entity.getDeltaMovement();
if (entity instanceof BicycleEntity) {
} else {
double velocity = Math.sqrt((mov.x * mov.x) + (mov.z * mov.z));
double newVelocity = velocity * 1.1d;
double angle = Math.atan2(mov.z, mov.x);
double newX = newVelocity * Math.cos(angle);
double newZ = newVelocity * Math.sin(angle);
entity.setDeltaMovement(newX, mov.y, newZ);
}
}
entity.fallDistance = fallDist;
}
}
public void stepOn(Level p_176199_1_, BlockPos p_176199_2_, BlockState state, Entity entity) {
steppedOn(entity);
}
}

View File

@ -1,157 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.blocks.gui.PhotocopierScreen;
import com.dairymoose.modernlife.core.CustomBlocks;
import com.dairymoose.modernlife.tileentities.PhotocopierBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.List;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.ChestMenu;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/PhotocopierBlock.class */
public class PhotocopierBlock extends StandardHorizontalBlock implements EntityBlock {
protected static final VoxelShape SHAPE_NORTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(1.75d, 14.275d, 1.0d, 4.5d, 14.275d, 2.5d), Block.box(0.0d, 1.0d, 1.0d, 16.0d, 2.0d, 16.0d), Block.box(0.0d, 2.0d, 0.0d, 16.0d, 3.0d, 16.0d), Block.box(0.0d, 3.0d, 1.0d, 16.0d, 4.0d, 16.0d), Block.box(0.0d, 4.0d, 0.0d, 16.0d, 5.0d, 16.0d), Block.box(0.0d, 5.0d, 1.0d, 16.0d, 6.0d, 16.0d), Block.box(0.0d, 6.0d, 0.0d, 16.0d, 7.0d, 16.0d), Block.box(0.0d, 7.0d, 1.0d, 16.0d, 8.0d, 16.0d), Block.box(0.0d, 8.0d, 14.0d, 16.0d, 10.0d, 16.0d), Block.box(0.0d, 8.0d, 0.0d, 16.0d, 9.0d, 3.0d), Block.box(0.0d, 9.0d, 1.0d, 16.0d, 10.0d, 3.0d), Block.box(0.0d, 10.0d, 0.0d, 16.0d, 14.0d, 16.0d), Block.box(0.0d, 14.25d, 3.0d, 16.0d, 15.5d, 16.0d), Block.box(0.0d, 14.0d, 14.25d, 16.0d, 14.25d, 16.0d), Block.box(10.0d, 15.5d, 3.0d, 16.0d, 16.0d, 16.0d), Block.box(0.0d, 0.0d, 1.0d, 1.0d, 1.0d, 2.0d), Block.box(0.0d, 0.0d, 15.0d, 1.0d, 1.0d, 16.0d), Block.box(15.0d, 0.0d, 1.0d, 16.0d, 1.0d, 2.0d), Block.box(15.0d, 0.0d, 15.0d, 16.0d, 1.0d, 16.0d), Block.box(-1.5d, 9.0d, 3.0d, 3.5d, 9.5d, 14.0d), Block.box(10.25d, 8.0d, 3.0d, 17.25d, 8.5d, 14.0d), Block.box(5.0d, 14.0d, 0.25d, 7.0d, 14.25d, 2.75d), Block.box(5.6d, 14.25d, 2.0d, 6.35d, 14.5d, 2.25d), Block.box(0.5999999999999996d, 14.25d, 0.75d, 1.3499999999999996d, 14.5d, 1.0d), Block.box(0.5999999999999996d, 14.25d, 1.25d, 1.3499999999999996d, 14.5d, 1.5d), Block.box(5.6d, 14.25d, 1.5d, 6.35d, 14.5d, 1.75d), Block.box(0.25d, 14.0d, 0.25d, 5.0d, 14.25d, 2.75d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
protected static final VoxelShape SHAPE_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
public PhotocopierBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
public void onRemove(BlockState p_196243_1_, Level p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_1_.is(p_196243_4_.getBlock())) {
BlockEntity lvt_6_1_ = p_196243_2_.getBlockEntity(p_196243_3_);
if (lvt_6_1_ instanceof PhotocopierBlockEntity) {
Containers.dropContents(p_196243_2_, p_196243_3_, (PhotocopierBlockEntity) lvt_6_1_);
p_196243_2_.updateNeighbourForOutputSignal(p_196243_3_, this);
}
super.onRemove(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
}
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
PhotocopierBlockEntity toReturn = (PhotocopierBlockEntity) PhotocopierBlockEntity.PHOTOCOPIER.create(pos, state);
return toReturn;
}
public MenuProvider getMenuProvider(BlockState p_220052_1_, Level p_220052_2_, BlockPos p_220052_3_) {
return new MenuProvider() { // from class: com.dairymoose.modernlife.blocks.PhotocopierBlock.1
public AbstractContainerMenu createMenu(int paramInt, Inventory paramInventory, Player paramPlayer) {
BlockEntity tileEntity = p_220052_2_.getBlockEntity(p_220052_3_);
if (tileEntity instanceof PhotocopierBlockEntity) {
PhotocopierBlockEntity photocopierBlockEntity = (PhotocopierBlockEntity) tileEntity;
return new ChestMenu(MenuType.GENERIC_9x3, paramInt, paramInventory, photocopierBlockEntity, 3);
}
return null;
}
public Component getDisplayName() {
return new TextComponent("Photocopier");
}
};
}
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Interact with a canvas or photograph to make copies"));
list.add(new TextComponent(" * Requires paper"));
}
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return ModernLifeUtil.createTickerHelper(type, PhotocopierBlockEntity.PHOTOCOPIER, PhotocopierBlockEntity::tick);
}
public InteractionResult use(BlockState blockState, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult rayTrace) {
MenuProvider lvt_7_1_;
ItemStack itemStack = player.getMainHandItem();
if (itemStack.getItem() == CustomBlocks.ITEM_CANVAS.get()) {
if (world.isClientSide) {
DistExecutor.runWhenOn(Dist.CLIENT, () -> {
return new Runnable() { // from class: com.dairymoose.modernlife.blocks.PhotocopierBlock.2
@Override // java.lang.Runnable
public void run() {
Minecraft.getInstance().setScreen(new PhotocopierScreen(pos));
}
};
});
}
} else if (!world.isClientSide && (lvt_7_1_ = getMenuProvider(blockState, world, pos)) != null) {
player.openMenu(lvt_7_1_);
}
return InteractionResult.CONSUME;
}
/* renamed from: com.dairymoose.modernlife.blocks.PhotocopierBlock$3 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/PhotocopierBlock$3.class */
static /* synthetic */ class C00443 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00443.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,104 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.core.ModernLifeCommon;
import com.dairymoose.modernlife.core.ModernLifeConfig;
import com.dairymoose.modernlife.tileentities.PhotonBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.LiquidBlockContainer;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/PhotonBlock.class */
public class PhotonBlock extends Block implements EntityBlock, LiquidBlockContainer {
public static final BooleanProperty EXTINGUISHED = BooleanProperty.create("extinguished");
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
public PhotonBlock(Properties props) {
super(props.lightLevel(PhotonBlock::getLightLevel).noCollission().air());
registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any().setValue(EXTINGUISHED, false)).setValue(WATERLOGGED, false));
}
public FluidState getFluidState(BlockState state) {
if (((Boolean) state.getValue(WATERLOGGED)).booleanValue()) {
return Fluids.WATER.getSource(false);
}
return super.getFluidState(state);
}
public boolean canPlaceLiquid(BlockGetter p_56301_, BlockPos p_56302_, BlockState p_56303_, Fluid p_56304_) {
return false;
}
public boolean placeLiquid(LevelAccessor p_56306_, BlockPos p_56307_, BlockState p_56308_, FluidState p_56309_) {
return false;
}
protected boolean isAir(BlockState state) {
if (((Boolean) state.getValue(WATERLOGGED)).booleanValue()) {
return false;
}
return true;
}
public boolean canBeReplaced(BlockState p_60470_, BlockPlaceContext p_60471_) {
return true;
}
public boolean canBeReplaced(BlockState p_60535_, Fluid p_60536_) {
return true;
}
public static int getLightLevel(BlockState state) {
if (((Boolean) state.getValue(EXTINGUISHED)).booleanValue()) {
return 0;
}
int lightLevel = 13;
Integer configLight = ModernLifeConfig.COMMON.flashlightLightLevel.getValue();
if (configLight != null) {
lightLevel = configLight.intValue();
}
ModernLifeCommon.LOGGER.debug("flashlight light level = " + lightLevel);
return lightLevel;
}
public RenderShape getRenderShape(BlockState p_149645_1_) {
return RenderShape.INVISIBLE;
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{EXTINGUISHED, WATERLOGGED});
}
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return ModernLifeUtil.createTickerHelper(type, PhotonBlockEntity.PHOTON, PhotonBlockEntity::tick);
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return PhotonBlockEntity.PHOTON.create(pos, state);
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
return Shapes.empty();
}
}

View File

@ -1,175 +0,0 @@
package com.dairymoose.modernlife.blocks;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.Mth;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/PicnicTableBlock.class */
public class PicnicTableBlock extends Block {
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
public static final EnumProperty<BenchHalf> HALF = EnumProperty.create("half", BenchHalf.class);
protected static final VoxelShape SOUTH_AABB = Block.box(0.01d, 0.0d, 0.01d, 15.99d, 16.0d, 15.99d);
protected static final VoxelShape NORTH_AABB = Block.box(0.01d, 0.0d, 0.01d, 15.99d, 16.0d, 15.99d);
protected static final VoxelShape WEST_AABB = Block.box(0.01d, 0.0d, 0.01d, 15.99d, 16.0d, 15.99d);
protected static final VoxelShape EAST_AABB = Block.box(0.01d, 0.0d, 0.01d, 15.99d, 16.0d, 15.99d);
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/PicnicTableBlock$BenchHalf.class */
public enum BenchHalf implements StringRepresentable {
back,
front;
public String getSerializedName() {
return name().toLowerCase();
}
}
public PicnicTableBlock(Properties p_i48413_1_) {
super(p_i48413_1_);
registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any().setValue(FACING, Direction.NORTH)).setValue(HALF, BenchHalf.back));
}
public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 20;
}
return 0;
}
public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 5;
}
return 0;
}
public VoxelShape getShape(BlockState p_220053_1_, BlockGetter p_220053_2_, BlockPos p_220053_3_, CollisionContext p_220053_4_) {
Direction lvt_5_1_ = p_220053_1_.getValue(FACING);
switch (lvt_5_1_.ordinal()) {
case 1:
default:
return EAST_AABB;
case 2:
return SOUTH_AABB;
case 3:
return WEST_AABB;
case 4:
return NORTH_AABB;
}
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
Direction checkDir;
BenchHalf lvt_7_1_ = (BenchHalf) p_196271_1_.getValue(HALF);
if (p_196271_1_.getValue(FACING) == Direction.EAST) {
checkDir = Direction.WEST;
} else if (p_196271_1_.getValue(FACING) == Direction.WEST) {
checkDir = Direction.EAST;
} else if (p_196271_1_.getValue(FACING) == Direction.NORTH) {
checkDir = Direction.SOUTH;
} else {
checkDir = Direction.NORTH;
}
if (lvt_7_1_ == BenchHalf.back && p_196271_5_.relative(checkDir).equals(p_196271_6_) && !p_196271_3_.is(this)) {
return Blocks.AIR.defaultBlockState();
}
if (lvt_7_1_ == BenchHalf.front && p_196271_5_.relative(checkDir.getOpposite()).equals(p_196271_6_) && !p_196271_3_.is(this)) {
return Blocks.AIR.defaultBlockState();
}
return super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
protected static void preventCreativeDropFromBottomPart(Level p_241471_0_, BlockPos p_241471_1_, BlockState p_241471_2_, Player p_241471_3_) {
BenchHalf BenchHalf2 = (BenchHalf) p_241471_2_.getValue(HALF);
if (BenchHalf2 == BenchHalf.front) {
BlockPos blockpos = p_241471_1_.below();
BlockState blockstate = p_241471_0_.getBlockState(blockpos);
if (blockstate.getBlock() == p_241471_2_.getBlock() && blockstate.getValue(HALF) == BenchHalf.back) {
p_241471_0_.setBlock(blockpos, Blocks.AIR.defaultBlockState(), 35);
p_241471_0_.levelEvent(p_241471_3_, 2001, blockpos, Block.getId(blockstate));
}
}
}
public void playerWillDestroy(Level p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, Player p_176208_4_) {
if (!p_176208_1_.isClientSide && p_176208_4_.isCreative()) {
preventCreativeDropFromBottomPart(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
super.playerWillDestroy(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
public BlockState rotate(BlockState p_52790_, Rotation p_52791_) {
return (BlockState) p_52790_.setValue(FACING, p_52791_.rotate(p_52790_.getValue(FACING)));
}
public BlockState mirror(BlockState p_52787_, Mirror p_52788_) {
return p_52788_ == Mirror.NONE ? p_52787_ : p_52787_.rotate(p_52788_.getRotation(p_52787_.getValue(FACING)));
}
@Nullable
public BlockState getStateForPlacement(BlockPlaceContext p_196258_1_) {
BlockPos lvt_2_1_ = p_196258_1_.getClickedPos();
if (lvt_2_1_.getY() < p_196258_1_.getLevel().getMaxBuildHeight() && p_196258_1_.getLevel().getBlockState(lvt_2_1_.relative(p_196258_1_.getHorizontalDirection())).canBeReplaced(p_196258_1_)) {
Level lvt_3_1_ = p_196258_1_.getLevel();
boolean z = lvt_3_1_.hasNeighborSignal(lvt_2_1_) || lvt_3_1_.hasNeighborSignal(lvt_2_1_.above());
return (BlockState) ((BlockState) defaultBlockState().setValue(FACING, p_196258_1_.getHorizontalDirection().getOpposite())).setValue(HALF, BenchHalf.back);
}
return null;
}
@Deprecated
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos p_225533_3_, Player player, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
return InteractionResult.CONSUME;
}
public void setPlacedBy(Level p_180633_1_, BlockPos p_180633_2_, BlockState p_180633_3_, LivingEntity p_180633_4_, ItemStack p_180633_5_) {
p_180633_1_.setBlock(p_180633_2_.relative(p_180633_4_.getDirection()), (BlockState) p_180633_3_.setValue(HALF, BenchHalf.front), 3);
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
BlockPos lvt_4_1_ = p_196260_3_.below();
BlockState lvt_5_1_ = p_196260_2_.getBlockState(lvt_4_1_);
return p_196260_1_.getValue(HALF) == BenchHalf.back ? lvt_5_1_.isFaceSturdy(p_196260_2_, lvt_4_1_, Direction.UP) : lvt_5_1_.is(this);
}
public PushReaction getPistonPushReaction(BlockState p_149656_1_) {
return PushReaction.DESTROY;
}
@OnlyIn(Dist.CLIENT)
public long getSeed(BlockState p_209900_1_, BlockPos p_209900_2_) {
return Mth.getSeed(p_209900_2_.getX(), p_209900_2_.below(p_209900_1_.getValue(HALF) == BenchHalf.back ? 0 : 1).getY(), p_209900_2_.getZ());
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_206840_1_) {
p_206840_1_.add(new Property[]{HALF, FACING});
}
}

View File

@ -1,189 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.blocks.gui.WirelessPowerScreen;
import com.dairymoose.modernlife.core.ModernLifeCommon;
import com.dairymoose.modernlife.tileentities.IChannelHolder;
import com.dairymoose.modernlife.tileentities.PowerReceiverBlockEntity;
import com.dairymoose.modernlife.tileentities.PowerTransmitterBlockEntity;
import java.util.List;
import java.util.Set;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/PowerReceiverBlock.class */
public class PowerReceiverBlock extends Block implements EntityBlock {
protected static final VoxelShape SHAPE = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(6.5d, 2.0d, 6.5d, 9.5d, 5.0d, 9.5d), Block.box(0.0d, 0.0d, 0.0d, 16.0d, 4.0d, 16.0d), Block.box(2.0d, 4.0d, 2.0d, 14.0d, 8.0d, 14.0d), Block.box(4.0d, 8.0d, 4.0d, 12.0d, 12.0d, 12.0d), Block.box(6.0d, 12.0d, 6.0d, 10.0d, 16.0d, 10.0d), Block.box(0.0d, 0.0d, 0.0d, 16.0d, 1.0d, 16.0d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Receives power on the selected channel from all transmitters"));
list.add(new TextComponent("Right click block to change current channel"));
}
public PowerReceiverBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any().setValue(FACING, Direction.SOUTH)).setValue(POWERED, Boolean.FALSE));
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos p_225533_3_, Player p_225533_4_, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
if (p_225533_2_.isClientSide) {
DistExecutor.runWhenOn(Dist.CLIENT, () -> {
return new Runnable() { // from class: com.dairymoose.modernlife.blocks.PowerReceiverBlock.1
@Override // java.lang.Runnable
public void run() {
IChannelHolder blockEntity = (IChannelHolder) p_225533_2_.getBlockEntity(p_225533_3_);
if (blockEntity != null) {
IChannelHolder channelHolder = blockEntity;
WirelessPowerScreen screen = new WirelessPowerScreen(p_225533_3_, channelHolder.getCurrentChannel());
Minecraft.getInstance().setScreen(screen);
}
}
};
});
}
return InteractionResult.CONSUME;
}
public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) {
if (!world.isClientSide) {
BlockEntity tileEntity = world.getBlockEntity(pos);
if (tileEntity instanceof PowerReceiverBlockEntity) {
PowerReceiverBlockEntity receiver = (PowerReceiverBlockEntity) tileEntity;
receiver.setCurrentChannel(0);
}
}
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return PowerReceiverBlockEntity.POWER_RECEIVER.create(pos, state);
}
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState p_196243_4_, boolean p_196243_5_) {
BlockEntity entity = world.getBlockEntity(pos);
if (entity instanceof PowerReceiverBlockEntity) {
PowerReceiverBlockEntity receiver = (PowerReceiverBlockEntity) entity;
ModernLifeCommon.LOGGER.debug("remove receiver from channel: " + receiver.getCurrentChannel());
receiver.removeFromChannel(receiver.getCurrentChannel());
}
if (!p_196243_5_ && !state.is(p_196243_4_.getBlock())) {
updateNeighbours(state, world, pos);
super.onRemove(state, world, pos, p_196243_4_, p_196243_5_);
}
}
private int getPowerFromTransmitter(BlockPos pos, BlockGetter reader) {
BlockEntity entity = reader.getBlockEntity(pos);
ModernLifeCommon.LOGGER.debug("get power: " + entity);
if (entity instanceof PowerReceiverBlockEntity) {
ModernLifeCommon.LOGGER.debug("entity is instance");
PowerReceiverBlockEntity receiver = (PowerReceiverBlockEntity) entity;
Set<PowerTransmitterBlockEntity> transmitters = PowerTransmitterBlockEntity.perChannelPowerTransmitters.get(Integer.valueOf(receiver.getCurrentChannel()));
int powerSum = 0;
if (transmitters != null) {
ModernLifeCommon.LOGGER.debug("found " + transmitters.size() + " transmitters for channel " + receiver.getCurrentChannel());
for (PowerTransmitterBlockEntity transmitter : transmitters) {
BlockState state = transmitter.getBlockState();
powerSum += ((Integer) state.getValue(BlockStateProperties.POWER)).intValue();
}
if (powerSum > 15) {
powerSum = 15;
}
ModernLifeCommon.LOGGER.debug("got power sum = " + powerSum);
} else {
ModernLifeCommon.LOGGER.debug("transmitters is null for channel " + receiver.getCurrentChannel());
}
return powerSum;
}
return 0;
}
public boolean isSignalSource(BlockState p_60571_) {
return true;
}
public boolean useShapeForLightOcclusion(BlockState p_220074_1_) {
return true;
}
public int getSignal(BlockState state, BlockGetter reader, BlockPos pos, Direction p_180656_4_) {
ModernLifeCommon.LOGGER.debug("getSignal for state=" + state + " and pos=" + pos);
return getPowerFromTransmitter(pos, reader);
}
public int getDirectSignal(BlockState p_176211_1_, BlockGetter p_176211_2_, BlockPos p_176211_3_, Direction p_176211_4_) {
ModernLifeCommon.LOGGER.debug("getDirectSignal");
return getPowerFromTransmitter(p_176211_3_, p_176211_2_);
}
private void updateNeighbours(BlockState p_196378_1_, Level p_196378_2_, BlockPos p_196378_3_) {
p_196378_2_.updateNeighborsAt(p_196378_3_, this);
p_196378_2_.updateNeighborsAt(p_196378_3_.relative(p_196378_1_.getValue(FACING).getOpposite()), this);
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
return SHAPE;
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FACING, POWERED});
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
Direction[] var2 = context.getNearestLookingDirections();
for (Direction lvt_5_1_ : var2) {
if (lvt_5_1_.getAxis() != Direction.Axis.Y) {
BlockState lvt_6_2_ = (BlockState) defaultBlockState().setValue(FACING, lvt_5_1_.getOpposite());
if (lvt_6_2_.canSurvive(context.getLevel(), context.getClickedPos())) {
return lvt_6_2_;
}
}
}
return defaultBlockState();
}
}

View File

@ -1,137 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.blocks.gui.WirelessPowerScreen;
import com.dairymoose.modernlife.core.CustomBlocks;
import com.dairymoose.modernlife.core.ModernLifeCommon;
import com.dairymoose.modernlife.tileentities.IChannelHolder;
import com.dairymoose.modernlife.tileentities.PowerTransmitterBlockEntity;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/PowerTransmitterBlock.class */
public class PowerTransmitterBlock extends Block implements EntityBlock {
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public static final IntegerProperty POWER = BlockStateProperties.POWER;
public PowerTransmitterBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Transmits power on the selected channel to all receivers"));
list.add(new TextComponent("Right click block to change current channel"));
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos p_225533_3_, Player p_225533_4_, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
if (p_225533_2_.isClientSide) {
DistExecutor.runWhenOn(Dist.CLIENT, () -> {
return new Runnable() { // from class: com.dairymoose.modernlife.blocks.PowerTransmitterBlock.1
@Override // java.lang.Runnable
public void run() {
IChannelHolder blockEntity = (IChannelHolder) p_225533_2_.getBlockEntity(p_225533_3_);
if (blockEntity instanceof IChannelHolder) {
IChannelHolder channelHolder = blockEntity;
WirelessPowerScreen screen = new WirelessPowerScreen(p_225533_3_, channelHolder.getCurrentChannel());
Minecraft.getInstance().setScreen(screen);
}
}
};
});
}
return InteractionResult.CONSUME;
}
public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) {
if (!world.isClientSide) {
BlockEntity tileEntity = world.getBlockEntity(pos);
if (tileEntity instanceof PowerTransmitterBlockEntity) {
PowerTransmitterBlockEntity transmitter = (PowerTransmitterBlockEntity) tileEntity;
transmitter.setCurrentChannel(0);
}
}
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FACING, POWER});
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return PowerTransmitterBlockEntity.POWER_TRANSMITTER.create(pos, state);
}
public VoxelShape getCollisionShape(BlockState state, BlockGetter blockReader, BlockPos blockPos, CollisionContext ctx) {
return super.getCollisionShape(state, blockReader, blockPos, ctx);
}
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState p_196243_4_, boolean p_196243_5_) {
BlockEntity entity = world.getBlockEntity(pos);
if (entity instanceof PowerTransmitterBlockEntity) {
PowerTransmitterBlockEntity transmitter = (PowerTransmitterBlockEntity) entity;
ModernLifeCommon.LOGGER.debug("remove transmitter from channel: " + transmitter.getCurrentChannel());
transmitter.removeFromChannel(transmitter.getCurrentChannel());
transmitter.updateReceivers(world);
}
super.onRemove(state, world, pos, p_196243_4_, p_196243_5_);
}
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block block, BlockPos neighbor, boolean p_220069_6_) {
if (!world.getBlockState(neighbor).is(CustomBlocks.BLOCK_POWER_RECEIVER.get()) && state.is(CustomBlocks.BLOCK_POWER_TRANSMITTER.get())) {
BlockEntity entity = world.getBlockEntity(pos);
if (entity instanceof PowerTransmitterBlockEntity) {
world.setBlock(pos, (BlockState) state.setValue(POWER, Integer.valueOf(world.getBestNeighborSignal(pos))), 2);
PowerTransmitterBlockEntity transmitter = (PowerTransmitterBlockEntity) entity;
ModernLifeCommon.LOGGER.debug("add transmitter to channel: " + transmitter.getCurrentChannel());
transmitter.addToChannel(transmitter.getCurrentChannel());
transmitter.updateReceivers(world);
}
}
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState) ((BlockState) defaultBlockState().setValue(FACING, context.getHorizontalDirection())).setValue(POWER, Integer.valueOf(context.getLevel().getBestNeighborSignal(context.getClickedPos())));
}
public VoxelShape getShape(BlockState p_220053_1_, BlockGetter p_220053_2_, BlockPos p_220053_3_, CollisionContext p_220053_4_) {
return Block.box(0.0d, 0.0d, 0.0d, 16.0d, 16.0d, 16.0d);
}
}

View File

@ -1,206 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.blocks.gui.PrinterScreen;
import com.dairymoose.modernlife.core.CustomBlocks;
import com.dairymoose.modernlife.tileentities.PrinterBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.ListTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.ChestMenu;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/PrinterBlock.class */
public class PrinterBlock extends StandardHorizontalBlock implements EntityBlock {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(1.0d, 0.0d, 0.0d, 15.0d, 8.0d, 13.0d), Block.box(5.0d, 0.0d, 13.0d, 11.0d, 1.0d, 16.0d)}).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public PrinterBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
public void onRemove(BlockState p_196243_1_, Level p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_1_.is(p_196243_4_.getBlock())) {
BlockEntity lvt_6_1_ = p_196243_2_.getBlockEntity(p_196243_3_);
if (lvt_6_1_ instanceof PrinterBlockEntity) {
Containers.dropContents(p_196243_2_, p_196243_3_, (PrinterBlockEntity) lvt_6_1_);
p_196243_2_.updateNeighbourForOutputSignal(p_196243_3_, this);
}
super.onRemove(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
}
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
PrinterBlockEntity toReturn = (PrinterBlockEntity) PrinterBlockEntity.PRINTER.create(pos, state);
return toReturn;
}
public MenuProvider getMenuProvider(BlockState p_220052_1_, Level p_220052_2_, BlockPos p_220052_3_) {
return new MenuProvider() { // from class: com.dairymoose.modernlife.blocks.PrinterBlock.1
public AbstractContainerMenu createMenu(int paramInt, Inventory paramInventory, Player paramPlayer) {
BlockEntity tileEntity = p_220052_2_.getBlockEntity(p_220052_3_);
if (tileEntity instanceof PrinterBlockEntity) {
PrinterBlockEntity printerBlockEntity = (PrinterBlockEntity) tileEntity;
return new ChestMenu(MenuType.GENERIC_9x3, paramInt, paramInventory, printerBlockEntity, 3);
}
return null;
}
public Component getDisplayName() {
return new TextComponent("Printer");
}
};
}
public InteractionResult use(BlockState blockState, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult rayTrace) {
MenuProvider lvt_7_1_;
ItemStack itemStack = player.getMainHandItem();
if (itemStack.getItem() == CustomBlocks.ITEM_CAMERA.get() || itemStack.getItem() == CustomBlocks.ITEM_CANVAS.get()) {
if (itemStack.getItem() == CustomBlocks.ITEM_CAMERA.get() && itemStack.getTag() != null && itemStack.getTag().contains("ImageList")) {
int photoCount = 0;
ListTag listTag = (ListTag) itemStack.getTag().get("ImageList");
if (listTag instanceof ListTag) {
ListTag imageList = listTag;
photoCount = imageList.size();
}
if (photoCount > 0) {
if (world.isClientSide) {
DistExecutor.runWhenOn(Dist.CLIENT, () -> {
return new Runnable() { // from class: com.dairymoose.modernlife.blocks.PrinterBlock.2
@Override // java.lang.Runnable
public void run() {
Minecraft.getInstance().setScreen(new PrinterScreen(pos));
}
};
});
}
} else {
MenuProvider lvt_7_1_2 = getMenuProvider(blockState, world, pos);
if (lvt_7_1_2 != null) {
player.openMenu(lvt_7_1_2);
}
}
} else if (itemStack.getItem() == CustomBlocks.ITEM_CANVAS.get() && world.isClientSide) {
DistExecutor.runWhenOn(Dist.CLIENT, () -> {
return new Runnable() { // from class: com.dairymoose.modernlife.blocks.PrinterBlock.3
final /* synthetic */ BlockPos val$pos;
RunnableC00493(BlockPos pos2) {
pos = pos2;
}
@Override // java.lang.Runnable
public void run() {
Minecraft.getInstance().setScreen(new PrinterScreen(pos));
}
};
});
}
} else if (!world.isClientSide && (lvt_7_1_ = getMenuProvider(blockState, world, pos2)) != null) {
player.openMenu(lvt_7_1_);
}
return InteractionResult.CONSUME;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: com.dairymoose.modernlife.blocks.PrinterBlock$2 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/PrinterBlock$2.class */
public class RunnableC00482 implements Runnable {
final /* synthetic */ BlockPos val$pos;
RunnableC00482(BlockPos pos2) {
pos = pos2;
}
@Override // java.lang.Runnable
public void run() {
Minecraft.getInstance().setScreen(new PrinterScreen(pos));
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: com.dairymoose.modernlife.blocks.PrinterBlock$3 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/PrinterBlock$3.class */
public class RunnableC00493 implements Runnable {
final /* synthetic */ BlockPos val$pos;
RunnableC00493(BlockPos pos2) {
pos = pos2;
}
@Override // java.lang.Runnable
public void run() {
Minecraft.getInstance().setScreen(new PrinterScreen(pos));
}
}
/* renamed from: com.dairymoose.modernlife.blocks.PrinterBlock$4 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/PrinterBlock$4.class */
static /* synthetic */ class C00504 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00504.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,232 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.blocks.gui.RadiatorScreen;
import com.dairymoose.modernlife.tileentities.RadiatorBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/RadiatorBlock.class */
public class RadiatorBlock extends Block implements SimpleWaterloggedBlock, EntityBlock {
protected static final VoxelShape SHAPE_NORTH = Block.box(2.0d, 0.0d, 5.0d, 15.0d, 13.0d, 12.0d);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
protected static final VoxelShape SHAPE_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public static final EnumProperty<HeatType> HEAT = EnumProperty.create("heat", HeatType.class);
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
public RadiatorBlock() {
super(Properties.of(Material.HEAVY_METAL).sound(SoundType.METAL).strength(3.5f, 10.0f).lightLevel(RadiatorBlock::getLightValueInternal));
registerDefaultState((BlockState) ((BlockState) ((BlockState) this.stateDefinition.any().setValue(FACING, Direction.NORTH)).setValue(HEAT, HeatType.off)).setValue(WATERLOGGED, Boolean.FALSE));
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
return !p_196260_2_.isEmptyBlock(p_196260_3_.below());
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
public FluidState getFluidState(BlockState p_204507_1_) {
if (((Boolean) p_204507_1_.getValue(WATERLOGGED)).booleanValue()) {
return Fluids.WATER.getSource(false);
}
return super.getFluidState(p_204507_1_);
}
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return ModernLifeUtil.createTickerHelper(type, RadiatorBlockEntity.RADIATOR, RadiatorBlockEntity::tick);
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return RadiatorBlockEntity.RADIATOR.create(pos, state);
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
if (((Boolean) p_196271_1_.getValue(WATERLOGGED)).booleanValue()) {
p_196271_4_.scheduleTick(p_196271_5_, Fluids.WATER, Fluids.WATER.getTickDelay(p_196271_4_));
}
return super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: com.dairymoose.modernlife.blocks.RadiatorBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/RadiatorBlock$1.class */
public class RunnableC00511 implements Runnable {
final /* synthetic */ Level val$p_225533_2_;
final /* synthetic */ BlockPos val$p_225533_3_;
RunnableC00511(Level level, BlockPos blockPos) {
p_225533_2_ = level;
p_225533_3_ = blockPos;
}
@Override // java.lang.Runnable
public void run() {
RadiatorScreen screen = new RadiatorScreen(p_225533_2_, p_225533_3_);
Minecraft.getInstance().setScreen(screen);
}
}
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos p_225533_3_, Player p_225533_4_, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
if (p_225533_2_.isClientSide) {
DistExecutor.runWhenOn(Dist.CLIENT, () -> {
return new Runnable() { // from class: com.dairymoose.modernlife.blocks.RadiatorBlock.1
final /* synthetic */ Level val$p_225533_2_;
final /* synthetic */ BlockPos val$p_225533_3_;
RunnableC00511(Level p_225533_2_2, BlockPos p_225533_3_2) {
p_225533_2_ = p_225533_2_2;
p_225533_3_ = p_225533_3_2;
}
@Override // java.lang.Runnable
public void run() {
RadiatorScreen screen = new RadiatorScreen(p_225533_2_, p_225533_3_);
Minecraft.getInstance().setScreen(screen);
}
};
});
}
return InteractionResult.CONSUME;
}
public static int getLightValueInternal(BlockState state) {
if (state.getValue(HEAT) == HeatType.low) {
return 3;
}
if (state.getValue(HEAT) == HeatType.medium) {
return 5;
}
if (state.getValue(HEAT) == HeatType.high) {
return 7;
}
return 0;
}
public int getLightBlock(BlockState state, BlockGetter world, BlockPos pos) {
return getLightValueInternal(state);
}
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Right click placed radiator to activate"));
}
@OnlyIn(Dist.CLIENT)
public boolean isEmissiveRendering(BlockState blockState) {
if (blockState.getValue(HEAT) == HeatType.low || blockState.getValue(HEAT) == HeatType.medium || blockState.getValue(HEAT) == HeatType.high) {
return true;
}
return false;
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FACING, HEAT, WATERLOGGED});
}
/* renamed from: com.dairymoose.modernlife.blocks.RadiatorBlock$2 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/RadiatorBlock$2.class */
static /* synthetic */ class C00522 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00522.$SwitchMap$net$minecraft$core$Direction[bs.getValue(FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
FluidState fluidState = context.getLevel().getFluidState(context.getClickedPos());
return (BlockState) ((BlockState) defaultBlockState().setValue(FACING, context.getHorizontalDirection())).setValue(WATERLOGGED, Boolean.valueOf(fluidState.getType() == Fluids.WATER));
}
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/RadiatorBlock$HeatType.class */
public enum HeatType implements StringRepresentable {
off,
low,
medium,
high;
public String getSerializedName() {
return name().toLowerCase();
}
}
}

View File

@ -1,222 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.core.CustomBlocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/RampBlock.class */
public class RampBlock extends Block {
protected static final VoxelShape SHAPE_WEST = Shapes.or(Block.box(0.0d, 0.0d, 0.0d, 16.0d, 1.0d, 16.0d), new VoxelShape[]{Block.box(0.0d, 1.0d, 0.0d, 15.0d, 2.0d, 16.0d), Block.box(0.0d, 2.0d, 0.0d, 14.0d, 3.0d, 16.0d), Block.box(0.0d, 3.0d, 0.0d, 13.0d, 4.0d, 16.0d), Block.box(0.0d, 4.0d, 0.0d, 12.0d, 5.0d, 16.0d), Block.box(0.0d, 5.0d, 0.0d, 11.0d, 6.0d, 16.0d), Block.box(0.0d, 6.0d, 0.0d, 10.0d, 7.0d, 16.0d), Block.box(0.0d, 7.0d, 0.0d, 9.0d, 8.0d, 16.0d), Block.box(0.0d, 8.0d, 0.0d, 8.0d, 9.0d, 16.0d), Block.box(0.0d, 9.0d, 0.0d, 7.0d, 10.0d, 16.0d), Block.box(0.0d, 10.0d, 0.0d, 6.0d, 11.0d, 16.0d), Block.box(0.0d, 11.0d, 0.0d, 5.0d, 12.0d, 16.0d), Block.box(0.0d, 12.0d, 0.0d, 4.0d, 13.0d, 16.0d), Block.box(0.0d, 13.0d, 0.0d, 3.0d, 14.0d, 16.0d), Block.box(0.0d, 14.0d, 0.0d, 2.0d, 15.0d, 16.0d), Block.box(0.0d, 15.0d, 0.0d, 1.0d, 16.0d, 16.0d)}).optimize();
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
protected static final VoxelShape SHAPE_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST);
protected static final VoxelShape SHAPE_EAST_CORNER = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(-0.75d, 0.0d, 0.0d, 16.0d, 1.0d, 16.0d), Block.box(0.5d, 1.0d, 0.0d, 16.0d, 2.0d, 15.0d), Block.box(1.5d, 2.0d, 0.0d, 16.0d, 3.0d, 14.0d), Block.box(2.5d, 3.0d, 0.0d, 16.0d, 4.0d, 13.0d), Block.box(3.5d, 4.0d, 0.0d, 16.0d, 5.0d, 12.0d), Block.box(4.5d, 5.0d, 0.0d, 16.0d, 6.0d, 11.0d), Block.box(5.5d, 6.0d, 0.0d, 16.0d, 7.0d, 10.0d), Block.box(6.5d, 7.0d, 0.0d, 16.0d, 8.0d, 9.0d), Block.box(7.5d, 8.0d, 0.0d, 16.0d, 9.0d, 8.0d), Block.box(8.5d, 9.0d, 0.0d, 16.0d, 10.0d, 7.0d), Block.box(9.5d, 10.0d, 0.0d, 16.0d, 11.0d, 6.0d), Block.box(10.5d, 11.0d, 0.0d, 16.0d, 12.0d, 5.0d), Block.box(11.5d, 12.0d, 0.0d, 16.0d, 13.0d, 4.0d), Block.box(12.5d, 13.0d, 0.0d, 16.0d, 14.0d, 3.0d), Block.box(13.5d, 14.0d, 0.0d, 16.0d, 15.0d, 2.0d)}).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_SOUTH_CORNER = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST_CORNER);
protected static final VoxelShape SHAPE_WEST_CORNER = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH_CORNER);
protected static final VoxelShape SHAPE_NORTH_CORNER = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST_CORNER);
protected static final Map<Direction, VoxelShape> SHAPE_MAP;
protected static final Map<Direction, VoxelShape> SHAPE_MAP_CORNER;
public static final EnumProperty<Direction> FACING;
public static final EnumProperty<PartType> PART;
static {
Map<Direction, VoxelShape> shapes = new HashMap<>();
shapes.put(Direction.EAST, SHAPE_EAST);
shapes.put(Direction.SOUTH, SHAPE_SOUTH);
shapes.put(Direction.WEST, SHAPE_WEST);
shapes.put(Direction.NORTH, SHAPE_NORTH);
SHAPE_MAP = Collections.unmodifiableMap(shapes);
Map<Direction, VoxelShape> shapes2 = new HashMap<>();
shapes2.put(Direction.EAST, SHAPE_EAST_CORNER);
shapes2.put(Direction.SOUTH, SHAPE_SOUTH_CORNER);
shapes2.put(Direction.WEST, SHAPE_WEST_CORNER);
shapes2.put(Direction.NORTH, SHAPE_NORTH_CORNER);
SHAPE_MAP_CORNER = Collections.unmodifiableMap(shapes2);
FACING = BlockStateProperties.HORIZONTAL_FACING;
PART = EnumProperty.create("part", PartType.class);
}
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/RampBlock$PartType.class */
public enum PartType implements StringRepresentable {
straight,
corner;
public String getSerializedName() {
return name().toLowerCase();
}
}
public RampBlock() {
super(Properties.of(Material.WOOD).sound(SoundType.WOOD).strength(1.0f));
registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any().setValue(FACING, Direction.EAST)).setValue(PART, PartType.straight));
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 20;
}
return 0;
}
public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 5;
}
return 0;
}
public RampBlock(Properties props) {
super(props);
registerDefaultState((BlockState) this.stateDefinition.any().setValue(FACING, Direction.EAST));
}
public void stepOn(Level p_176199_1_, BlockPos p_176199_2_, BlockState state, Entity entity) {
if (p_176199_1_.getBlockState(p_176199_2_).is(CustomBlocks.BLOCK_PAVED_ROAD_RAMP.get())) {
PavedRoadBlock.steppedOn(entity);
}
}
public boolean useShapeForLightOcclusion(BlockState p_220074_1_) {
return true;
}
private boolean isOpposite(BlockState first, BlockState second) {
if (first.getBlock() == second.getBlock() && first.getValue(PART) == second.getValue(PART) && first.getValue(FACING) == second.getValue(FACING).getOpposite()) {
return true;
}
return false;
}
private BlockState setPartType(LevelAccessor world, BlockState state, BlockPos pos) {
BlockState nRamp = world.getBlockState(pos.relative(Direction.NORTH));
BlockState eRamp = world.getBlockState(pos.relative(Direction.EAST));
BlockState sRamp = world.getBlockState(pos.relative(Direction.SOUTH));
BlockState wRamp = world.getBlockState(pos.relative(Direction.WEST));
boolean hasNramp = nRamp.is(this);
boolean hasEramp = eRamp.is(this);
boolean hasSramp = sRamp.is(this);
boolean hasWramp = wRamp.is(this);
int adjacentRampCount = (hasNramp ? 1 : 0) + (hasEramp ? 1 : 0) + (hasSramp ? 1 : 0) + (hasWramp ? 1 : 0);
BlockState forwardState = world.getBlockState(pos.relative(state.getValue(FACING)));
if (adjacentRampCount >= 2) {
if (hasSramp && hasWramp && !isOpposite(state, forwardState)) {
state = (BlockState) ((BlockState) state.setValue(PART, PartType.corner)).setValue(FACING, Direction.WEST);
} else if (hasSramp && hasEramp && !isOpposite(state, forwardState)) {
state = (BlockState) ((BlockState) state.setValue(PART, PartType.corner)).setValue(FACING, Direction.SOUTH);
} else if (hasNramp && hasWramp && !isOpposite(state, forwardState)) {
state = (BlockState) ((BlockState) state.setValue(PART, PartType.corner)).setValue(FACING, Direction.NORTH);
} else if (hasNramp && hasEramp && !isOpposite(state, forwardState)) {
state = (BlockState) ((BlockState) state.setValue(PART, PartType.corner)).setValue(FACING, Direction.EAST);
}
} else {
if (state.getValue(PART) == PartType.corner) {
boolean cornerAdjustment = false;
if (hasNramp && nRamp.getValue(PART) == PartType.corner) {
cornerAdjustment = true;
if (nRamp.getValue(FACING) == Direction.WEST) {
state = (BlockState) state.setValue(FACING, Direction.WEST);
} else {
state = (BlockState) state.setValue(FACING, Direction.EAST);
}
}
if (hasEramp && eRamp.getValue(PART) == PartType.corner) {
cornerAdjustment = true;
if (eRamp.getValue(FACING) == Direction.NORTH) {
state = (BlockState) state.setValue(FACING, Direction.NORTH);
} else {
state = (BlockState) state.setValue(FACING, Direction.SOUTH);
}
}
if (hasSramp && sRamp.getValue(PART) == PartType.corner) {
cornerAdjustment = true;
if (sRamp.getValue(FACING) == Direction.EAST) {
state = (BlockState) state.setValue(FACING, Direction.EAST);
} else {
state = (BlockState) state.setValue(FACING, Direction.WEST);
}
}
if (hasWramp && wRamp.getValue(PART) == PartType.corner) {
cornerAdjustment = true;
if (wRamp.getValue(FACING) == Direction.EAST) {
state = (BlockState) state.setValue(FACING, Direction.NORTH);
} else {
state = (BlockState) state.setValue(FACING, Direction.SOUTH);
}
}
if (!cornerAdjustment) {
if (hasNramp) {
state = (BlockState) state.setValue(FACING, nRamp.getValue(FACING));
}
if (hasEramp) {
state = (BlockState) state.setValue(FACING, eRamp.getValue(FACING));
}
if (hasSramp) {
state = (BlockState) state.setValue(FACING, sRamp.getValue(FACING));
}
if (hasWramp) {
state = (BlockState) state.setValue(FACING, wRamp.getValue(FACING));
}
}
}
state = (BlockState) state.setValue(PART, PartType.straight);
}
return state;
}
public BlockState updateShape(BlockState state, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor world, BlockPos pos, BlockPos p_196271_6_) {
return setPartType(world, state, pos);
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FACING, PART});
}
public VoxelShape getShape(BlockState p_220053_1_, BlockGetter p_220053_2_, BlockPos p_220053_3_, CollisionContext p_220053_4_) {
if (p_220053_1_.getValue(PART) == PartType.corner) {
VoxelShape result = SHAPE_MAP_CORNER.get(p_220053_1_.getValue(FACING));
return result == null ? SHAPE_EAST_CORNER : result;
}
VoxelShape result2 = SHAPE_MAP.get(p_220053_1_.getValue(FACING));
return result2 == null ? SHAPE_EAST : result2;
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
return setPartType(context.getLevel(), (BlockState) defaultBlockState().setValue(FACING, context.getHorizontalDirection()), context.getClickedPos());
}
}

View File

@ -1,231 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.tileentities.RefrigeratorBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Mth;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.ChestMenu;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/RefrigeratorBlock.class */
public class RefrigeratorBlock extends Block implements EntityBlock {
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
public static final EnumProperty<DoubleBlockHalf> HALF = BlockStateProperties.DOUBLE_BLOCK_HALF;
protected static final VoxelShape SOUTH_AABB = Block.box(0.01d, 0.0d, 0.01d, 15.99d, 16.0d, 15.99d);
protected static final VoxelShape NORTH_AABB = Block.box(0.01d, 0.0d, 0.01d, 15.99d, 16.0d, 15.99d);
protected static final VoxelShape WEST_AABB = Block.box(0.01d, 0.0d, 0.01d, 15.99d, 16.0d, 15.99d);
protected static final VoxelShape EAST_AABB = Block.box(0.01d, 0.0d, 0.01d, 15.99d, 16.0d, 15.99d);
public RefrigeratorBlock(Properties p_i48413_1_) {
super(p_i48413_1_);
registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any().setValue(FACING, Direction.NORTH)).setValue(HALF, DoubleBlockHalf.LOWER));
}
public VoxelShape getShape(BlockState p_220053_1_, BlockGetter p_220053_2_, BlockPos p_220053_3_, CollisionContext p_220053_4_) {
Direction lvt_5_1_ = p_220053_1_.getValue(FACING);
switch (lvt_5_1_.ordinal()) {
case 1:
default:
return EAST_AABB;
case 2:
return SOUTH_AABB;
case 3:
return WEST_AABB;
case 4:
return NORTH_AABB;
}
}
public void onRemove(BlockState p_196243_1_, Level p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_1_.is(p_196243_4_.getBlock())) {
BlockEntity lvt_6_1_ = p_196243_2_.getBlockEntity(p_196243_3_);
if (lvt_6_1_ instanceof RefrigeratorBlockEntity) {
Containers.dropContents(p_196243_2_, p_196243_3_, (RefrigeratorBlockEntity) lvt_6_1_);
p_196243_2_.updateNeighbourForOutputSignal(p_196243_3_, this);
}
super.onRemove(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
}
}
/* renamed from: com.dairymoose.modernlife.blocks.RefrigeratorBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/RefrigeratorBlock$1.class */
public class C00531 implements MenuProvider {
final /* synthetic */ Level val$p_220052_2_;
final /* synthetic */ BlockPos val$p_220052_3_;
C00531(Level level, BlockPos blockPos) {
p_220052_2_ = level;
p_220052_3_ = blockPos;
}
public AbstractContainerMenu createMenu(int paramInt, Inventory paramInventory, Player paramPlayer) {
BlockEntity tileEntity = p_220052_2_.getBlockEntity(p_220052_3_);
if (tileEntity instanceof RefrigeratorBlockEntity) {
RefrigeratorBlockEntity refrigeratorBlockEntity = (RefrigeratorBlockEntity) tileEntity;
return new ChestMenu(MenuType.GENERIC_9x4, paramInt, paramInventory, refrigeratorBlockEntity, 4);
}
return null;
}
public Component getDisplayName() {
return new TextComponent("Refrigerator");
}
}
public MenuProvider getMenuProvider(BlockState p_220052_1_, Level p_220052_2_, BlockPos p_220052_3_) {
return new MenuProvider() { // from class: com.dairymoose.modernlife.blocks.RefrigeratorBlock.1
final /* synthetic */ Level val$p_220052_2_;
final /* synthetic */ BlockPos val$p_220052_3_;
C00531(Level p_220052_2_2, BlockPos p_220052_3_2) {
p_220052_2_ = p_220052_2_2;
p_220052_3_ = p_220052_3_2;
}
public AbstractContainerMenu createMenu(int paramInt, Inventory paramInventory, Player paramPlayer) {
BlockEntity tileEntity = p_220052_2_.getBlockEntity(p_220052_3_);
if (tileEntity instanceof RefrigeratorBlockEntity) {
RefrigeratorBlockEntity refrigeratorBlockEntity = (RefrigeratorBlockEntity) tileEntity;
return new ChestMenu(MenuType.GENERIC_9x4, paramInt, paramInventory, refrigeratorBlockEntity, 4);
}
return null;
}
public Component getDisplayName() {
return new TextComponent("Refrigerator");
}
};
}
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return ModernLifeUtil.createTickerHelper(type, RefrigeratorBlockEntity.REFRIGERATOR, RefrigeratorBlockEntity::tick);
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
if (state.getValue(HALF) == DoubleBlockHalf.UPPER) {
RefrigeratorBlockEntity toReturn = (RefrigeratorBlockEntity) RefrigeratorBlockEntity.REFRIGERATOR.create(pos, state);
return toReturn;
}
return null;
}
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos p_225533_3_, Player p_225533_4_, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
MenuProvider lvt_7_1_ = getMenuProvider(p_225533_1_, p_225533_2_, p_225533_3_);
if (lvt_7_1_ != null) {
p_225533_4_.openMenu(lvt_7_1_);
}
return InteractionResult.CONSUME;
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
Comparable comparable = (DoubleBlockHalf) p_196271_1_.getValue(HALF);
if (p_196271_2_.getAxis() == Direction.Axis.Y) {
if ((comparable == DoubleBlockHalf.LOWER) == (p_196271_2_ == Direction.UP)) {
return (!p_196271_3_.is(this) || p_196271_3_.getValue(HALF) == comparable) ? Blocks.AIR.defaultBlockState() : (BlockState) p_196271_1_.setValue(FACING, p_196271_3_.getValue(FACING));
}
}
return (comparable == DoubleBlockHalf.LOWER && p_196271_2_ == Direction.DOWN && !p_196271_1_.canSurvive(p_196271_4_, p_196271_5_)) ? Blocks.AIR.defaultBlockState() : super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
protected static void preventCreativeDropFromBottomPart(Level p_241471_0_, BlockPos p_241471_1_, BlockState p_241471_2_, Player p_241471_3_) {
DoubleBlockHalf doubleblockhalf = p_241471_2_.getValue(HALF);
if (doubleblockhalf == DoubleBlockHalf.UPPER) {
BlockPos blockpos = p_241471_1_.below();
BlockState blockstate = p_241471_0_.getBlockState(blockpos);
if (blockstate.getBlock() == p_241471_2_.getBlock() && blockstate.getValue(HALF) == DoubleBlockHalf.LOWER) {
p_241471_0_.setBlock(blockpos, Blocks.AIR.defaultBlockState(), 35);
p_241471_0_.levelEvent(p_241471_3_, 2001, blockpos, Block.getId(blockstate));
}
}
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return mirror == Mirror.NONE ? state : state.rotate(mirror.getRotation(state.getValue(FACING)));
}
public void playerWillDestroy(Level p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, Player p_176208_4_) {
if (!p_176208_1_.isClientSide && p_176208_4_.isCreative()) {
preventCreativeDropFromBottomPart(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
super.playerWillDestroy(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
@Nullable
public BlockState getStateForPlacement(BlockPlaceContext p_196258_1_) {
BlockPos lvt_2_1_ = p_196258_1_.getClickedPos();
if (lvt_2_1_.getY() < p_196258_1_.getLevel().getMaxBuildHeight() && p_196258_1_.getLevel().getBlockState(lvt_2_1_.above()).canBeReplaced(p_196258_1_)) {
Level lvt_3_1_ = p_196258_1_.getLevel();
boolean z = lvt_3_1_.hasNeighborSignal(lvt_2_1_) || lvt_3_1_.hasNeighborSignal(lvt_2_1_.above());
return (BlockState) ((BlockState) defaultBlockState().setValue(FACING, p_196258_1_.getHorizontalDirection())).setValue(HALF, DoubleBlockHalf.LOWER);
}
return null;
}
public void setPlacedBy(Level p_180633_1_, BlockPos p_180633_2_, BlockState p_180633_3_, LivingEntity p_180633_4_, ItemStack p_180633_5_) {
p_180633_1_.setBlock(p_180633_2_.above(), (BlockState) p_180633_3_.setValue(HALF, DoubleBlockHalf.UPPER), 3);
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
BlockPos lvt_4_1_ = p_196260_3_.below();
BlockState lvt_5_1_ = p_196260_2_.getBlockState(lvt_4_1_);
return p_196260_1_.getValue(HALF) == DoubleBlockHalf.LOWER ? lvt_5_1_.isFaceSturdy(p_196260_2_, lvt_4_1_, Direction.UP) : lvt_5_1_.is(this);
}
public PushReaction getPistonPushReaction(BlockState p_149656_1_) {
return PushReaction.DESTROY;
}
@OnlyIn(Dist.CLIENT)
public long getSeed(BlockState p_209900_1_, BlockPos p_209900_2_) {
return Mth.getSeed(p_209900_2_.getX(), p_209900_2_.below(p_209900_1_.getValue(HALF) == DoubleBlockHalf.LOWER ? 0 : 1).getY(), p_209900_2_.getZ());
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_206840_1_) {
p_206840_1_.add(new Property[]{HALF, FACING});
}
}

View File

@ -1,66 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.core.CustomBlocks;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/RoadMarkerBlock.class */
public class RoadMarkerBlock extends Block {
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public RoadMarkerBlock(Properties p_i48440_1_) {
super(p_i48440_1_);
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
return Shapes.empty();
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FACING});
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState) defaultBlockState().setValue(FACING, context.getHorizontalDirection());
}
public boolean canSurvive(BlockState blockState, LevelReader world, BlockPos pos) {
if (world.getBlockState(pos.below()).is(CustomBlocks.BLOCK_PAVED_ROAD.get()) || world.getBlockState(pos.below()).is(CustomBlocks.BLOCK_PAVED_ROAD_RAMP.get())) {
return true;
}
return false;
}
@Deprecated
public BlockState updateShape(BlockState bs, Direction dir, BlockState bsUpdater, LevelAccessor world, BlockPos pos, BlockPos updaterPos) {
if (canSurvive(bs, world, pos)) {
return bs;
}
return Blocks.AIR.defaultBlockState();
}
}

View File

@ -1,74 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/RoundTableBlock.class */
public class RoundTableBlock extends StandardHorizontalBlock {
protected static final VoxelShape SHAPE_NORTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(3.0d, 0.0d, 1.0d, 13.0d, 15.0d, 3.0d), Block.box(3.0d, 0.0d, 13.0d, 13.0d, 15.0d, 15.0d), Block.box(0.0d, 15.0d, 0.0d, 16.0d, 16.0d, 16.0d)}).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
protected static final VoxelShape SHAPE_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
public RoundTableBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState) defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, context.getHorizontalDirection());
}
/* renamed from: com.dairymoose.modernlife.blocks.RoundTableBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/RoundTableBlock$1.class */
static /* synthetic */ class C00541 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00541.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,153 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.entity.projectile.ThrownSeedEntity;
import com.dairymoose.modernlife.tileentities.SeedSpreaderBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.List;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.ChestMenu;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.EntityCollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/SeedSpreaderBlock.class */
public class SeedSpreaderBlock extends Block implements EntityBlock {
protected static final VoxelShape SHAPE_NORTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(6.5d, 3.5d, 6.5d, 9.5d, 7.5d, 9.5d), Block.box(3.0d, 10.5d, 3.0d, 13.0d, 13.5d, 13.0d), Block.box(4.0d, 7.5d, 4.0d, 12.0d, 10.5d, 12.0d), Block.box(5.9289321881345245d, 0.0d, 3.0d, 10.071067811865476d, 3.504d, 7.0d), Block.box(5.9289321881345245d, 0.0d, 3.0d, 10.071067811865476d, 3.5d, 7.0d), Block.box(9.0d, 0.0d, 5.9289321881345245d, 13.0d, 3.501d, 10.071067811865476d), Block.box(9.0d, 0.0d, 5.9289321881345245d, 13.0d, 3.5d, 10.071067811865476d), Block.box(5.9289321881345245d, 0.0d, 9.0d, 10.071067811865476d, 3.502d, 13.0d), Block.box(5.9289321881345245d, 0.0d, 9.0d, 10.071067811865476d, 3.5d, 13.0d), Block.box(3.0d, 0.0d, 5.9289321881345245d, 7.0d, 3.503d, 10.071067811865476d), Block.box(3.0d, 0.0d, 5.9289321881345245d, 7.0d, 3.5d, 10.071067811865476d), Block.box(4.0d, 10.6d, 11.75d, 12.0d, 13.25d, 12.75d), Block.box(3.25d, 10.6d, 4.0d, 4.25d, 13.25d, 12.0d), Block.box(4.0d, 10.6d, 3.25d, 12.0d, 13.25d, 4.25d), Block.box(11.75d, 10.6d, 4.0d, 12.75d, 13.25d, 12.0d)}).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
public SeedSpreaderBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Automatically disperses seeds that are put inside of it"));
}
public void onRemove(BlockState p_196243_1_, Level p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_1_.is(p_196243_4_.getBlock())) {
BlockEntity lvt_6_1_ = p_196243_2_.getBlockEntity(p_196243_3_);
if (lvt_6_1_ instanceof SeedSpreaderBlockEntity) {
Containers.dropContents(p_196243_2_, p_196243_3_, (SeedSpreaderBlockEntity) lvt_6_1_);
p_196243_2_.updateNeighbourForOutputSignal(p_196243_3_, this);
}
super.onRemove(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
}
}
/* renamed from: com.dairymoose.modernlife.blocks.SeedSpreaderBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/SeedSpreaderBlock$1.class */
public class C00551 implements MenuProvider {
final /* synthetic */ Level val$p_220052_2_;
final /* synthetic */ BlockPos val$p_220052_3_;
C00551(Level level, BlockPos blockPos) {
p_220052_2_ = level;
p_220052_3_ = blockPos;
}
public AbstractContainerMenu createMenu(int paramInt, Inventory paramInventory, Player paramPlayer) {
BlockEntity tileEntity = p_220052_2_.getBlockEntity(p_220052_3_);
if (tileEntity instanceof SeedSpreaderBlockEntity) {
SeedSpreaderBlockEntity seedSpreaderBlockEntity = (SeedSpreaderBlockEntity) tileEntity;
ChestMenu chest = new ChestMenu(MenuType.GENERIC_9x1, paramInt, paramInventory, seedSpreaderBlockEntity, 1);
if (!paramPlayer.level.isClientSide) {
}
return chest;
}
return null;
}
public Component getDisplayName() {
return new TextComponent("Seed Spreader");
}
}
public MenuProvider getMenuProvider(BlockState p_220052_1_, Level p_220052_2_, BlockPos p_220052_3_) {
return new MenuProvider() { // from class: com.dairymoose.modernlife.blocks.SeedSpreaderBlock.1
final /* synthetic */ Level val$p_220052_2_;
final /* synthetic */ BlockPos val$p_220052_3_;
C00551(Level p_220052_2_2, BlockPos p_220052_3_2) {
p_220052_2_ = p_220052_2_2;
p_220052_3_ = p_220052_3_2;
}
public AbstractContainerMenu createMenu(int paramInt, Inventory paramInventory, Player paramPlayer) {
BlockEntity tileEntity = p_220052_2_.getBlockEntity(p_220052_3_);
if (tileEntity instanceof SeedSpreaderBlockEntity) {
SeedSpreaderBlockEntity seedSpreaderBlockEntity = (SeedSpreaderBlockEntity) tileEntity;
ChestMenu chest = new ChestMenu(MenuType.GENERIC_9x1, paramInt, paramInventory, seedSpreaderBlockEntity, 1);
if (!paramPlayer.level.isClientSide) {
}
return chest;
}
return null;
}
public Component getDisplayName() {
return new TextComponent("Seed Spreader");
}
};
}
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return ModernLifeUtil.createTickerHelper(type, SeedSpreaderBlockEntity.SEED_SPREADER, SeedSpreaderBlockEntity::tick);
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return SeedSpreaderBlockEntity.SEED_SPREADER.create(pos, state);
}
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos p_225533_3_, Player p_225533_4_, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
MenuProvider lvt_7_1_ = getMenuProvider(p_225533_1_, p_225533_2_, p_225533_3_);
if (lvt_7_1_ != null) {
p_225533_4_.openMenu(lvt_7_1_);
}
return InteractionResult.CONSUME;
}
public VoxelShape getCollisionShape(BlockState state, BlockGetter blockReader, BlockPos blockPos, CollisionContext ctx) {
if (ctx instanceof EntityCollisionContext) {
Entity optEntity = ((EntityCollisionContext) ctx).getEntity();
if (optEntity instanceof ThrownSeedEntity) {
return Shapes.empty();
}
}
return super.getCollisionShape(state, blockReader, blockPos, ctx);
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
return SHAPE_NORTH;
}
}

View File

@ -1,110 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.tileentities.ShowerHeadBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/ShowerHeadBlock.class */
public class ShowerHeadBlock extends AbstractWallBlock implements EntityBlock {
protected static final VoxelShape SHAPE_NORTH = (VoxelShape) Stream.of(Block.box(6.5d, 9.0d, 10.75d, 9.5d, 12.0d, 16.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
protected static final VoxelShape SHAPE_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
public ShowerHeadBlock(Properties props) {
super(props);
registerDefaultState((BlockState) this.stateDefinition.any().setValue(AbstractWallBlock.FACING, Direction.SOUTH));
}
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return ModernLifeUtil.createTickerHelper(type, ShowerHeadBlockEntity.SHOWER_HEAD, ShowerHeadBlockEntity::tick);
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return ShowerHeadBlockEntity.SHOWER_HEAD.create(pos, state);
}
public InteractionResult use(BlockState blockState, Level world, BlockPos pos, Player Player, InteractionHand hand, BlockHitResult rayTrace) {
BlockEntity tileEntity = world.getBlockEntity(pos);
if (tileEntity instanceof ShowerHeadBlockEntity) {
ShowerHeadBlockEntity showerHead = (ShowerHeadBlockEntity) tileEntity;
if (!showerHead.isRunning()) {
showerHead.startRunning();
} else {
showerHead.stopRunning();
}
if (!world.isClientSide) {
((ServerLevel) world).sendBlockUpdated(pos, blockState, blockState, 2);
}
}
return InteractionResult.CONSUME;
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{AbstractWallBlock.FACING});
}
/* renamed from: com.dairymoose.modernlife.blocks.ShowerHeadBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/ShowerHeadBlock$1.class */
static /* synthetic */ class C00561 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00561.$SwitchMap$net$minecraft$core$Direction[bs.getValue(AbstractWallBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,143 +0,0 @@
package com.dairymoose.modernlife.blocks;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/SmallTableBlock.class */
public class SmallTableBlock extends Block {
protected static final VoxelShape SHAPE_NORMAL = (VoxelShape) Stream.of(Block.box(0.01d, 0.0d, 0.01d, 15.99d, 16.0d, 15.99d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
public static final EnumProperty<TableType> TYPE = EnumProperty.create("type", TableType.class);
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/SmallTableBlock$TableType.class */
public enum TableType implements StringRepresentable {
single,
mid,
s_end,
w_end,
n_end,
e_end,
ne_corner,
se_corner,
nw_corner,
sw_corner;
public String getSerializedName() {
return name().toLowerCase();
}
}
public SmallTableBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
registerDefaultState((BlockState) defaultBlockState().setValue(TYPE, TableType.single));
}
public SmallTableBlock(Properties p_i48377_1_, boolean skipDefaultState) {
super(p_i48377_1_);
if (!skipDefaultState) {
registerDefaultState((BlockState) defaultBlockState().setValue(TYPE, TableType.single));
}
}
public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 20;
}
return 0;
}
public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 5;
}
return 0;
}
public BlockState updateShape(BlockState state, Direction dir, BlockState updater, LevelAccessor world, BlockPos pos, BlockPos updaterPos) {
return getNewState(world, pos);
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{TYPE});
}
protected BlockState getNewState(LevelAccessor world, BlockPos pos) {
BlockState nState = world.getBlockState(pos.north());
BlockState eState = world.getBlockState(pos.east());
BlockState sState = world.getBlockState(pos.south());
BlockState wState = world.getBlockState(pos.west());
int adjacentTableCount = 0;
boolean nTable = nState.is(this);
boolean eTable = eState.is(this);
boolean sTable = sState.is(this);
boolean wTable = wState.is(this);
if (nTable) {
adjacentTableCount = 0 + 1;
}
if (eTable) {
adjacentTableCount++;
}
if (sTable) {
adjacentTableCount++;
}
if (wTable) {
adjacentTableCount++;
}
if (adjacentTableCount >= 2) {
if (nTable && eTable && !sTable && !wTable) {
return (BlockState) defaultBlockState().setValue(TYPE, TableType.sw_corner);
}
if (nTable && wTable && !sTable && !eTable) {
return (BlockState) defaultBlockState().setValue(TYPE, TableType.se_corner);
}
if (sTable && eTable && !nTable && !wTable) {
return (BlockState) defaultBlockState().setValue(TYPE, TableType.nw_corner);
}
if (sTable && wTable && !nTable && !eTable) {
return (BlockState) defaultBlockState().setValue(TYPE, TableType.ne_corner);
}
return (BlockState) defaultBlockState().setValue(TYPE, TableType.mid);
}
if (adjacentTableCount == 1) {
if (nTable) {
return (BlockState) defaultBlockState().setValue(TYPE, TableType.s_end);
}
if (eTable) {
return (BlockState) defaultBlockState().setValue(TYPE, TableType.w_end);
}
if (sTable) {
return (BlockState) defaultBlockState().setValue(TYPE, TableType.n_end);
}
if (wTable) {
return (BlockState) defaultBlockState().setValue(TYPE, TableType.e_end);
}
}
return defaultBlockState();
}
@Nullable
public BlockState getStateForPlacement(BlockPlaceContext context) {
return getNewState(context.getLevel(), context.getClickedPos());
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
return SHAPE_NORMAL;
}
}

View File

@ -1,252 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.entity.DummyEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/SofaBlock.class */
public class SofaBlock extends Block {
protected static final VoxelShape SHAPE_SOUTH_SINGLE = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(0.0d, 0.0d, 0.0d, 16.0d, 17.0d, 3.0d), Block.box(13.0d, 0.0d, 3.0d, 16.0d, 11.0d, 16.0d), Block.box(3.0d, 0.0d, 3.0d, 13.0d, 4.0d, 16.0d), Block.box(3.25d, 4.0d, 4.0d, 12.75d, 7.0d, 15.0d), Block.box(0.0d, 0.0d, 3.0d, 3.0d, 11.0d, 16.0d)}).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST_SINGLE = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH_SINGLE);
protected static final VoxelShape SHAPE_NORTH_SINGLE = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST_SINGLE);
protected static final VoxelShape SHAPE_EAST_SINGLE = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH_SINGLE);
protected static final VoxelShape SHAPE_SOUTH_MIDDLE = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(0.0d, 0.0d, 0.0d, 16.0d, 17.0d, 3.0d), Block.box(0.0d, 0.0d, 3.0d, 16.0d, 4.0d, 16.0d), Block.box(0.0d, 4.0d, 4.0d, 16.0d, 7.0d, 15.0d)}).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST_MIDDLE = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH_MIDDLE);
protected static final VoxelShape SHAPE_NORTH_MIDDLE = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST_MIDDLE);
protected static final VoxelShape SHAPE_EAST_MIDDLE = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH_MIDDLE);
protected static final VoxelShape SHAPE_SOUTH_LEFT = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(0.0d, 0.0d, 0.0d, 16.0d, 17.0d, 3.0d), Block.box(0.0d, 0.0d, 3.0d, 3.0d, 11.0d, 16.0d), Block.box(3.0d, 0.0d, 3.0d, 16.0d, 4.0d, 16.0d), Block.box(3.25d, 4.0d, 4.0d, 16.0d, 7.0d, 15.0d)}).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST_LEFT = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH_LEFT);
protected static final VoxelShape SHAPE_NORTH_LEFT = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST_LEFT);
protected static final VoxelShape SHAPE_EAST_LEFT = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH_LEFT);
protected static final VoxelShape SHAPE_SOUTH_RIGHT = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(13.0d, 0.0d, 3.0d, 16.0d, 11.0d, 16.0d), Block.box(0.0d, 0.0d, 0.0d, 16.0d, 17.0d, 3.0d), Block.box(0.0d, 0.0d, 3.0d, 13.0d, 4.0d, 16.0d), Block.box(0.0d, 4.0d, 4.0d, 12.75d, 7.0d, 15.0d)}).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST_RIGHT = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH_RIGHT);
protected static final VoxelShape SHAPE_NORTH_RIGHT = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST_RIGHT);
protected static final VoxelShape SHAPE_EAST_RIGHT = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH_RIGHT);
protected static final VoxelShape SHAPE_SOUTH_CORNER = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(3.0d, 0.0d, 3.0d, 16.0d, 4.0d, 16.0d), Block.box(4.0d, 4.0d, 4.0d, 15.0d, 7.0d, 16.0d), Block.box(0.0d, 0.0d, 0.0d, 16.0d, 17.0d, 3.0d), Block.box(0.0d, 0.0d, 3.0d, 3.0d, 17.0d, 16.0d), Block.box(15.0d, 4.0d, 4.0d, 16.0d, 7.0d, 15.0d)}).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST_CORNER = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH_CORNER);
protected static final VoxelShape SHAPE_NORTH_CORNER = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST_CORNER);
protected static final VoxelShape SHAPE_EAST_CORNER = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH_CORNER);
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public static final EnumProperty<SofaType> TYPE = EnumProperty.create("type", SofaType.class);
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/SofaBlock$SofaType.class */
public enum SofaType implements StringRepresentable {
single,
middle,
left,
right,
corner;
public String getSerializedName() {
return name().toLowerCase();
}
}
public SofaBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
registerDefaultState((BlockState) ((BlockState) getStateDefinition().any().setValue(FACING, Direction.NORTH)).setValue(TYPE, SofaType.single));
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos p_225533_3_, Player player, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
if (!p_225533_2_.isClientSide) {
DummyEntity dummy = DummyEntity.getEntity(0.23f, p_225533_2_, p_225533_3_, false);
dummy.ride(player);
}
return InteractionResult.CONSUME;
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
Direction newFacing = context.getHorizontalDirection().getOpposite();
BlockState state = getNewState(null, context.getLevel(), context.getClickedPos(), newFacing);
if (state == null) {
state = defaultBlockState();
}
return (BlockState) state.setValue(FACING, newFacing);
}
public BlockState updateShape(BlockState state, Direction dir, BlockState updater, LevelAccessor world, BlockPos pos, BlockPos updaterPos) {
return getNewState(state, world, pos, (Direction) state.getValue(FACING));
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FACING, TYPE});
}
private BlockState getNewState(BlockState currentState, LevelAccessor world, BlockPos pos, Direction facing) {
BlockState adjacentSofa;
if (currentState == null) {
currentState = defaultBlockState();
}
BlockState cwState = world.getBlockState(pos.relative(facing.getClockWise()));
BlockState ccwState = world.getBlockState(pos.relative(facing.getCounterClockWise()));
BlockState frontState = world.getBlockState(pos.relative(facing));
int adjacentSofaCount = 0;
boolean cwSofa = cwState.is(this) && (cwState.getValue(FACING) == facing || cwState.getValue(TYPE) == SofaType.corner);
boolean ccwSofa = ccwState.is(this) && (ccwState.getValue(FACING) == facing || ccwState.getValue(TYPE) == SofaType.corner);
boolean frontSofa = frontState.is(this);
if (cwSofa) {
adjacentSofaCount = 0 + 1;
}
if (ccwSofa) {
adjacentSofaCount++;
}
if (adjacentSofaCount >= 2) {
return (BlockState) currentState.setValue(TYPE, SofaType.middle);
}
if (adjacentSofaCount == 1) {
if (frontSofa) {
if (cwState.is(this)) {
adjacentSofa = cwState;
} else {
adjacentSofa = ccwState;
}
if (adjacentSofa.getValue(FACING) == facing) {
Direction withDirection = facing;
if (adjacentSofa != ccwState) {
withDirection = (Direction) frontState.getValue(FACING);
}
return (BlockState) ((BlockState) currentState.setValue(TYPE, SofaType.corner)).setValue(FACING, withDirection);
}
}
if (cwSofa) {
return (BlockState) currentState.setValue(TYPE, SofaType.right);
}
if (ccwSofa) {
return (BlockState) currentState.setValue(TYPE, SofaType.left);
}
}
return (BlockState) currentState.setValue(TYPE, SofaType.single);
}
/* renamed from: com.dairymoose.modernlife.blocks.SofaBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/SofaBlock$1.class */
static /* synthetic */ class C00571 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
if (bs.getValue(TYPE) == SofaType.single) {
switch (C00571.$SwitchMap$net$minecraft$core$Direction[bs.getValue(FACING).ordinal()]) {
case 1:
return SHAPE_NORTH_SINGLE;
case 2:
return SHAPE_SOUTH_SINGLE;
case 3:
return SHAPE_EAST_SINGLE;
case 4:
return SHAPE_WEST_SINGLE;
}
}
if (bs.getValue(TYPE) == SofaType.middle) {
switch (C00571.$SwitchMap$net$minecraft$core$Direction[bs.getValue(FACING).ordinal()]) {
case 1:
return SHAPE_NORTH_MIDDLE;
case 2:
return SHAPE_SOUTH_MIDDLE;
case 3:
return SHAPE_EAST_MIDDLE;
case 4:
return SHAPE_WEST_MIDDLE;
}
}
if (bs.getValue(TYPE) == SofaType.left) {
switch (C00571.$SwitchMap$net$minecraft$core$Direction[bs.getValue(FACING).ordinal()]) {
case 1:
return SHAPE_NORTH_LEFT;
case 2:
return SHAPE_SOUTH_LEFT;
case 3:
return SHAPE_EAST_LEFT;
case 4:
return SHAPE_WEST_LEFT;
}
}
if (bs.getValue(TYPE) == SofaType.right) {
switch (C00571.$SwitchMap$net$minecraft$core$Direction[bs.getValue(FACING).ordinal()]) {
case 1:
return SHAPE_NORTH_RIGHT;
case 2:
return SHAPE_SOUTH_RIGHT;
case 3:
return SHAPE_EAST_RIGHT;
case 4:
return SHAPE_WEST_RIGHT;
}
}
if (bs.getValue(TYPE) == SofaType.corner) {
switch (C00571.$SwitchMap$net$minecraft$core$Direction[bs.getValue(FACING).ordinal()]) {
case 1:
return SHAPE_NORTH_CORNER;
case 2:
return SHAPE_SOUTH_CORNER;
case 3:
return SHAPE_EAST_CORNER;
case 4:
return SHAPE_WEST_CORNER;
}
}
return SHAPE_NORTH_SINGLE;
}
}

View File

@ -1,28 +0,0 @@
package com.dairymoose.modernlife.blocks;
import javax.annotation.Nullable;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.Property;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/StandardHorizontalBlock.class */
public class StandardHorizontalBlock extends HorizontalDirectionalBlock {
public StandardHorizontalBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
registerDefaultState((BlockState) defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, Direction.NORTH));
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{HorizontalDirectionalBlock.FACING});
}
@Nullable
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState) defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, context.getHorizontalDirection().getOpposite());
}
}

View File

@ -1,168 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.core.CustomBlocks;
import com.dairymoose.modernlife.tileentities.StoveBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.Optional;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.SimpleContainer;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.item.crafting.CampfireCookingRecipe;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/StoveBlock.class */
public class StoveBlock extends StandardHorizontalBlock implements EntityBlock {
protected static final VoxelShape SHAPE_NORTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(0.0d, 12.75d, 0.0d, 16.0d, 16.0d, 1.5d), Block.box(0.0d, 0.0d, 0.0d, 16.0d, 12.75d, 15.5d)}).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
protected static final VoxelShape SHAPE_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
public static final BooleanProperty OPEN_DOOR = BooleanProperty.create("open_door");
public StoveBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
registerDefaultState((BlockState) super.defaultBlockState().setValue(OPEN_DOOR, false));
}
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return ModernLifeUtil.createTickerHelper(type, StoveBlockEntity.STOVE, StoveBlockEntity::tick);
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
StoveBlockEntity toReturn = (StoveBlockEntity) StoveBlockEntity.STOVE.create(pos, state);
return toReturn;
}
public void onRemove(BlockState newBlockState, Level world, BlockPos pos, BlockState oldBlockState, boolean b) {
if (!newBlockState.is(oldBlockState.getBlock())) {
BlockEntity tileEntity = world.getBlockEntity(pos);
if (tileEntity instanceof StoveBlockEntity) {
Containers.dropContents(world, pos, (StoveBlockEntity) tileEntity);
world.updateNeighbourForOutputSignal(pos, this);
}
super.onRemove(newBlockState, world, pos, oldBlockState, b);
}
}
public static int calculateTime(Optional<CampfireCookingRecipe> optionalCookingRecipe) {
if (optionalCookingRecipe.isPresent()) {
return (int) (optionalCookingRecipe.get().m_43753_() / 1.5f);
}
return 0;
}
public InteractionResult use(BlockState blockState, Level world, BlockPos blockPos, Player player, InteractionHand hand, BlockHitResult rayTrace) {
int slot;
if (!world.isClientSide) {
if (blockState.is(CustomBlocks.BLOCK_STOVE.get()) && !((Boolean) blockState.getValue(OPEN_DOOR)).booleanValue()) {
world.setBlockAndUpdate(blockPos, (BlockState) blockState.setValue(OPEN_DOOR, true));
} else {
ItemStack itemStack = player.getItemInHand(hand);
BlockEntity tileEntity = world.getBlockEntity(blockPos);
StoveBlockEntity stoveBlockEntity = null;
if (tileEntity instanceof StoveBlockEntity) {
stoveBlockEntity = (StoveBlockEntity) tileEntity;
}
boolean tookItem = false;
boolean placedItem = false;
if (!itemStack.isEmpty()) {
Optional<CampfireCookingRecipe> optional = world.getRecipeManager().getRecipeFor(RecipeType.CAMPFIRE_COOKING, new SimpleContainer(new ItemStack[]{itemStack}), world);
if (optional.isPresent() && stoveBlockEntity != null && !stoveBlockEntity.isFull()) {
ItemStack oneItem = itemStack.split(1);
stoveBlockEntity.cookItem(oneItem, calculateTime(optional));
placedItem = true;
}
} else if (stoveBlockEntity != null && !stoveBlockEntity.isEmpty() && player.isSteppingCarefully() && (slot = stoveBlockEntity.getNextOccupiedSlot()) != -1) {
player.addItem(stoveBlockEntity.getItem(slot).copy());
stoveBlockEntity.setItem(slot, ItemStack.EMPTY);
tookItem = true;
}
if (!tookItem && !placedItem) {
world.setBlockAndUpdate(blockPos, (BlockState) blockState.setValue(OPEN_DOOR, false));
} else {
stoveBlockEntity.setChanged();
if (!tookItem && stoveBlockEntity.isFull()) {
world.setBlockAndUpdate(blockPos, (BlockState) blockState.setValue(OPEN_DOOR, false));
}
}
world.sendBlockUpdated(blockPos, blockState, blockState, 2);
}
}
return InteractionResult.CONSUME;
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{HorizontalDirectionalBlock.FACING, OPEN_DOOR});
}
/* renamed from: com.dairymoose.modernlife.blocks.StoveBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/StoveBlock$1.class */
static /* synthetic */ class C00581 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00581.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState) defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, context.getHorizontalDirection());
}
}

View File

@ -1,246 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.core.ModernLifeConfig;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.Mth;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/StreetLightBlock.class */
public class StreetLightBlock extends Block {
private static final Logger LOGGER = LogManager.getLogger();
protected static final VoxelShape SHAPE_NORTH = Block.box(4.0d, 0.0d, 4.0d, 12.0d, 16.0d, 12.0d);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
protected static final VoxelShape SHAPE_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH_TOP = Block.box(4.0d, 0.0d, 4.0d, 12.0d, 12.0d, 12.0d);
protected static final VoxelShape SHAPE_EAST_TOP = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH_TOP);
protected static final VoxelShape SHAPE_SOUTH_TOP = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST_TOP);
protected static final VoxelShape SHAPE_WEST_TOP = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH_TOP);
public static int MID_PART_COUNT = 3;
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
public static final EnumProperty<PartType> PART = EnumProperty.create("part", PartType.class);
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/StreetLightBlock$PartType.class */
public enum PartType implements StringRepresentable {
bottom,
mid,
top;
public String getSerializedName() {
return name().toLowerCase();
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: com.dairymoose.modernlife.blocks.StreetLightBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/StreetLightBlock$1.class */
public class C00591 implements StatePredicate {
C00591() {
}
public boolean test(BlockState state, BlockGetter reader, BlockPos pos) {
if (state.getValue(StreetLightBlock.PART) == PartType.top) {
return true;
}
return false;
}
}
public StreetLightBlock(Properties props) {
super(props.lightLevel(StreetLightBlock::getLightLevel).emissiveRendering(new StatePredicate() { // from class: com.dairymoose.modernlife.blocks.StreetLightBlock.1
C00591() {
}
public boolean test(BlockState state, BlockGetter reader, BlockPos pos) {
if (state.getValue(StreetLightBlock.PART) == PartType.top) {
return true;
}
return false;
}
}));
registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any().setValue(FACING, Direction.NORTH)).setValue(PART, PartType.bottom));
}
public static int getLightLevel(BlockState state) {
if (state.getValue(PART) == PartType.top) {
return 15;
}
return 0;
}
public VoxelShape getShape(BlockState p_220053_1_, BlockGetter p_220053_2_, BlockPos p_220053_3_, CollisionContext p_220053_4_) {
if (p_220053_1_.getValue(PART) == PartType.top) {
return SHAPE_NORTH_TOP;
}
Direction lvt_5_1_ = p_220053_1_.getValue(FACING);
switch (C00602.$SwitchMap$net$minecraft$core$Direction[lvt_5_1_.ordinal()]) {
case 1:
default:
return SHAPE_SOUTH;
case 2:
return SHAPE_EAST;
case 3:
return SHAPE_WEST;
case 4:
return SHAPE_NORTH;
}
}
/* renamed from: com.dairymoose.modernlife.blocks.StreetLightBlock$2 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/StreetLightBlock$2.class */
static /* synthetic */ class C00602 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
PartType lvt_7_1_ = (PartType) p_196271_1_.getValue(PART);
if (lvt_7_1_ == PartType.mid) {
if ((p_196271_2_ == Direction.UP || p_196271_2_ == Direction.DOWN) && !p_196271_3_.is(this)) {
return Blocks.AIR.defaultBlockState();
}
return super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
if (p_196271_2_.getAxis() == Direction.Axis.Y) {
if ((lvt_7_1_ == PartType.bottom) == (p_196271_2_ == Direction.UP)) {
if (lvt_7_1_ != PartType.top) {
return (!p_196271_3_.is(this) || p_196271_3_.getValue(PART) == lvt_7_1_) ? Blocks.AIR.defaultBlockState() : (BlockState) p_196271_1_.setValue(FACING, p_196271_3_.getValue(FACING));
}
if (p_196271_3_.is(this)) {
return p_196271_1_;
}
return Blocks.AIR.defaultBlockState();
}
}
return (lvt_7_1_ == PartType.bottom && p_196271_2_ == Direction.DOWN && !p_196271_1_.canSurvive(p_196271_4_, p_196271_5_)) ? Blocks.AIR.defaultBlockState() : super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
protected static void preventCreativeDropFromBottomPart(Level p_241471_0_, BlockPos p_241471_1_, BlockState p_241471_2_, Player p_241471_3_) {
PartType doubleblockhalf = (PartType) p_241471_2_.getValue(PART);
if (doubleblockhalf == PartType.mid || doubleblockhalf == PartType.top) {
BlockPos blockpos = p_241471_1_.below();
BlockState blockstate = p_241471_0_.getBlockState(blockpos);
if (blockstate.getBlock() == p_241471_2_.getBlock() && blockstate.getValue(PART) == PartType.bottom) {
p_241471_0_.setBlock(blockpos, Blocks.AIR.defaultBlockState(), 35);
p_241471_0_.levelEvent(p_241471_3_, 2001, blockpos, Block.getId(blockstate));
}
}
}
public void playerWillDestroy(Level p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, Player p_176208_4_) {
if (!p_176208_1_.isClientSide && p_176208_4_.isCreative()) {
preventCreativeDropFromBottomPart(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
super.playerWillDestroy(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
public BlockState rotate(BlockState p_52790_, Rotation p_52791_) {
return (BlockState) p_52790_.setValue(FACING, p_52791_.rotate(p_52790_.getValue(FACING)));
}
public BlockState mirror(BlockState p_52787_, Mirror p_52788_) {
return p_52788_ == Mirror.NONE ? p_52787_ : p_52787_.rotate(p_52788_.getRotation(p_52787_.getValue(FACING)));
}
@Nullable
public BlockState getStateForPlacement(BlockPlaceContext p_196258_1_) {
BlockPos lvt_2_1_ = p_196258_1_.getClickedPos();
if (lvt_2_1_.getY() < p_196258_1_.getLevel().getMaxBuildHeight() && p_196258_1_.getLevel().getBlockState(lvt_2_1_.above()).canBeReplaced(p_196258_1_)) {
p_196258_1_.getLevel();
return (BlockState) ((BlockState) defaultBlockState().setValue(FACING, p_196258_1_.getHorizontalDirection().getOpposite())).setValue(PART, PartType.bottom);
}
return null;
}
public void setPlacedBy(Level p_180633_1_, BlockPos p_180633_2_, BlockState p_180633_3_, LivingEntity p_180633_4_, ItemStack p_180633_5_) {
Integer configPartCount = (Integer) ModernLifeConfig.SERVER.streetLightMiddlePartCount.get();
if (configPartCount != null) {
MID_PART_COUNT = configPartCount.intValue();
}
p_180633_1_.setBlock(p_180633_2_.above(MID_PART_COUNT + 1), (BlockState) p_180633_3_.setValue(PART, PartType.top), 3);
for (int i = 0; i < MID_PART_COUNT; i++) {
int aboveIdx = MID_PART_COUNT - i;
p_180633_1_.setBlock(p_180633_2_.above(aboveIdx), (BlockState) p_180633_3_.setValue(PART, PartType.mid), 3);
}
}
public boolean hasXairBlocksAbove(LevelReader world, BlockPos pos, int x) {
BlockPos currentPos = pos;
for (int i = 0; i < x; i++) {
currentPos = currentPos.above();
if (!world.getBlockState(currentPos).isAir()) {
return false;
}
}
return true;
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
BlockPos lvt_4_1_ = p_196260_3_.below();
BlockState lvt_5_1_ = p_196260_2_.getBlockState(lvt_4_1_);
if (p_196260_1_.getValue(PART) == PartType.bottom) {
return lvt_5_1_.isFaceSturdy(p_196260_2_, lvt_4_1_, Direction.UP) && hasXairBlocksAbove(p_196260_2_, p_196260_3_, MID_PART_COUNT + 1);
}
return lvt_5_1_.is(this);
}
public PushReaction getPistonPushReaction(BlockState p_149656_1_) {
return PushReaction.DESTROY;
}
@OnlyIn(Dist.CLIENT)
public long getSeed(BlockState p_209900_1_, BlockPos p_209900_2_) {
return Mth.getSeed(p_209900_2_.getX(), p_209900_2_.below(p_209900_1_.getValue(PART) == PartType.bottom ? 0 : 1).getY(), p_209900_2_.getZ());
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_206840_1_) {
p_206840_1_.add(new Property[]{PART, FACING});
}
}

View File

@ -1,146 +0,0 @@
package com.dairymoose.modernlife.blocks;
import java.util.List;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.AttachFace;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/TileLightBlock.class */
public class TileLightBlock extends FaceAttachedHorizontalDirectionalBlock {
protected static final VoxelShape SHAPE_NORTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(5.0d, 15.0d, 5.0d, 11.0d, 16.0d, 11.0d), Block.box(5.5d, 14.0d, 5.5d, 10.5d, 15.0d, 10.5d)}).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Requires redstone power to operate"));
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: com.dairymoose.modernlife.blocks.TileLightBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/TileLightBlock$1.class */
public class C00611 implements StatePredicate {
C00611() {
}
public boolean test(BlockState state, BlockGetter reader, BlockPos pos) {
if (((Boolean) state.getValue(TileLightBlock.POWERED)).booleanValue()) {
return true;
}
return false;
}
}
public TileLightBlock(Properties props) {
super(props.lightLevel(LightBulbBlock::getLightLevel).emissiveRendering(new StatePredicate() { // from class: com.dairymoose.modernlife.blocks.TileLightBlock.1
C00611() {
}
public boolean test(BlockState state, BlockGetter reader, BlockPos pos) {
if (((Boolean) state.getValue(TileLightBlock.POWERED)).booleanValue()) {
return true;
}
return false;
}
}));
registerDefaultState((BlockState) ((BlockState) ((BlockState) this.stateDefinition.any().setValue(FaceAttachedHorizontalDirectionalBlock.FACE, AttachFace.CEILING)).setValue(HorizontalDirectionalBlock.FACING, Direction.NORTH)).setValue(POWERED, false));
}
public BlockState rotate(BlockState state, Rotation rotation) {
return state;
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state;
}
public static int getLightLevel(BlockState state) {
if (((Boolean) state.getValue(POWERED)).booleanValue()) {
return 15;
}
return 0;
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
BlockPos pos = context.getClickedPos();
boolean signal = context.getLevel().hasNeighborSignal(pos);
return (BlockState) defaultBlockState().setValue(POWERED, Boolean.valueOf(signal));
}
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block block, BlockPos neighborPos, boolean p_220069_6_) {
boolean signal = world.hasNeighborSignal(pos);
if (block != this && signal != ((Boolean) state.getValue(POWERED)).booleanValue()) {
world.setBlock(pos, (BlockState) state.setValue(POWERED, Boolean.valueOf(signal)), 2);
}
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FaceAttachedHorizontalDirectionalBlock.FACE, HorizontalDirectionalBlock.FACING, POWERED});
}
/* renamed from: com.dairymoose.modernlife.blocks.TileLightBlock$2 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/TileLightBlock$2.class */
static /* synthetic */ class C00622 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00622.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_NORTH;
case 3:
return SHAPE_NORTH;
case 4:
return SHAPE_NORTH;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,151 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.entity.DummyEntity;
import com.dairymoose.modernlife.tileentities.ToiletBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.material.WaterFluid;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/ToiletBlock.class */
public class ToiletBlock extends StandardHorizontalBlock implements SimpleWaterloggedBlock, EntityBlock {
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(10.5d, 0.0d, 5.0d, 11.5d, 1.0d, 13.0d), Block.box(5.5d, 0.0d, 14.0d, 6.5d, 1.0d, 15.0d), Block.box(9.5d, 0.0d, 14.0d, 10.5d, 1.0d, 15.0d), Block.box(10.5d, 0.0d, 13.0d, 11.5d, 1.0d, 14.0d), Block.box(4.5d, 0.0d, 13.0d, 5.5d, 1.0d, 14.0d), Block.box(9.5d, 0.0d, 3.0d, 10.5d, 1.0d, 4.0d), Block.box(5.5d, 0.0d, 3.0d, 6.5d, 1.0d, 4.0d), Block.box(4.5d, 0.0d, 4.0d, 5.5d, 1.0d, 5.0d), Block.box(10.5d, 0.0d, 4.0d, 11.5d, 1.0d, 5.0d), Block.box(6.5d, 0.0d, 2.0d, 9.5d, 1.0d, 3.0d), Block.box(6.5d, 0.0d, 15.0d, 9.5d, 1.0d, 16.0d), Block.box(11.5d, 0.0d, 11.0d, 12.5d, 1.0d, 13.0d), Block.box(3.5d, 0.0d, 11.0d, 4.5d, 1.0d, 13.0d), Block.box(11.5d, 0.0d, 11.0d, 12.5d, 1.0d, 13.0d), Block.box(12.5d, 0.0d, 7.0d, 13.5d, 1.0d, 11.0d), Block.box(2.5d, 0.0d, 7.0d, 3.5d, 1.0d, 11.0d), Block.box(3.5d, 0.0d, 5.0d, 4.5d, 1.0d, 7.0d), Block.box(11.5d, 0.0d, 5.0d, 12.5d, 1.0d, 7.0d), Block.box(5.5d, 1.0d, 13.0d, 6.5d, 3.0d, 14.0d), Block.box(6.5d, 1.0d, 14.0d, 9.5d, 3.0d, 15.0d), Block.box(9.5d, 1.0d, 13.0d, 10.5d, 3.0d, 14.0d), Block.box(10.5d, 1.0d, 12.0d, 11.5d, 3.0d, 13.0d), Block.box(11.5d, 1.0d, 6.0d, 12.5d, 3.0d, 11.0d), Block.box(11.5d, 1.0d, 11.0d, 12.5d, 3.0d, 13.0d), Block.box(4.5d, 1.0d, 12.0d, 5.5d, 3.0d, 13.0d), Block.box(9.5d, 1.0d, 4.0d, 10.5d, 3.0d, 5.0d), Block.box(5.5d, 1.0d, 4.0d, 6.5d, 3.0d, 5.0d), Block.box(6.5d, 1.0d, 3.0d, 9.5d, 3.0d, 4.0d), Block.box(4.5d, 1.0d, 5.0d, 5.5d, 3.0d, 6.0d), Block.box(3.5d, 1.0d, 6.0d, 4.5d, 3.0d, 11.0d), Block.box(10.5d, 1.0d, 5.0d, 11.5d, 3.0d, 6.0d), Block.box(3.5d, 1.0d, 11.0d, 4.5d, 3.0d, 13.0d), Block.box(5.5d, 3.0d, 12.0d, 6.5d, 6.0d, 13.0d), Block.box(6.5d, 3.0d, 13.0d, 9.5d, 6.0d, 14.0d), Block.box(9.5d, 3.0d, 12.0d, 10.5d, 6.0d, 13.0d), Block.box(10.5d, 3.0d, 11.0d, 11.5d, 6.0d, 12.0d), Block.box(10.5d, 3.0d, 6.0d, 11.5d, 6.0d, 11.0d), Block.box(4.5d, 3.0d, 11.0d, 5.5d, 6.0d, 12.0d), Block.box(9.5d, 3.0d, 5.0d, 10.5d, 6.0d, 6.0d), Block.box(5.5d, 3.0d, 5.0d, 6.5d, 6.0d, 6.0d), Block.box(6.5d, 3.0d, 4.0d, 9.5d, 6.0d, 6.0d), Block.box(4.5d, 3.0d, 6.0d, 5.5d, 6.0d, 11.0d), Block.box(4.0d, 8.0d, 0.0d, 12.0d, 15.0d, 4.0d), Block.box(6.0d, 4.0d, 0.0d, 10.0d, 8.0d, 3.0d), Block.box(6.0d, 4.0d, 3.0d, 10.0d, 6.0d, 4.0d), Block.box(4.25d, 13.5d, 4.0d, 5.25d, 14.5d, 5.0d), Block.box(3.0d, 15.0d, 0.0d, 13.0d, 16.0d, 5.0d), Block.box(5.5d, 3.0d, 12.0d, 6.5d, 6.0d, 13.0d), Block.box(6.5d, 3.0d, 13.0d, 9.5d, 6.0d, 14.0d), Block.box(9.5d, 3.0d, 12.0d, 10.5d, 6.0d, 13.0d), Block.box(10.5d, 3.0d, 11.0d, 11.5d, 6.0d, 12.0d), Block.box(10.5d, 3.0d, 6.0d, 11.5d, 6.0d, 11.0d), Block.box(4.5d, 3.0d, 11.0d, 5.5d, 6.0d, 12.0d), Block.box(9.5d, 3.0d, 5.0d, 10.5d, 6.0d, 6.0d), Block.box(5.5d, 3.0d, 5.0d, 6.5d, 6.0d, 6.0d), Block.box(6.5d, 3.0d, 4.0d, 9.5d, 6.0d, 5.0d), Block.box(4.5d, 3.0d, 6.0d, 5.5d, 6.0d, 11.0d), Block.box(2.25d, 13.75d, 4.0d, 4.25d, 14.25d, 5.0d), Block.box(5.0d, 6.0d, 6.0d, 11.0d, 7.0d, 13.0d), Block.box(5.25d, 7.0d, 6.0d, 10.75d, 14.0d, 6.5d), Block.box(5.5d, 0.0d, 4.0d, 10.5d, 1.0d, 14.0d), Block.box(4.5d, 0.0d, 5.0d, 5.5d, 1.0d, 13.0d), Block.box(5.5d, 1.0d, 5.0d, 10.5d, 3.0d, 13.0d), Block.box(5.25d, 6.0d, 6.25d, 5.5d, 6.9d, 12.75d), Block.box(10.5d, 6.0d, 6.25d, 10.75d, 6.9d, 12.75d), Block.box(5.25d, 6.0d, 12.5d, 10.75d, 6.9d, 12.75d), Block.box(5.25d, 6.0d, 6.25d, 10.75d, 6.9d, 6.5d)}).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public static long lastFlushTimestampServer = 0;
public static long lastFlushTimestampClient = 0;
public ToiletBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
registerDefaultState((BlockState) ((BlockState) defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, Direction.NORTH)).setValue(WATERLOGGED, false));
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
if (((Boolean) p_196271_1_.getValue(WATERLOGGED)).booleanValue()) {
p_196271_4_.scheduleTick(p_196271_5_, Fluids.WATER, Fluids.WATER.getTickDelay(p_196271_4_));
}
return super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return ModernLifeUtil.createTickerHelper(type, ToiletBlockEntity.TOILET, ToiletBlockEntity::tick);
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return ToiletBlockEntity.TOILET.create(pos, state);
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
public BlockState getStateForPlacement(BlockPlaceContext context) {
BlockState superState = super.getStateForPlacement(context);
if (superState == null) {
superState = defaultBlockState();
}
BlockState state = context.getLevel().getBlockState(context.getClickedPos());
if ((state.getFluidState().getType() instanceof WaterFluid) && state.getFluidState().isSource()) {
superState.setValue(WATERLOGGED, true);
}
return superState;
}
public FluidState getFluidState(BlockState p_204507_1_) {
if (((Boolean) p_204507_1_.getValue(WATERLOGGED)).booleanValue()) {
return Fluids.WATER.getSource(false);
}
return super.getFluidState(p_204507_1_);
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{HorizontalDirectionalBlock.FACING, WATERLOGGED});
}
public InteractionResult use(BlockState blockState, Level world, BlockPos pos, Player Player, InteractionHand hand, BlockHitResult rayTrace) {
if (Player.getMainHandItem() != null && Player.getMainHandItem().getItem() != Items.BUCKET) {
if (Player.isSteppingCarefully()) {
BlockEntity tileEntity = world.getBlockEntity(pos);
if (tileEntity instanceof ToiletBlockEntity) {
ToiletBlockEntity toiletEntity = (ToiletBlockEntity) tileEntity;
toiletEntity.flush(blockState, world, pos, Player, hand, rayTrace);
return InteractionResult.CONSUME;
}
} else if (!world.isClientSide) {
DummyEntity dummy = DummyEntity.getEntity(0.22f, world, pos, false);
dummy.ride(Player);
}
}
return super.use(blockState, world, pos, Player, hand, rayTrace);
}
/* renamed from: com.dairymoose.modernlife.blocks.ToiletBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/ToiletBlock$1.class */
static /* synthetic */ class C00631 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00631.$SwitchMap$net$minecraft$core$Direction[bs.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,170 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.inventory.container.TrashCanContainer;
import com.dairymoose.modernlife.tileentities.TrashCanBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.List;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/TrashCanBlock.class */
public class TrashCanBlock extends Block implements EntityBlock {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of(Block.box(2.0d, 0.0d, 2.0d, 14.0d, 16.0d, 14.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Items inserted into the trash slot will be deleted when the trash can is full"));
}
public TrashCanBlock() {
super(Properties.of(Material.WOOD).sound(SoundType.WOOD).strength(1.5f));
registerDefaultState((BlockState) this.stateDefinition.any().setValue(FACING, Direction.SOUTH));
}
public TrashCanBlock(Properties props) {
super(props);
registerDefaultState((BlockState) this.stateDefinition.any().setValue(FACING, Direction.SOUTH));
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
public void onRemove(BlockState p_196243_1_, Level p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_1_.is(p_196243_4_.getBlock())) {
BlockEntity lvt_6_1_ = p_196243_2_.getBlockEntity(p_196243_3_);
if (lvt_6_1_ instanceof TrashCanBlockEntity) {
Containers.dropContents(p_196243_2_, p_196243_3_, (TrashCanBlockEntity) lvt_6_1_);
p_196243_2_.updateNeighbourForOutputSignal(p_196243_3_, this);
}
super.onRemove(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
}
}
public MenuProvider getMenuProvider(BlockState p_220052_1_, Level p_220052_2_, BlockPos p_220052_3_) {
return new MenuProvider() { // from class: com.dairymoose.modernlife.blocks.TrashCanBlock.1
public AbstractContainerMenu createMenu(int paramInt, Inventory paramInventory, Player paramPlayer) {
BlockEntity tileEntity = p_220052_2_.getBlockEntity(p_220052_3_);
if (tileEntity instanceof TrashCanBlockEntity) {
TrashCanBlockEntity trashCanBlockEntity = (TrashCanBlockEntity) tileEntity;
return new TrashCanContainer(paramInt, paramInventory, trashCanBlockEntity);
}
return null;
}
public Component getDisplayName() {
return new TextComponent("Trash Can");
}
};
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
TrashCanBlockEntity toReturn = (TrashCanBlockEntity) TrashCanBlockEntity.TRASH_CAN.create(pos, state);
return toReturn;
}
public InteractionResult use(BlockState p_225533_1_, Level p_225533_2_, BlockPos p_225533_3_, Player p_225533_4_, InteractionHand p_225533_5_, BlockHitResult p_225533_6_) {
MenuProvider lvt_7_1_ = getMenuProvider(p_225533_1_, p_225533_2_, p_225533_3_);
if (lvt_7_1_ != null) {
p_225533_4_.openMenu(lvt_7_1_);
}
return InteractionResult.CONSUME;
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FACING});
}
/* renamed from: com.dairymoose.modernlife.blocks.TrashCanBlock$2 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/TrashCanBlock$2.class */
static /* synthetic */ class C00652 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00652.$SwitchMap$net$minecraft$core$Direction[bs.getValue(FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
context.getLevel().getFluidState(context.getClickedPos());
return (BlockState) defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite());
}
}

View File

@ -1,156 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.List;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/TurntableBlock.class */
public class TurntableBlock extends StandardHorizontalBlock {
protected static final VoxelShape SHAPE_NORTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(8.7d, 0.0d, 7.585786437626905d, 9.0d, 15.0d, 8.414213562373096d), Block.box(6.408701060962736d, 15.0d, 0.0d, 9.591298939037264d, 16.0d, 7.0d), Block.box(6.408701060962736d, 15.0d, 0.0d, 9.591298939037264d, 15.975000000000001d, 7.0d), Block.box(6.408701060962736d, 15.0d, 0.0d, 9.591298939037264d, 16.0d, 7.0d), Block.box(6.408701060962736d, 15.0d, 0.0d, 9.591298939037264d, 15.975000000000001d, 7.0d), Block.box(6.408701060962736d, 15.0d, 0.0d, 9.591298939037264d, 16.0d, 7.0d), Block.box(6.408701060962736d, 15.0d, 9.0d, 9.591298939037264d, 16.0d, 16.0d), Block.box(6.408701060962736d, 15.0d, 9.0d, 9.591298939037264d, 15.975000000000001d, 16.0d), Block.box(6.408701060962736d, 15.0d, 9.0d, 9.591298939037264d, 16.0d, 16.0d), Block.box(6.408701060962736d, 15.0d, 9.0d, 9.591298939037264d, 15.975000000000001d, 16.0d), Block.box(6.408701060962736d, 15.0d, 9.0d, 9.591298939037264d, 16.0d, 16.0d), Block.box(0.0d, 15.0d, 6.408701060962736d, 7.0d, 15.975000000000001d, 9.591298939037264d), Block.box(0.0d, 15.0d, 6.408701060962736d, 7.0d, 16.0d, 9.591298939037264d), Block.box(0.0d, 15.0d, 6.408701060962736d, 7.0d, 15.975000000000001d, 9.591298939037264d), Block.box(9.0d, 15.0d, 6.408701060962736d, 16.0d, 15.975000000000001d, 9.591298939037264d), Block.box(9.0d, 15.0d, 6.408701060962736d, 16.0d, 16.0d, 9.591298939037264d), Block.box(9.0d, 15.0d, 6.408701060962736d, 16.0d, 15.975000000000001d, 9.591298939037264d), Block.box(4.5d, 15.5d, 4.5d, 11.5d, 16.002d, 11.5d), Block.box(7.585786437626905d, 0.0d, 7.0d, 8.414213562373096d, 15.0d, 7.3d), Block.box(7.585786437626905d, 0.0d, 7.0d, 8.414213562373096d, 15.0d, 7.3d), Block.box(7.585786437626905d, 0.0d, 8.7d, 8.414213562373096d, 15.0d, 9.0d), Block.box(7.585786437626905d, 0.0d, 8.7d, 8.414213562373096d, 15.0d, 9.0d), Block.box(7.0d, 0.0d, 7.585786437626905d, 7.3d, 15.0d, 8.414213562373096d), Block.box(7.0d, 0.0d, 7.585786437626905d, 7.3d, 15.0d, 8.414213562373096d), Block.box(8.7d, 0.0d, 7.585786437626905d, 9.0d, 15.0d, 8.414213562373096d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
protected static final VoxelShape SHAPE_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Rotates clockwise when powered by redstone"));
}
public TurntableBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
}
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block block, BlockPos neighborPos, boolean p_220069_6_) {
Direction currentFacing;
boolean signal = world.hasNeighborSignal(pos);
Boolean currentPoweredState = (Boolean) state.getValue(POWERED);
if (block != this && signal != currentPoweredState.booleanValue()) {
BlockState newFacing = state;
if (signal) {
Direction turntableFacing = state.getValue(BlockStateProperties.HORIZONTAL_FACING);
newFacing = (BlockState) state.setValue(BlockStateProperties.HORIZONTAL_FACING, turntableFacing.getClockWise());
BlockPos abovePos = pos.above();
BlockState aboveState = world.getBlockState(abovePos);
if (aboveState.is(Blocks.PISTON)) {
world.setBlock(abovePos, (BlockState) aboveState.setValue(BlockStateProperties.EXTENDED, false), 2);
}
if (aboveState.getOptionalValue(BlockStateProperties.HORIZONTAL_FACING).isPresent()) {
aboveState = (BlockState) aboveState.setValue(BlockStateProperties.HORIZONTAL_FACING, aboveState.getValue(BlockStateProperties.HORIZONTAL_FACING).getClockWise());
world.setBlock(abovePos, aboveState, 2);
}
if (aboveState.getOptionalValue(BlockStateProperties.FACING).isPresent()) {
if (aboveState.getValue(BlockStateProperties.FACING) == Direction.UP) {
world.setBlock(abovePos, (BlockState) aboveState.setValue(BlockStateProperties.FACING, Direction.DOWN), 2);
} else if (aboveState.getValue(BlockStateProperties.FACING) == Direction.DOWN) {
world.setBlock(abovePos, (BlockState) aboveState.setValue(BlockStateProperties.FACING, Direction.UP), 2);
} else {
aboveState = (BlockState) aboveState.setValue(BlockStateProperties.FACING, aboveState.getValue(BlockStateProperties.FACING).getClockWise());
world.setBlock(abovePos, aboveState, 2);
}
}
if (aboveState.getOptionalValue(BlockStateProperties.FACING_HOPPER).isPresent() && (currentFacing = aboveState.getValue(BlockStateProperties.FACING_HOPPER)) != Direction.DOWN) {
world.setBlock(abovePos, (BlockState) aboveState.setValue(BlockStateProperties.FACING_HOPPER, currentFacing.getClockWise()), 2);
}
List<Entity> aboveEntities = world.getEntities((Entity) null, AABB.ofSize(new Vec3(abovePos.getX() + 0.5d, abovePos.getY() + 0.5d, abovePos.getZ() + 0.5d), 1.0d, 1.0d, 1.0d));
if (aboveEntities != null && aboveEntities.size() > 0) {
for (Entity entity : aboveEntities) {
double centX = abovePos.getX() + 0.5d;
double centY = abovePos.getY();
double centZ = abovePos.getZ() + 0.5d;
double distToCenter = Math.sqrt(entity.distanceToSqr(centX, centY, centZ));
double xDiff = entity.getX() - centX;
double zDiff = entity.getZ() - centZ;
double entityAngle = (Math.toDegrees(Math.atan2(zDiff, xDiff)) + 90.0d) % 360.0d;
entity.setYRot(entity.rotate(Rotation.CLOCKWISE_90) % 360.0f);
double newX = centX + (distToCenter * Math.cos(Math.toRadians(entityAngle)));
double newZ = centZ + (distToCenter * Math.sin(Math.toRadians(entityAngle)));
entity.teleportTo(newX, entity.getY(), newZ);
}
}
}
world.setBlock(pos, (BlockState) newFacing.setValue(POWERED, Boolean.valueOf(signal)), 2);
}
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{HorizontalDirectionalBlock.FACING, POWERED});
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
@Nullable
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState) super.getStateForPlacement(context).setValue(POWERED, Boolean.valueOf(context.getLevel().hasNeighborSignal(context.getClickedPos())));
}
/* renamed from: com.dairymoose.modernlife.blocks.TurntableBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/TurntableBlock$1.class */
static /* synthetic */ class C00661 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState blockState, BlockGetter p_220053_2_, BlockPos p_220053_3_, CollisionContext p_220053_4_) {
switch (C00661.$SwitchMap$net$minecraft$core$Direction[blockState.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_NORTH;
case 3:
return SHAPE_NORTH;
case 4:
return SHAPE_NORTH;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,196 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.tileentities.WallShelfBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.List;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/WallShelfBlock.class */
public class WallShelfBlock extends Block implements EntityBlock {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of(Block.box(0.0d, 4.5d, 0.0d, 16.0d, 9.0d, 6.0d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public WallShelfBlock(Properties props) {
super(props);
registerDefaultState((BlockState) this.stateDefinition.any().setValue(FACING, Direction.SOUTH));
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 20;
}
return 0;
}
public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
if (this.material.isFlammable()) {
return 5;
}
return 0;
}
public InteractionResult use(BlockState blockState, Level world, BlockPos blockPos, Player player, InteractionHand hand, BlockHitResult rayTrace) {
int slot;
if (!world.isClientSide) {
ItemStack itemStack = player.getItemInHand(hand);
BlockEntity tileEntity = world.getBlockEntity(blockPos);
WallShelfBlockEntity wallShelfBlockEntity = null;
if (tileEntity instanceof WallShelfBlockEntity) {
wallShelfBlockEntity = (WallShelfBlockEntity) tileEntity;
}
if (wallShelfBlockEntity != null) {
if (!player.isSteppingCarefully() && !itemStack.isEmpty()) {
if (!wallShelfBlockEntity.isFull()) {
ItemStack oneItem = itemStack.split(1);
wallShelfBlockEntity.placeItem(oneItem);
}
} else if (player.isSteppingCarefully() && !wallShelfBlockEntity.isEmpty() && (slot = wallShelfBlockEntity.getNextOccupiedSlot()) != -1) {
player.addItem(wallShelfBlockEntity.getItem(slot).copy());
wallShelfBlockEntity.setItem(slot, ItemStack.EMPTY);
}
wallShelfBlockEntity.setChanged();
}
world.sendBlockUpdated(blockPos, blockState, blockState, 2);
}
return InteractionResult.CONSUME;
}
public void onRemove(BlockState p_196243_1_, Level p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_1_.is(p_196243_4_.getBlock())) {
BlockEntity lvt_6_1_ = p_196243_2_.getBlockEntity(p_196243_3_);
if (lvt_6_1_ instanceof WallShelfBlockEntity) {
Containers.dropContents(p_196243_2_, p_196243_3_, (WallShelfBlockEntity) lvt_6_1_);
p_196243_2_.updateNeighbourForOutputSignal(p_196243_3_, this);
}
super.onRemove(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
}
}
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Right click to place an item on the shelf"));
list.add(new TextComponent("Shift-right-click with an empty hand to remove an item"));
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
if (p_196271_1_.getValue(FACING).getOpposite() == p_196271_2_ && !p_196271_1_.canSurvive(p_196271_4_, p_196271_5_)) {
return Blocks.AIR.defaultBlockState();
}
return super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
/* renamed from: com.dairymoose.modernlife.blocks.WallShelfBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/WallShelfBlock$1.class */
static /* synthetic */ class C00671 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00671.$SwitchMap$net$minecraft$core$Direction[bs.getValue(FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
WallShelfBlockEntity toReturn = (WallShelfBlockEntity) WallShelfBlockEntity.WALL_SHELF.create(pos, state);
return toReturn;
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FACING});
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
return FaceAttachedHorizontalDirectionalBlock.canAttach(p_196260_2_, p_196260_3_, p_196260_1_.getValue(FACING).getOpposite());
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
Direction[] var2 = context.getNearestLookingDirections();
for (Direction lvt_5_1_ : var2) {
if (lvt_5_1_.getAxis() != Direction.Axis.Y) {
BlockState lvt_6_2_ = (BlockState) defaultBlockState().setValue(FACING, lvt_5_1_.getOpposite());
if (lvt_6_2_.canSurvive(context.getLevel(), context.getClickedPos())) {
return lvt_6_2_;
}
}
}
return defaultBlockState();
}
}

View File

@ -1,117 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/WallSocketBlock.class */
public class WallSocketBlock extends Block {
protected static final VoxelShape SHAPE_SOUTH = (VoxelShape) Stream.of(Block.box(6.0d, 5.0d, 0.0d, 10.0d, 11.0d, 0.25d)).reduce((v1, v2) -> {
return Shapes.join(v1, v2, BooleanOp.OR);
}).get();
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
protected static final VoxelShape SHAPE_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WEST);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public WallSocketBlock(Properties props) {
super(props);
registerDefaultState((BlockState) this.stateDefinition.any().setValue(FACING, Direction.SOUTH));
}
public BlockState rotate(BlockState state, Rotation rotation) {
return (BlockState) state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
public BlockState updateShape(BlockState p_196271_1_, Direction p_196271_2_, BlockState p_196271_3_, LevelAccessor p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
if (p_196271_1_.getValue(FACING).getOpposite() == p_196271_2_ && !p_196271_1_.canSurvive(p_196271_4_, p_196271_5_)) {
return Blocks.AIR.defaultBlockState();
}
return super.updateShape(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
/* renamed from: com.dairymoose.modernlife.blocks.WallSocketBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/WallSocketBlock$1.class */
static /* synthetic */ class C00681 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
switch (C00681.$SwitchMap$net$minecraft$core$Direction[bs.getValue(FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_SOUTH;
case 3:
return SHAPE_EAST;
case 4:
return SHAPE_WEST;
default:
return SHAPE_NORTH;
}
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FACING});
}
public boolean canSurvive(BlockState p_196260_1_, LevelReader p_196260_2_, BlockPos p_196260_3_) {
return FaceAttachedHorizontalDirectionalBlock.canAttach(p_196260_2_, p_196260_3_, p_196260_1_.getValue(FACING).getOpposite());
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
Direction[] var2 = context.getNearestLookingDirections();
for (Direction lvt_5_1_ : var2) {
if (lvt_5_1_.getAxis() != Direction.Axis.Y) {
BlockState lvt_6_2_ = (BlockState) defaultBlockState().setValue(FACING, lvt_5_1_.getOpposite());
if (lvt_6_2_.canSurvive(context.getLevel(), context.getClickedPos())) {
return lvt_6_2_;
}
}
}
return defaultBlockState();
}
}

View File

@ -1,73 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/WallpaperBlock.class */
public class WallpaperBlock extends StandardHorizontalBlock {
protected static final VoxelShape SHAPE_NORTH = Block.box(0.0d, 0.0d, 15.5d, 16.0d, 16.0d, 16.0d);
protected static final VoxelShape SHAPE_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_NORTH);
protected static final VoxelShape SHAPE_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_EAST);
protected static final VoxelShape SHAPE_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_SOUTH);
public static final BooleanProperty CORNER = BooleanProperty.create("corner");
public WallpaperBlock(Properties p_i48377_1_) {
super(p_i48377_1_);
registerDefaultState((BlockState) ((BlockState) defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, Direction.SOUTH)).setValue(CORNER, false));
}
@Override // com.dairymoose.modernlife.blocks.StandardHorizontalBlock
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{HorizontalDirectionalBlock.FACING, CORNER});
}
/* renamed from: com.dairymoose.modernlife.blocks.WallpaperBlock$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/WallpaperBlock$1.class */
static /* synthetic */ class C00691 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
static {
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
public VoxelShape getShape(BlockState p_220053_1_, BlockGetter p_220053_2_, BlockPos p_220053_3_, CollisionContext p_220053_4_) {
switch (C00691.$SwitchMap$net$minecraft$core$Direction[p_220053_1_.getValue(HorizontalDirectionalBlock.FACING).ordinal()]) {
case 1:
return SHAPE_NORTH;
case 2:
return SHAPE_EAST;
case 3:
return SHAPE_WEST;
case 4:
return SHAPE_SOUTH;
default:
return SHAPE_NORTH;
}
}
}

View File

@ -1,380 +0,0 @@
package com.dairymoose.modernlife.blocks;
import com.dairymoose.modernlife.tileentities.WinchBlockEntity;
import com.dairymoose.modernlife.util.ModernLifeUtil;
import java.util.List;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.Container;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.ChestMenu;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.ChainBlock;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.AttachFace;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/WinchBlock.class */
public class WinchBlock extends FaceAttachedHorizontalDirectionalBlock implements EntityBlock {
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
protected static final VoxelShape SHAPE_FLOOR_SOUTH = (VoxelShape) Stream.of((Object[]) new VoxelShape[]{Block.box(0.0d, 0.0d, 4.0d, 16.0d, 1.0d, 12.0d), Block.box(4.0d, 1.0d, 5.0d, 14.0d, 2.0d, 6.0d), Block.box(0.5d, 1.0d, 5.0d, 4.0d, 5.0d, 11.0d), Block.box(10.0d, 5.0d, 6.0d, 14.5d, 6.0d, 10.0d), Block.box(3.5d, 5.0d, 10.0d, 14.5d, 6.0d, 11.0d), Block.box(3.5d, 5.0d, 6.0d, 6.0d, 6.0d, 10.0d), Block.box(3.5d, 5.0d, 5.0d, 14.5d, 6.0d, 6.0d), Block.box(14.0d, 1.0d, 5.0d, 15.0d, 5.0d, 11.0d), Block.box(15.0d, 1.0d, 6.0d, 16.0d, 4.0d, 10.0d), Block.box(8.0d, 0.0d, 6.5d, 8.0d, 5.0d, 9.5d), Block.box(6.5d, 0.0d, 8.0d, 9.5d, 5.0d, 8.0d), Block.box(4.0d, 1.0d, 10.0d, 14.0d, 2.0d, 11.0d), Block.box(6.0d, 5.0d, 6.0d, 10.0d, 6.0d, 10.0d), Block.box(4.75d, 1.0d, 8.0d, 7.75d, 6.0d, 8.0d), Block.box(6.603553390593274d, 1.0d, 6.353553390593273d, 6.603553390593274d, 6.0d, 9.353553390593273d), Block.box(7.0732233047033635d, 1.0d, 12.75d, 10.073223304703363d, 6.0d, 12.75d), Block.box(8.926776695296637d, 1.0d, 11.103553390593273d, 8.926776695296637d, 6.0d, 14.103553390593273d), Block.box(9.75d, 1.0d, 13.0d, 12.75d, 6.0d, 13.0d), Block.box(11.603553390593273d, 1.0d, 11.353553390593273d, 11.603553390593273d, 6.0d, 14.353553390593273d)}).reduce((v1, v2) -> {
return Shapes.join((VoxelShape) v1, (VoxelShape) v2, BooleanOp.OR);
}).get();
protected final VoxelShape SHAPE_FLOOR_WEST;
protected final VoxelShape SHAPE_FLOOR_NORTH;
protected final VoxelShape SHAPE_FLOOR_EAST;
protected final VoxelShape SHAPE_WALL_SOUTH;
protected final VoxelShape SHAPE_WALL_WEST;
protected final VoxelShape SHAPE_WALL_NORTH;
protected final VoxelShape SHAPE_WALL_EAST;
protected final VoxelShape SHAPE_CEILING_SOUTH;
protected final VoxelShape SHAPE_CEILING_WEST;
protected final VoxelShape SHAPE_CEILING_NORTH;
protected final VoxelShape SHAPE_CEILING_EAST;
@OnlyIn(Dist.CLIENT)
public void appendHoverText(ItemStack itemStack, @Nullable BlockGetter blockReader, List<Component> list, TooltipFlag tooltipFlag) {
list.add(new TextComponent("Requires redstone power to operate"));
}
public WinchBlock(Properties props) {
super(props);
this.SHAPE_FLOOR_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_FLOOR_SOUTH);
this.SHAPE_FLOOR_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(this.SHAPE_FLOOR_WEST);
this.SHAPE_FLOOR_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(this.SHAPE_FLOOR_NORTH);
this.SHAPE_WALL_SOUTH = ModernLifeUtil.RotateVoxelShapeXAxis(SHAPE_FLOOR_SOUTH);
this.SHAPE_WALL_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(this.SHAPE_WALL_SOUTH);
this.SHAPE_WALL_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(this.SHAPE_WALL_WEST);
this.SHAPE_WALL_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(this.SHAPE_WALL_NORTH);
this.SHAPE_CEILING_SOUTH = ModernLifeUtil.RotateVoxelShapeXAxis(this.SHAPE_WALL_SOUTH);
this.SHAPE_CEILING_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(this.SHAPE_CEILING_SOUTH);
this.SHAPE_CEILING_NORTH = ModernLifeUtil.RotateVoxelShapeClockwise(this.SHAPE_CEILING_WEST);
this.SHAPE_CEILING_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(this.SHAPE_CEILING_NORTH);
registerDefaultState((BlockState) ((BlockState) ((BlockState) this.stateDefinition.any().setValue(FaceAttachedHorizontalDirectionalBlock.FACE, AttachFace.CEILING)).setValue(HorizontalDirectionalBlock.FACING, Direction.NORTH)).setValue(POWERED, false));
}
public BlockState rotate(BlockState state, Rotation rotation) {
return state;
}
public BlockState mirror(BlockState state, Mirror mirror) {
return state;
}
public static int getLightLevel(BlockState state) {
if (((Boolean) state.getValue(POWERED)).booleanValue()) {
return 15;
}
return 0;
}
public BlockState getStateForPlacement(BlockPlaceContext context) {
BlockPos pos = context.getClickedPos();
boolean signal = context.getLevel().hasNeighborSignal(pos);
BlockState superState = super.getStateForPlacement(context);
if (superState == null) {
superState = defaultBlockState();
}
return (BlockState) superState.setValue(POWERED, Boolean.valueOf(signal));
}
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block block, BlockPos neighborPos, boolean p_220069_6_) {
boolean signal = world.hasNeighborSignal(pos);
if (block != this && signal != ((Boolean) state.getValue(POWERED)).booleanValue()) {
world.setBlock(pos, (BlockState) state.setValue(POWERED, Boolean.valueOf(signal)), 2);
}
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(new Property[]{FaceAttachedHorizontalDirectionalBlock.FACE, HorizontalDirectionalBlock.FACING, POWERED});
}
public MenuProvider getMenuProvider(BlockState state, Level level, BlockPos blockPos) {
return new MenuProvider() { // from class: com.dairymoose.modernlife.blocks.WinchBlock.1
public AbstractContainerMenu createMenu(int paramInt, Inventory paramInventory, Player paramPlayer) {
BlockEntity tileEntity = level.getBlockEntity(blockPos);
if (tileEntity instanceof WinchBlockEntity) {
WinchBlockEntity winchBlockEntity = (WinchBlockEntity) tileEntity;
ChestMenu chest = new ChestMenu(MenuType.GENERIC_9x1, paramInt, paramInventory, winchBlockEntity, 1);
if (!paramPlayer.level.isClientSide) {
}
return chest;
}
return null;
}
public Component getDisplayName() {
return new TextComponent("Winch");
}
};
}
public void onRemove(BlockState p_51538_, Level p_51539_, BlockPos p_51540_, BlockState p_51541_, boolean p_51542_) {
if (!p_51538_.is(p_51541_.getBlock())) {
Container blockEntity = (Container) p_51539_.getBlockEntity(p_51540_);
if (blockEntity != null) {
Containers.dropContents(p_51539_, p_51540_, blockEntity);
p_51539_.updateNeighbourForOutputSignal(p_51540_, this);
}
super.onRemove(p_51538_, p_51539_, p_51540_, p_51541_, p_51542_);
}
}
public InteractionResult use(BlockState blockState, Level world, BlockPos blockPos, Player player, InteractionHand hand, BlockHitResult rayTrace) {
int chainSlot;
if (!world.isClientSide) {
ItemStack itemStack = player.getItemInHand(hand);
if (itemStack.is(Items.CHAIN)) {
BlockEntity blockEntity = world.getBlockEntity(blockPos);
if (blockEntity instanceof WinchBlockEntity) {
WinchBlockEntity winch = (WinchBlockEntity) blockEntity;
if (winch.canExpandChain()) {
BlockPos pos = winch.getExpandedChainBlockPos();
if (world.getBlockState(pos).isAir()) {
itemStack.shrink(1);
AttachFace face = blockEntity.getBlockState().getValue(FaceAttachedHorizontalDirectionalBlock.FACE);
Direction facing = blockEntity.getBlockState().getValue(HorizontalDirectionalBlock.FACING);
if (face == AttachFace.CEILING || face == AttachFace.FLOOR) {
world.setBlock(pos, (BlockState) Blocks.CHAIN.defaultBlockState().setValue(ChainBlock.AXIS, Direction.Axis.Y), 2);
} else if (face == AttachFace.WALL && (facing == Direction.EAST || facing == Direction.WEST)) {
world.setBlock(pos, (BlockState) Blocks.CHAIN.defaultBlockState().setValue(ChainBlock.AXIS, Direction.Axis.X), 2);
} else {
world.setBlock(pos, (BlockState) Blocks.CHAIN.defaultBlockState().setValue(ChainBlock.AXIS, Direction.Axis.Z), 2);
}
}
world.setBlockAndUpdate(blockPos, blockState);
((ServerLevel) world).sendBlockUpdated(blockPos, blockState, blockState, 2);
}
}
} else if (player.isSteppingCarefully()) {
BlockEntity blockEntity2 = world.getBlockEntity(blockPos);
if (blockEntity2 instanceof WinchBlockEntity) {
WinchBlockEntity winch2 = (WinchBlockEntity) blockEntity2;
if (winch2.getInventoryChainCount() > 0 && (chainSlot = winch2.getNextChainSlot()) != -1) {
ItemStack chainItem = winch2.getItem(chainSlot);
ItemStack copiedChain = chainItem.copy();
copiedChain.setCount(1);
chainItem.shrink(1);
player.addItem(copiedChain);
}
}
}
}
return InteractionResult.CONSUME;
}
/* renamed from: com.dairymoose.modernlife.blocks.WinchBlock$2 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/WinchBlock$2.class */
static /* synthetic */ class C00712 {
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction;
/* renamed from: $SwitchMap$net$minecraft$world$level$block$state$properties$AttachFace */
static final /* synthetic */ int[] f5x6a19ab39 = new int[AttachFace.values().length];
static {
try {
f5x6a19ab39[AttachFace.CEILING.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
f5x6a19ab39[AttachFace.WALL.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
f5x6a19ab39[AttachFace.FLOOR.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
$SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
try {
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError e4) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 2;
} catch (NoSuchFieldError e5) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 3;
} catch (NoSuchFieldError e6) {
}
try {
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 4;
} catch (NoSuchFieldError e7) {
}
}
}
/* JADX ERROR: JadxRuntimeException in pass: RegionMakerVisitor
jadx.core.utils.exceptions.JadxRuntimeException: Failed to find switch 'out' block (already processed)
at jadx.core.dex.visitors.regions.RegionMaker.calcSwitchOut(RegionMaker.java:923)
at jadx.core.dex.visitors.regions.RegionMaker.processSwitch(RegionMaker.java:797)
at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:157)
at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:91)
at jadx.core.dex.visitors.regions.RegionMaker.processFallThroughCases(RegionMaker.java:841)
at jadx.core.dex.visitors.regions.RegionMaker.processSwitch(RegionMaker.java:800)
at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:157)
at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:91)
at jadx.core.dex.visitors.regions.RegionMakerVisitor.visit(RegionMakerVisitor.java:52)
*/
/* JADX WARN: Failed to find 'out' block for switch in B:2:0x0011. Please report as an issue. */
public VoxelShape getShape(BlockState r5, BlockGetter r6, BlockPos r7, net.minecraft.world.phys.shapes.CollisionContext r8) {
/*
r4 = this;
int[] r0 = com.dairymoose.modernlife.blocks.WinchBlock.C00712.f5x6a19ab39
r1 = r5
net.minecraft.world.level.block.state.properties.EnumProperty r2 = com.dairymoose.modernlife.blocks.WinchBlock.FACE
java.lang.Comparable r1 = r1.getValue(r2)
net.minecraft.world.level.block.state.properties.AttachFace r1 = (net.minecraft.world.level.block.state.properties.AttachFace) r1
int r1 = r1.ordinal()
r0 = r0[r1]
switch(r0) {
case 1: goto L2c;
case 2: goto L70;
case 3: goto Lb4;
default: goto Lf7;
}
L2c:
int[] r0 = com.dairymoose.modernlife.blocks.WinchBlock.C00712.$SwitchMap$net$minecraft$core$Direction
r1 = r5
net.minecraft.world.level.block.state.properties.DirectionProperty r2 = com.dairymoose.modernlife.blocks.WinchBlock.FACING
java.lang.Comparable r1 = r1.getValue(r2)
net.minecraft.core.Direction r1 = (net.minecraft.core.Direction) r1
int r1 = r1.ordinal()
r0 = r0[r1]
switch(r0) {
case 1: goto L5c;
case 2: goto L61;
case 3: goto L66;
case 4: goto L6b;
default: goto L70;
}
L5c:
r0 = r4
net.minecraft.world.phys.shapes.VoxelShape r0 = r0.SHAPE_CEILING_NORTH
return r0
L61:
r0 = r4
net.minecraft.world.phys.shapes.VoxelShape r0 = r0.SHAPE_CEILING_EAST
return r0
L66:
r0 = r4
net.minecraft.world.phys.shapes.VoxelShape r0 = r0.SHAPE_CEILING_WEST
return r0
L6b:
r0 = r4
net.minecraft.world.phys.shapes.VoxelShape r0 = r0.SHAPE_CEILING_SOUTH
return r0
L70:
int[] r0 = com.dairymoose.modernlife.blocks.WinchBlock.C00712.$SwitchMap$net$minecraft$core$Direction
r1 = r5
net.minecraft.world.level.block.state.properties.DirectionProperty r2 = com.dairymoose.modernlife.blocks.WinchBlock.FACING
java.lang.Comparable r1 = r1.getValue(r2)
net.minecraft.core.Direction r1 = (net.minecraft.core.Direction) r1
int r1 = r1.ordinal()
r0 = r0[r1]
switch(r0) {
case 1: goto La0;
case 2: goto La5;
case 3: goto Laa;
case 4: goto Laf;
default: goto Lb4;
}
La0:
r0 = r4
net.minecraft.world.phys.shapes.VoxelShape r0 = r0.SHAPE_WALL_NORTH
return r0
La5:
r0 = r4
net.minecraft.world.phys.shapes.VoxelShape r0 = r0.SHAPE_WALL_EAST
return r0
Laa:
r0 = r4
net.minecraft.world.phys.shapes.VoxelShape r0 = r0.SHAPE_WALL_WEST
return r0
Laf:
r0 = r4
net.minecraft.world.phys.shapes.VoxelShape r0 = r0.SHAPE_WALL_SOUTH
return r0
Lb4:
int[] r0 = com.dairymoose.modernlife.blocks.WinchBlock.C00712.$SwitchMap$net$minecraft$core$Direction
r1 = r5
net.minecraft.world.level.block.state.properties.DirectionProperty r2 = com.dairymoose.modernlife.blocks.WinchBlock.FACING
java.lang.Comparable r1 = r1.getValue(r2)
net.minecraft.core.Direction r1 = (net.minecraft.core.Direction) r1
int r1 = r1.ordinal()
r0 = r0[r1]
switch(r0) {
case 1: goto Le4;
case 2: goto Le9;
case 3: goto Lee;
case 4: goto Lf3;
default: goto Lf7;
}
Le4:
r0 = r4
net.minecraft.world.phys.shapes.VoxelShape r0 = r0.SHAPE_FLOOR_NORTH
return r0
Le9:
r0 = r4
net.minecraft.world.phys.shapes.VoxelShape r0 = r0.SHAPE_FLOOR_EAST
return r0
Lee:
r0 = r4
net.minecraft.world.phys.shapes.VoxelShape r0 = r0.SHAPE_FLOOR_WEST
return r0
Lf3:
net.minecraft.world.phys.shapes.VoxelShape r0 = com.dairymoose.modernlife.blocks.WinchBlock.SHAPE_FLOOR_SOUTH
return r0
Lf7:
r0 = r4
net.minecraft.world.phys.shapes.VoxelShape r0 = r0.SHAPE_FLOOR_NORTH
return r0
*/
throw new UnsupportedOperationException("Method not decompiled: com.dairymoose.modernlife.blocks.WinchBlock.getShape(net.minecraft.world.level.block.state.BlockState, net.minecraft.world.level.BlockGetter, net.minecraft.core.BlockPos, net.minecraft.world.phys.shapes.CollisionContext):net.minecraft.world.phys.shapes.VoxelShape");
}
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState blockState, BlockEntityType<T> type) {
return ModernLifeUtil.createTickerHelper(type, WinchBlockEntity.WINCH, WinchBlockEntity::tick);
}
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
WinchBlockEntity toReturn = (WinchBlockEntity) WinchBlockEntity.WINCH.create(pos, state);
return toReturn;
}
}

View File

@ -1,437 +0,0 @@
package com.dairymoose.modernlife.blocks.gui;
import com.dairymoose.modernlife.core.CustomBlocks;
import com.dairymoose.modernlife.core.ModernLifeCommon;
import com.dairymoose.modernlife.core.ModernLifeNetwork;
import com.dairymoose.modernlife.network.play.client.ServerboundPrintSizePacket;
import com.dairymoose.modernlife.util.CanvasData;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import java.text.DecimalFormat;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.ImageButton;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextColor;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.FormattedCharSequence;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@OnlyIn(Dist.CLIENT)
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/CustomPrintScreen.class */
public class CustomPrintScreen extends Screen {
final int GUI_WIDTH = 80;
final int GUI_HEIGHT = 110;
BlockPos pos;
private static final String PRINT_SIZE = "Canvas Resize";
public static final int FIELD_START_X = 5;
public static final int FIELD_START_RIGHT_X = 48;
public static final int FIELD_START_Y = 20;
public static final int FIELD_START_Y2 = 55;
public static final int FIELD_START_Y3 = 88;
public static final int INPUT_FIELD_WIDTH = 27;
public static final int INPUT_FIELD_HEIGHT = 16;
public static final int TEXT_START_OFFSET_X = 13;
public static final int TEXT_START_OFFSET_Y = 3;
private int chosenFieldId;
private static final int FIELD_ID_WIDTH = 0;
private static final int FIELD_ID_HEIGHT = 1;
private static final int FIELD_ID_X_OFFSET = 2;
private static final int FIELD_ID_Y_OFFSET = 3;
public static final int CANCEL_BUTTON_START_X = 56;
public static final int CANCEL_BUTTON_START_Y = 68;
public static final int ACCEPT_BUTTON_START_X = 56;
public static final int ACCEPT_BUTTON_START_Y = 88;
private float blockWidth;
private float blockHeight;
private float xOffset;
private float yOffset;
private int blockWidthInputLength;
private int blockHeightInputLength;
private int xOffsetInputLength;
private int yOffsetInputLength;
private boolean negateX;
private boolean negateY;
private static final Logger LOGGER = LogManager.getLogger();
private static final ResourceLocation PRINTER_GUI = new ResourceLocation("modernlife", "textures/gui/gui_printer_custom.png");
public static int grayColor = 9145227;
public static int chosenX = -1;
public static int chosenY = -1;
private static Component getComponentForTitle(String title) {
return new TextComponent(title).m_6270_(Style.EMPTY.withColor(TextColor.fromRgb(4210752)));
}
public CustomPrintScreen(BlockPos pos) {
super(getComponentForTitle(PRINT_SIZE));
CompoundTag tag;
this.GUI_WIDTH = 80;
this.GUI_HEIGHT = 110;
this.chosenFieldId = -1;
this.blockWidth = 1.0f;
this.blockHeight = 1.0f;
this.xOffset = 0.0f;
this.yOffset = 0.0f;
this.blockWidthInputLength = 0;
this.blockHeightInputLength = 0;
this.xOffsetInputLength = 0;
this.yOffsetInputLength = 0;
this.negateX = false;
this.negateY = false;
chosenX = -1;
chosenY = -1;
this.pos = pos;
ItemStack itemStack = Minecraft.getInstance().player.getMainHandItem();
if (itemStack != null && itemStack.is(CustomBlocks.ITEM_CANVAS.get()) && (tag = itemStack.getTag()) != null && tag.contains("Size")) {
int size = tag.getInt("Size");
if (size == 0) {
if (tag.contains("BlockWidth") && tag.contains("BlockHeight")) {
float blockWidth = tag.getFloat("BlockWidth");
float blockHeight = tag.getFloat("BlockHeight");
this.blockWidth = blockWidth;
this.blockHeight = blockHeight;
}
if (tag.contains("xOffset") && tag.contains("yOffset")) {
float xOffset = tag.getFloat("xOffset");
float yOffset = tag.getFloat("yOffset");
this.xOffset = xOffset;
this.yOffset = yOffset;
return;
}
return;
}
this.xOffset = 0.0f;
this.yOffset = 0.0f;
if (size == 1) {
this.blockWidth = 1.0f;
this.blockHeight = 1.0f;
return;
}
if (size == FIELD_ID_X_OFFSET) {
this.blockWidth = 1.5f;
this.blockHeight = 1.25f;
this.yOffset = 0.125f;
return;
}
if (size == 3) {
this.blockWidth = 2.0f;
this.blockHeight = 1.5f;
this.yOffset = 0.25f;
return;
}
if (size == 4) {
this.blockWidth = 3.0f;
this.blockHeight = 2.0f;
this.yOffset = 0.5f;
} else if (size == 5) {
this.blockWidth = 1.625f;
this.blockHeight = 1.625f;
} else if (size == 6) {
this.blockWidth = 2.25f;
this.blockHeight = 2.25f;
} else if (size == 7) {
this.blockWidth = 3.0f;
this.blockHeight = 3.0f;
}
}
}
public boolean m_6375_(double clickX, double clickY, int mouseButton) {
int xStart = (this.width - 80) / FIELD_ID_X_OFFSET;
int yStart = (this.height - 110) / FIELD_ID_X_OFFSET;
int fieldStartX = xStart + 5;
int fieldStartRightX = xStart + 48;
int fieldStartY = yStart + 20;
int fieldStartY2 = yStart + 55;
int fieldStartY3 = yStart + 88;
int fieldEndX = fieldStartX + 27;
int fieldEndRightX = fieldStartRightX + 27;
int fieldEndY = fieldStartY + 16;
int fieldEndY2 = fieldStartY2 + 16;
int fieldEndY3 = fieldStartY3 + 16;
if (mouseButton == 0) {
if (clickX >= fieldStartX && clickX <= fieldEndX) {
if (clickY >= fieldStartY && clickY <= fieldEndY) {
this.chosenFieldId = 0;
setChosenFieldToZero();
chosenX = fieldStartX;
chosenY = fieldStartY;
}
if (clickY >= fieldStartY2 && clickY <= fieldEndY2) {
this.chosenFieldId = FIELD_ID_X_OFFSET;
setChosenFieldToZero();
chosenX = fieldStartX;
chosenY = fieldStartY2;
}
if (clickY >= fieldStartY3 && clickY <= fieldEndY3) {
this.chosenFieldId = 3;
setChosenFieldToZero();
chosenX = fieldStartX;
chosenY = fieldStartY3;
}
}
if (clickX >= fieldStartRightX && clickX <= fieldEndRightX && clickY >= fieldStartY && clickY <= fieldEndY) {
this.chosenFieldId = 1;
setChosenFieldToZero();
chosenX = fieldStartRightX;
chosenY = fieldStartY;
}
}
return super.m_6375_(clickX, clickY, mouseButton);
}
public int getDigitCount(float f) {
float remainder = f;
int count = 0;
while (remainder != 0.0f) {
int truncated = (int) remainder;
count++;
if (truncated != 0) {
remainder %= truncated;
}
remainder *= 10.0f;
}
return count;
}
public float applyInputToFloatField(float field, float input, int inputCount) {
float fInput = input;
for (int i = 0; i < inputCount; i++) {
fInput /= 10.0f;
}
return field + fInput;
}
public void addInputToChosenField(int input) {
if (this.chosenFieldId == -1) {
return;
}
if (this.chosenFieldId == 0) {
this.blockWidth = applyInputToFloatField(this.blockWidth, input, this.blockWidthInputLength);
this.blockWidth = ServerboundPrintSizePacket.sanitizeWidthHeight(this.blockWidth);
this.blockWidthInputLength++;
}
if (this.chosenFieldId == 1) {
this.blockHeight = applyInputToFloatField(this.blockHeight, input, this.blockHeightInputLength);
this.blockHeight = ServerboundPrintSizePacket.sanitizeWidthHeight(this.blockHeight);
this.blockHeightInputLength++;
}
if (this.chosenFieldId == FIELD_ID_X_OFFSET) {
this.xOffset = applyInputToFloatField(this.xOffset, input, this.xOffsetInputLength);
this.xOffset = ServerboundPrintSizePacket.sanitizeOffset(this.xOffset);
this.xOffsetInputLength++;
}
if (this.chosenFieldId == 3) {
this.yOffset = applyInputToFloatField(this.yOffset, input, this.yOffsetInputLength);
this.yOffset = ServerboundPrintSizePacket.sanitizeOffset(this.yOffset);
this.yOffsetInputLength++;
}
}
public void setChosenFieldToZero() {
if (this.chosenFieldId == -1) {
return;
}
if (this.chosenFieldId == 0) {
this.blockWidth = 0.0f;
this.blockWidthInputLength = 0;
}
if (this.chosenFieldId == 1) {
this.blockHeight = 0.0f;
this.blockHeightInputLength = 0;
}
if (this.chosenFieldId == FIELD_ID_X_OFFSET) {
this.xOffset = 0.0f;
this.negateX = false;
this.xOffsetInputLength = 1;
}
if (this.chosenFieldId == 3) {
this.yOffset = 0.0f;
this.negateY = false;
this.yOffsetInputLength = 1;
}
}
public void backspaceChosenField() {
if (this.chosenFieldId == -1) {
return;
}
if (this.chosenFieldId == 0) {
this.blockWidth = (int) this.blockWidth;
this.blockWidthInputLength = 1;
}
if (this.chosenFieldId == 1) {
this.blockHeight = (int) this.blockHeight;
this.blockHeightInputLength = 1;
}
if (this.chosenFieldId == FIELD_ID_X_OFFSET) {
this.xOffset = (int) this.xOffset;
this.xOffsetInputLength = 1;
}
if (this.chosenFieldId == 3) {
this.yOffset = (int) this.yOffset;
this.yOffsetInputLength = 1;
}
}
public void negateChosenField() {
if (this.chosenFieldId == FIELD_ID_X_OFFSET) {
this.negateX = !this.negateX;
}
if (this.chosenFieldId == 3) {
this.negateY = !this.negateY;
}
}
public boolean keyPressed(int key, int p_231046_2_, int p_231046_3_) {
ModernLifeCommon.LOGGER.debug("key press: " + key);
if (key == 261) {
setChosenFieldToZero();
} else if (key == 259) {
backspaceChosenField();
} else if (key == 48 || (key >= 49 && key <= 57)) {
int digit = Character.digit(key, 10);
addInputToChosenField(digit);
} else if (key == 45) {
negateChosenField();
} else if (key == 257) {
return true;
}
return super.keyPressed(key, p_231046_2_, p_231046_3_);
}
protected void init() {
int startX = (this.width - 80) / FIELD_ID_X_OFFSET;
int startY = (this.height - 110) / FIELD_ID_X_OFFSET;
addRenderableWidget(new ImageButton(startX + 56, startY + 68, 20, 18, 215, 0, 19, PRINTER_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.CustomPrintScreen.1
C00721() {
}
public void onPress(Button arg0) {
Minecraft.getInstance().setScreen((Screen) null);
}
}));
addRenderableWidget(new ImageButton(startX + 56, startY + 88, 20, 18, 236, 0, 19, PRINTER_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.CustomPrintScreen.2
C00732() {
}
public void onPress(Button arg0) {
ItemStack itemStack = Minecraft.getInstance().player.getMainHandItem();
if (itemStack != null && ((itemStack.is(CustomBlocks.ITEM_CANVAS.get()) && itemStack.getTag() != null && itemStack.getTag().contains("UniqueId")) || itemStack.is(CustomBlocks.ITEM_CAMERA.get()))) {
float nX = CustomPrintScreen.this.xOffset;
if (CustomPrintScreen.this.negateX) {
nX = -nX;
}
float nY = CustomPrintScreen.this.yOffset;
if (CustomPrintScreen.this.negateY) {
nY = -nY;
}
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(CustomPrintScreen.this.blockWidth, CustomPrintScreen.this.blockHeight, nX, nY, CustomPrintScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
}
}));
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.CustomPrintScreen$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/CustomPrintScreen$1.class */
class C00721 implements Button.OnPress {
C00721() {
}
public void onPress(Button arg0) {
Minecraft.getInstance().setScreen((Screen) null);
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.CustomPrintScreen$2 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/CustomPrintScreen$2.class */
class C00732 implements Button.OnPress {
C00732() {
}
public void onPress(Button arg0) {
ItemStack itemStack = Minecraft.getInstance().player.getMainHandItem();
if (itemStack != null && ((itemStack.is(CustomBlocks.ITEM_CANVAS.get()) && itemStack.getTag() != null && itemStack.getTag().contains("UniqueId")) || itemStack.is(CustomBlocks.ITEM_CAMERA.get()))) {
float nX = CustomPrintScreen.this.xOffset;
if (CustomPrintScreen.this.negateX) {
nX = -nX;
}
float nY = CustomPrintScreen.this.yOffset;
if (CustomPrintScreen.this.negateY) {
nY = -nY;
}
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(CustomPrintScreen.this.blockWidth, CustomPrintScreen.this.blockHeight, nX, nY, CustomPrintScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
}
}
public boolean isPauseScreen() {
return false;
}
private void drawCenteredStringNoShadow(PoseStack p_238472_0_, Font p_238472_1_, Component p_238472_2_, int p_238472_3_, int p_238472_4_, int p_238472_5_) {
FormattedCharSequence lvt_6_1_ = p_238472_2_.getVisualOrderText();
p_238472_1_.draw(p_238472_0_, lvt_6_1_, p_238472_3_ - (p_238472_1_.width(lvt_6_1_) / FIELD_ID_X_OFFSET), p_238472_4_, p_238472_5_);
}
public void render(PoseStack matrixStack, int p_230430_2_, int p_230430_3_, float p_230430_4_) {
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, PRINTER_GUI);
int xStart = (this.width - 80) / FIELD_ID_X_OFFSET;
int yStart = (this.height - 110) / FIELD_ID_X_OFFSET;
m_93228_(matrixStack, xStart, yStart, 0, 0, 80, 110);
int fieldStartX = xStart + 5;
int fieldStartRightX = xStart + 48;
int fieldStartY = yStart + 20;
int fieldStartY2 = yStart + 55;
int fieldStartY3 = yStart + 88;
int r = CanvasData.getRValue(grayColor);
int g = CanvasData.getGValue(grayColor);
int b = CanvasData.getBValue(grayColor);
float fR = r / 255.0f;
float fG = g / 255.0f;
float fB = b / 255.0f;
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, PRINTER_GUI);
RenderSystem.setShaderColor(fR, fG, fB, 1.0f);
m_93228_(matrixStack, fieldStartX, fieldStartY, 5, 20, 27, 16);
m_93228_(matrixStack, fieldStartRightX, fieldStartY, 48, 20, 27, 16);
m_93228_(matrixStack, fieldStartX, fieldStartY2, 5, 55, 27, 16);
m_93228_(matrixStack, fieldStartX, fieldStartY3, 5, 88, 27, 16);
if (chosenX > 0 && chosenY > 0) {
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
m_93228_(matrixStack, chosenX, chosenY, 5, 20, 27, 16);
}
DecimalFormat df = new DecimalFormat("#.##");
String textWidth = df.format(this.blockWidth);
String textHeight = df.format(this.blockHeight);
float nX = this.xOffset;
if (this.negateX) {
nX = -nX;
}
float nY = this.yOffset;
if (this.negateY) {
nY = -nY;
}
String textXOffset = df.format(nX);
String textYOffset = df.format(nY);
drawCenteredStringNoShadow(matrixStack, this.minecraft.font, new TextComponent(textWidth), fieldStartX + 13, fieldStartY + 3, 0);
drawCenteredStringNoShadow(matrixStack, this.minecraft.font, new TextComponent(textHeight), fieldStartRightX + 13, fieldStartY + 3, 0);
drawCenteredStringNoShadow(matrixStack, this.minecraft.font, new TextComponent(textXOffset), fieldStartX + 13, fieldStartY2 + 3, 0);
drawCenteredStringNoShadow(matrixStack, this.minecraft.font, new TextComponent(textYOffset), fieldStartX + 13, fieldStartY3 + 3, 0);
super.render(matrixStack, p_230430_2_, p_230430_3_, p_230430_4_);
}
}

View File

@ -1,287 +0,0 @@
package com.dairymoose.modernlife.blocks.gui;
import com.dairymoose.modernlife.core.ModernLifeCommon;
import com.dairymoose.modernlife.util.CanvasData;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.ImageButton;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextColor;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.FormattedCharSequence;
import net.minecraft.world.level.Level;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@OnlyIn(Dist.CLIENT)
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/EaselCustomSizeScreen.class */
public class EaselCustomSizeScreen extends Screen {
final int GUI_WIDTH = 80;
final int GUI_HEIGHT = 58;
BlockPos pos;
Level level;
private static final String PRINT_SIZE = "Canvas Resize";
public static final int FIELD_START_X = 5;
public static final int FIELD_START_RIGHT_X = 48;
public static final int FIELD_START_Y = 20;
public static final int INPUT_FIELD_WIDTH = 27;
public static final int INPUT_FIELD_HEIGHT = 16;
public static final int TEXT_START_OFFSET_X = 13;
public static final int TEXT_START_OFFSET_Y = 3;
private int chosenFieldId;
private static final int FIELD_ID_WIDTH = 0;
private static final int FIELD_ID_HEIGHT = 1;
private static final int FIELD_ID_X_OFFSET = 2;
private static final int FIELD_ID_Y_OFFSET = 3;
public static final int CANCEL_BUTTON_START_X = 13;
public static final int CANCEL_BUTTON_START_Y = 37;
public static final int ACCEPT_BUTTON_START_X = 47;
public static final int ACCEPT_BUTTON_START_Y = 37;
private int texWidth;
private int texHeight;
private int blockWidthInputLength;
private int blockHeightInputLength;
private boolean negateX;
private boolean negateY;
private static final Logger LOGGER = LogManager.getLogger();
private static final ResourceLocation PRINTER_GUI = new ResourceLocation("modernlife", "textures/gui/gui_easel_custom_size.png");
public static int grayColor = 9145227;
public static int chosenX = -1;
public static int chosenY = -1;
private static Component getComponentForTitle(String title) {
return new TextComponent(title).m_6270_(Style.EMPTY.withColor(TextColor.fromRgb(4210752)));
}
private void goToEaselScreen() {
EaselScreen screen = new EaselScreen(this.level, this.pos);
screen.setTextureSize(this.texWidth, this.texHeight);
screen.setBlockPos(this.pos);
Minecraft.getInstance().setScreen(screen);
}
public EaselCustomSizeScreen(Level level, BlockPos pos) {
super(getComponentForTitle(PRINT_SIZE));
this.GUI_WIDTH = 80;
this.GUI_HEIGHT = 58;
this.chosenFieldId = -1;
this.texWidth = 64;
this.texHeight = 64;
this.blockWidthInputLength = 0;
this.blockHeightInputLength = 0;
this.negateX = false;
this.negateY = false;
chosenX = -1;
chosenY = -1;
this.pos = pos;
}
public boolean m_6375_(double clickX, double clickY, int mouseButton) {
int xStart = (this.width - 80) / FIELD_ID_X_OFFSET;
int yStart = (this.height - 58) / FIELD_ID_X_OFFSET;
int fieldStartX = xStart + 5;
int fieldStartRightX = xStart + 48;
int fieldStartY = yStart + 20;
int fieldEndX = fieldStartX + 27;
int fieldEndRightX = fieldStartRightX + 27;
int fieldEndY = fieldStartY + 16;
if (mouseButton == 0) {
if (clickX >= fieldStartX && clickX <= fieldEndX && clickY >= fieldStartY && clickY <= fieldEndY) {
this.chosenFieldId = 0;
setChosenFieldToZero();
chosenX = fieldStartX;
chosenY = fieldStartY;
}
if (clickX >= fieldStartRightX && clickX <= fieldEndRightX && clickY >= fieldStartY && clickY <= fieldEndY) {
this.chosenFieldId = 1;
setChosenFieldToZero();
chosenX = fieldStartRightX;
chosenY = fieldStartY;
}
}
return super.m_6375_(clickX, clickY, mouseButton);
}
public int applyInputToIntegerField(int field, int input, int inputCount) {
return (field * 10) + input;
}
public static int sanitizeInput(int input) {
if (input < 0) {
return 0;
}
if (input > 1000) {
return 1000;
}
return input;
}
public void addInputToChosenField(int input) {
if (this.chosenFieldId == -1) {
return;
}
if (this.chosenFieldId == 0) {
this.texWidth = applyInputToIntegerField(this.texWidth, input, this.blockWidthInputLength);
this.texWidth = sanitizeInput(this.texWidth);
this.blockWidthInputLength++;
}
if (this.chosenFieldId == 1) {
this.texHeight = applyInputToIntegerField(this.texHeight, input, this.blockHeightInputLength);
this.texHeight = sanitizeInput(this.texHeight);
this.blockHeightInputLength++;
}
}
public void setChosenFieldToZero() {
if (this.chosenFieldId == -1) {
return;
}
if (this.chosenFieldId == 0) {
this.texWidth = 0;
this.blockWidthInputLength = 0;
}
if (this.chosenFieldId == 1) {
this.texHeight = 0;
this.blockHeightInputLength = 0;
}
}
public void backspaceChosenField() {
if (this.chosenFieldId == -1) {
return;
}
if (this.chosenFieldId == 0) {
this.texWidth /= 10;
this.blockWidthInputLength = 1;
}
if (this.chosenFieldId == 1) {
this.texHeight /= 10;
this.blockHeightInputLength = 1;
}
}
public void negateChosenField() {
if (this.chosenFieldId == FIELD_ID_X_OFFSET) {
this.negateX = !this.negateX;
}
if (this.chosenFieldId == 3) {
this.negateY = !this.negateY;
}
}
public boolean keyPressed(int key, int p_231046_2_, int p_231046_3_) {
ModernLifeCommon.LOGGER.debug("key press: " + key);
if (key == 261) {
setChosenFieldToZero();
} else if (key == 259) {
backspaceChosenField();
} else if (key == 48 || (key >= 49 && key <= 57)) {
int digit = Character.digit(key, 10);
addInputToChosenField(digit);
} else if (key == 45) {
negateChosenField();
} else if (key == 257) {
return true;
}
return super.keyPressed(key, p_231046_2_, p_231046_3_);
}
protected void init() {
int startX = (this.width - 80) / FIELD_ID_X_OFFSET;
int startY = (this.height - 58) / FIELD_ID_X_OFFSET;
addRenderableWidget(new ImageButton(startX + 13, startY + 37, 20, 18, 215, 0, 19, PRINTER_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.EaselCustomSizeScreen.1
C00741() {
}
public void onPress(Button arg0) {
Minecraft.getInstance().setScreen((Screen) null);
}
}));
addRenderableWidget(new ImageButton(startX + 47, startY + 37, 20, 18, 236, 0, 19, PRINTER_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.EaselCustomSizeScreen.2
final /* synthetic */ EaselCustomSizeScreen val$thisPrinter;
C00752(EaselCustomSizeScreen this) {
this = this;
}
public void onPress(Button arg0) {
this.goToEaselScreen();
}
}));
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.EaselCustomSizeScreen$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/EaselCustomSizeScreen$1.class */
class C00741 implements Button.OnPress {
C00741() {
}
public void onPress(Button arg0) {
Minecraft.getInstance().setScreen((Screen) null);
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.EaselCustomSizeScreen$2 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/EaselCustomSizeScreen$2.class */
class C00752 implements Button.OnPress {
final /* synthetic */ EaselCustomSizeScreen val$thisPrinter;
C00752(EaselCustomSizeScreen this) {
this = this;
}
public void onPress(Button arg0) {
this.goToEaselScreen();
}
}
public boolean isPauseScreen() {
return false;
}
private void drawCenteredStringNoShadow(PoseStack p_238472_0_, Font p_238472_1_, Component p_238472_2_, int p_238472_3_, int p_238472_4_, int p_238472_5_) {
FormattedCharSequence lvt_6_1_ = p_238472_2_.getVisualOrderText();
p_238472_1_.draw(p_238472_0_, lvt_6_1_, p_238472_3_ - (p_238472_1_.width(lvt_6_1_) / FIELD_ID_X_OFFSET), p_238472_4_, p_238472_5_);
}
public void render(PoseStack matrixStack, int p_230430_2_, int p_230430_3_, float p_230430_4_) {
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, PRINTER_GUI);
int xStart = (this.width - 80) / FIELD_ID_X_OFFSET;
int yStart = (this.height - 58) / FIELD_ID_X_OFFSET;
m_93228_(matrixStack, xStart, yStart, 0, 0, 80, 58);
int fieldStartX = xStart + 5;
int fieldStartRightX = xStart + 48;
int fieldStartY = yStart + 20;
int r = CanvasData.getRValue(grayColor);
int g = CanvasData.getGValue(grayColor);
int b = CanvasData.getBValue(grayColor);
float fR = r / 255.0f;
float fG = g / 255.0f;
float fB = b / 255.0f;
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, PRINTER_GUI);
RenderSystem.setShaderColor(fR, fG, fB, 1.0f);
m_93228_(matrixStack, fieldStartX, fieldStartY, 5, 20, 27, 16);
m_93228_(matrixStack, fieldStartRightX, fieldStartY, 48, 20, 27, 16);
if (chosenX > 0 && chosenY > 0) {
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
m_93228_(matrixStack, chosenX, chosenY, 5, 20, 27, 16);
}
String widthText = String.valueOf(this.texWidth);
String heightText = String.valueOf(this.texHeight);
drawCenteredStringNoShadow(matrixStack, this.minecraft.font, new TextComponent(widthText), fieldStartX + 13, fieldStartY + 3, 0);
drawCenteredStringNoShadow(matrixStack, this.minecraft.font, new TextComponent(heightText), fieldStartRightX + 13, fieldStartY + 3, 0);
super.render(matrixStack, p_230430_2_, p_230430_3_, p_230430_4_);
}
}

View File

@ -1,212 +0,0 @@
package com.dairymoose.modernlife.blocks.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.ImageButton;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextColor;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.FormattedCharSequence;
import net.minecraft.world.level.Level;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@OnlyIn(Dist.CLIENT)
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/EaselSizeScreen.class */
public class EaselSizeScreen extends Screen {
private static final Logger LOGGER = LogManager.getLogger();
private static final ResourceLocation EASEL_SIZE_GUI = new ResourceLocation("modernlife", "textures/gui/gui_easel_optional.png");
final int GUI_WIDTH = 132;
final int GUI_HEIGHT = 175;
public int chosenSize;
public BlockPos pos;
public Level level;
private static final String PRINT_SIZE = "Canvas Resolution";
private static Component getComponentForTitle(String title) {
return new TextComponent(title).m_6270_(Style.EMPTY.withColor(TextColor.fromRgb(4210752)));
}
public EaselSizeScreen(Level level, BlockPos pos) {
super(getComponentForTitle(PRINT_SIZE));
this.GUI_WIDTH = 132;
this.GUI_HEIGHT = 175;
this.chosenSize = -1;
this.level = level;
this.pos = pos;
}
public boolean m_6348_(double p_94722_, double p_94723_, int p_94724_) {
return super.m_6348_(p_94722_, p_94723_, p_94724_);
}
private void goToEaselScreen() {
EaselScreen screen = new EaselScreen(this.level, this.pos);
screen.setTextureSize(this.chosenSize, this.chosenSize);
screen.setBlockPos(this.pos);
Minecraft.getInstance().setScreen(screen);
}
private void goToEaselCustomSizeScreen() {
EaselCustomSizeScreen screen = new EaselCustomSizeScreen(this.level, this.pos);
Minecraft.getInstance().setScreen(screen);
}
protected void init() {
int startX = ((this.width - 132) / 2) + 13;
int startY = ((this.height - 175) / 2) + 25;
addRenderableWidget(new ImageButton(startX, startY + 0, 106, 20, 150, 0, 20, EASEL_SIZE_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.EaselSizeScreen.1
C00841() {
}
public void onPress(Button arg0) {
EaselSizeScreen.this.chosenSize = 16;
EaselSizeScreen.this.goToEaselScreen();
}
}));
addRenderableWidget(new ImageButton(startX, startY + 24, 106, 20, 150, 40, 20, EASEL_SIZE_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.EaselSizeScreen.2
C00852() {
}
public void onPress(Button arg0) {
EaselSizeScreen.this.chosenSize = 32;
EaselSizeScreen.this.goToEaselScreen();
}
}));
addRenderableWidget(new ImageButton(startX, startY + 48, 106, 20, 150, 80, 20, EASEL_SIZE_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.EaselSizeScreen.3
C00863() {
}
public void onPress(Button arg0) {
EaselSizeScreen.this.chosenSize = 64;
EaselSizeScreen.this.goToEaselScreen();
}
}));
addRenderableWidget(new ImageButton(startX, startY + 72, 106, 20, 150, 120, 20, EASEL_SIZE_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.EaselSizeScreen.4
C00874() {
}
public void onPress(Button arg0) {
EaselSizeScreen.this.chosenSize = 128;
EaselSizeScreen.this.goToEaselScreen();
}
}));
addRenderableWidget(new ImageButton(startX, startY + 96, 106, 20, 150, 160, 20, EASEL_SIZE_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.EaselSizeScreen.5
C00885() {
}
public void onPress(Button arg0) {
EaselSizeScreen.this.chosenSize = 256;
EaselSizeScreen.this.goToEaselScreen();
}
}));
addRenderableWidget(new ImageButton(startX, startY + 120, 106, 20, 150, 200, 20, EASEL_SIZE_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.EaselSizeScreen.6
C00896() {
}
public void onPress(Button arg0) {
EaselSizeScreen.this.goToEaselCustomSizeScreen();
}
}));
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.EaselSizeScreen$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/EaselSizeScreen$1.class */
class C00841 implements Button.OnPress {
C00841() {
}
public void onPress(Button arg0) {
EaselSizeScreen.this.chosenSize = 16;
EaselSizeScreen.this.goToEaselScreen();
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.EaselSizeScreen$2 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/EaselSizeScreen$2.class */
class C00852 implements Button.OnPress {
C00852() {
}
public void onPress(Button arg0) {
EaselSizeScreen.this.chosenSize = 32;
EaselSizeScreen.this.goToEaselScreen();
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.EaselSizeScreen$3 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/EaselSizeScreen$3.class */
class C00863 implements Button.OnPress {
C00863() {
}
public void onPress(Button arg0) {
EaselSizeScreen.this.chosenSize = 64;
EaselSizeScreen.this.goToEaselScreen();
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.EaselSizeScreen$4 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/EaselSizeScreen$4.class */
class C00874 implements Button.OnPress {
C00874() {
}
public void onPress(Button arg0) {
EaselSizeScreen.this.chosenSize = 128;
EaselSizeScreen.this.goToEaselScreen();
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.EaselSizeScreen$5 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/EaselSizeScreen$5.class */
class C00885 implements Button.OnPress {
C00885() {
}
public void onPress(Button arg0) {
EaselSizeScreen.this.chosenSize = 256;
EaselSizeScreen.this.goToEaselScreen();
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.EaselSizeScreen$6 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/EaselSizeScreen$6.class */
class C00896 implements Button.OnPress {
C00896() {
}
public void onPress(Button arg0) {
EaselSizeScreen.this.goToEaselCustomSizeScreen();
}
}
public boolean isPauseScreen() {
return false;
}
private void drawCenteredStringNoShadow(PoseStack p_238472_0_, Font p_238472_1_, Component p_238472_2_, int p_238472_3_, int p_238472_4_, int p_238472_5_) {
FormattedCharSequence lvt_6_1_ = p_238472_2_.getVisualOrderText();
p_238472_1_.draw(p_238472_0_, lvt_6_1_, p_238472_3_ - (p_238472_1_.width(lvt_6_1_) / 2), p_238472_4_, p_238472_5_);
}
public void render(PoseStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) {
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, EASEL_SIZE_GUI);
int lvt_5_1_ = (this.width - 132) / 2;
int lvt_6_1_ = (this.height - 175) / 2;
m_93228_(p_230430_1_, lvt_5_1_, lvt_6_1_, 0, 0, 132, 175);
drawCenteredStringNoShadow(p_230430_1_, this.minecraft.font, this.title, lvt_5_1_ + 66, lvt_6_1_ + 5, 0);
super.render(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_);
}
}

View File

@ -1,222 +0,0 @@
package com.dairymoose.modernlife.blocks.gui;
import com.dairymoose.modernlife.core.CustomBlocks;
import com.dairymoose.modernlife.core.ModernLifeCommon;
import com.dairymoose.modernlife.core.ModernLifeNetwork;
import com.dairymoose.modernlife.items.GuitarItem;
import com.dairymoose.modernlife.network.play.client.ServerboundGuitarPacket;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextColor;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.FormattedCharSequence;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@OnlyIn(Dist.CLIENT)
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/GuitarScreen.class */
public class GuitarScreen extends Screen {
private static final Logger LOGGER = LogManager.getLogger();
private static final ResourceLocation GUITAR_GUI = new ResourceLocation("modernlife", "textures/gui/mc_guitar_keys_full.png");
final int GUI_WIDTH = 256;
final int GUI_HEIGHT = 134;
private Level world;
private Player player;
GuitarItem.Tuning string;
int lastPlayedFret;
int counter;
char[] fretKeys;
char[] stringKeys;
public GuitarScreen(Level world, Player player) {
super(new TextComponent("Guitar").m_6270_(Style.EMPTY.withColor(TextColor.fromRgb(4210752))));
this.GUI_WIDTH = 256;
this.GUI_HEIGHT = 134;
this.string = GuitarItem.Tuning.STRING_E;
this.lastPlayedFret = -1;
this.counter = 1;
this.fretKeys = new char[]{'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V', 'B', 'N'};
this.stringKeys = new char[]{'1', '2', '3', '4', '5', '6'};
this.world = world;
this.player = player;
}
protected void init() {
ModernLifeCommon.LOGGER.debug("in init!");
int i = (this.width - 256) / 2;
int i2 = (this.height - 134) / 2;
}
public boolean isPauseScreen() {
return false;
}
private boolean areaContainsAmplifier(BlockPos pos) {
BlockState state = this.world.getBlockState(pos);
if (state.is(CustomBlocks.BLOCK_GUITAR_AMPLIFIER.get())) {
return true;
}
BlockState state2 = this.world.getBlockState(pos.above());
if (state2.is(CustomBlocks.BLOCK_GUITAR_AMPLIFIER.get())) {
return true;
}
BlockState state3 = this.world.getBlockState(pos.below());
if (state3.is(CustomBlocks.BLOCK_GUITAR_AMPLIFIER.get())) {
return true;
}
return false;
}
public boolean isNearAmplifier(Level world, BlockPos pos) {
if (world == null || pos == null) {
return false;
}
for (int x = -6; x < 6; x++) {
for (int z = -6; z < 6; z++) {
BlockPos searchPos = pos.east(x);
if (areaContainsAmplifier(searchPos.south(z))) {
return true;
}
}
}
return false;
}
public void applyGuitarStringChange(int stringNo) {
if (stringNo == 1) {
this.string = GuitarItem.Tuning.STRING_E;
return;
}
if (stringNo == 2) {
this.string = GuitarItem.Tuning.STRING_A;
return;
}
if (stringNo == 3) {
this.string = GuitarItem.Tuning.STRING_D;
return;
}
if (stringNo == 4) {
this.string = GuitarItem.Tuning.STRING_G;
} else if (stringNo == 5) {
this.string = GuitarItem.Tuning.STRING_B;
} else if (stringNo == 6) {
this.string = GuitarItem.Tuning.STRING_HI_E;
}
}
public int getGuitarStringNo() {
if (this.string == GuitarItem.Tuning.STRING_E) {
return 1;
}
if (this.string == GuitarItem.Tuning.STRING_A) {
return 2;
}
if (this.string == GuitarItem.Tuning.STRING_D) {
return 3;
}
if (this.string == GuitarItem.Tuning.STRING_G) {
return 4;
}
if (this.string == GuitarItem.Tuning.STRING_B) {
return 5;
}
if (this.string == GuitarItem.Tuning.STRING_HI_E) {
return 6;
}
return 1;
}
public boolean m_6050_(double a, double b, double c) {
int currentStringNo = getGuitarStringNo();
if (c > 0.0d) {
applyGuitarStringChange(currentStringNo - 1);
} else {
applyGuitarStringChange(currentStringNo + 1);
}
return super.m_6050_(a, b, c);
}
public boolean keyPressed(int key, int p_231046_2_, int p_231046_3_) {
ModernLifeCommon.LOGGER.debug("key press: " + key);
int keyIndex = ArrayUtils.indexOf(this.stringKeys, (char) key);
if (keyIndex != -1) {
int stringNo = keyIndex + 1;
applyGuitarStringChange(stringNo);
}
int keyIndex2 = ArrayUtils.indexOf(this.fretKeys, (char) key);
boolean distorted = isNearAmplifier(this.world, this.player.blockPosition());
if (keyIndex2 != -1) {
int fret = keyIndex2 + 1;
if (this.player != null && this.world != null) {
ServerboundGuitarPacket.playGuitarSound(this.world, this.player, this.player.blockPosition(), ServerboundGuitarPacket.getSoundEvent(this.string, distorted), distorted, fret);
}
ServerboundGuitarPacket packet = new ServerboundGuitarPacket(this.string, fret, distorted);
ModernLifeNetwork.INSTANCE.sendToServer(packet);
this.lastPlayedFret = fret - 1;
}
return super.keyPressed(key, p_231046_2_, p_231046_3_);
}
private void drawCenteredStringNoShadow(PoseStack p_238472_0_, Font p_238472_1_, Component p_238472_2_, int p_238472_3_, int p_238472_4_, int p_238472_5_) {
FormattedCharSequence lvt_6_1_ = p_238472_2_.getVisualOrderText();
p_238472_1_.draw(p_238472_0_, lvt_6_1_, p_238472_3_ - (p_238472_1_.width(lvt_6_1_) / 2), p_238472_4_, p_238472_5_);
}
private String numberSuffix(int fret) {
int lastDigit = fret % 10;
if (fret == 11 || fret == 12 || fret == 13) {
return "th";
}
if (lastDigit == 1) {
return "st";
}
if (lastDigit == 2) {
return "nd";
}
if (lastDigit == 3) {
return "rd";
}
return "th";
}
public void render(PoseStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) {
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, GUITAR_GUI);
int lvt_5_1_ = (this.width - 256) / 2;
int lvt_6_1_ = (this.height - 134) / 2;
m_93228_(p_230430_1_, lvt_5_1_, lvt_6_1_, 0, 0, 256, 134);
String stringText = "";
if (this.string == GuitarItem.Tuning.STRING_E) {
stringText = "E String";
} else if (this.string == GuitarItem.Tuning.STRING_A) {
stringText = "A String";
} else if (this.string == GuitarItem.Tuning.STRING_D) {
stringText = "D String";
} else if (this.string == GuitarItem.Tuning.STRING_G) {
stringText = "G String";
} else if (this.string == GuitarItem.Tuning.STRING_B) {
stringText = "B String";
} else if (this.string == GuitarItem.Tuning.STRING_HI_E) {
stringText = "High E String";
}
drawCenteredStringNoShadow(p_230430_1_, this.minecraft.font, new TextComponent(stringText).m_6270_(Style.EMPTY.withColor(TextColor.fromRgb(16777215))), lvt_5_1_ + 128, lvt_6_1_ + 53, 0);
if (this.lastPlayedFret != -1) {
String fretText = this.lastPlayedFret + numberSuffix(this.lastPlayedFret) + " fret";
drawCenteredStringNoShadow(p_230430_1_, this.minecraft.font, new TextComponent(fretText).m_6270_(Style.EMPTY.withColor(TextColor.fromRgb(16777215))), lvt_5_1_ + 128, lvt_6_1_ + 140, 0);
}
super.render(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_);
}
}

View File

@ -1,35 +0,0 @@
package com.dairymoose.modernlife.blocks.gui;
import net.minecraft.core.BlockPos;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/HBlockPos.class */
public class HBlockPos extends BlockPos {
private static final long serialVersionUID = 799381105435813824L;
public HBlockPos(int x, int y, int z) {
super(x, y, z);
}
public HBlockPos(BlockPos pos) {
super(pos.getX(), pos.getY(), pos.getZ());
}
public int hashCode() {
int result = (31 * 1) + getX();
return (31 * ((31 * result) + getY())) + getZ();
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (getClass() != obj.getClass()) {
return false;
}
HBlockPos other = (HBlockPos) obj;
if (getX() != other.getX() || getY() != other.getY() || getZ() != other.getZ()) {
return false;
}
return true;
}
}

View File

@ -1,31 +0,0 @@
package com.dairymoose.modernlife.blocks.gui;
import java.awt.Point;
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/HPoint.class */
public class HPoint extends Point {
private static final long serialVersionUID = 799338005435813486L;
public HPoint(int x, int y) {
super(x, y);
}
public int hashCode() {
int result = (31 * 1) + this.x;
return (31 * result) + this.y;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (getClass() != obj.getClass()) {
return false;
}
HPoint other = (HPoint) obj;
if (this.x != other.x || this.y != other.y) {
return false;
}
return true;
}
}

View File

@ -1,187 +0,0 @@
package com.dairymoose.modernlife.blocks.gui;
import com.dairymoose.modernlife.core.CustomBlocks;
import com.dairymoose.modernlife.core.ModernLifeNetwork;
import com.dairymoose.modernlife.network.play.client.ServerboundCanvasCopyRequestPacket;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.ImageButton;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextColor;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.FormattedCharSequence;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@OnlyIn(Dist.CLIENT)
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/PhotocopierScreen.class */
public class PhotocopierScreen extends Screen {
private static final Logger LOGGER = LogManager.getLogger();
private static final ResourceLocation PHOTOCOPIER_GUI = new ResourceLocation("modernlife", "textures/gui/gui_photocopier.png");
final int GUI_WIDTH = 80;
final int GUI_HEIGHT = 68;
public static final int UP_ARROW_X = 42;
public static final int UP_ARROW_Y = 23;
public static final int DOWN_ARROW_X = 42;
public static final int DOWN_ARROW_Y = 37;
public static final int CANCEL_X = 18;
public static final int CANCEL_Y = 51;
public static final int ACCEPT_X = 48;
public static final int ACCEPT_Y = 51;
public static final int COPIES_TEXT_X = 22;
public static final int COPIES_TEXT_Y = 32;
public int numberOfCopies;
BlockPos pos;
private static final String PHOTOCOPIER_TEXT = "Photocopier";
private static Component getComponentForTitle(String title) {
return new TextComponent(title).m_6270_(Style.EMPTY.withColor(TextColor.fromRgb(4210752)));
}
public PhotocopierScreen(BlockPos pos) {
super(getComponentForTitle(PHOTOCOPIER_TEXT));
this.GUI_WIDTH = 80;
this.GUI_HEIGHT = 68;
this.numberOfCopies = 1;
this.pos = pos;
}
protected void init() {
int startX = (this.width - 80) / 2;
int startY = (this.height - 68) / 2;
addRenderableWidget(new ImageButton(startX + 42, startY + 37, 14, 13, 81, 0, 14, PHOTOCOPIER_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.PhotocopierScreen.1
C00901() {
}
public void onPress(Button arg0) {
PhotocopierScreen.this.numberOfCopies--;
PhotocopierScreen.this.numberOfCopies = ServerboundCanvasCopyRequestPacket.sanitizeNumberOfCopies(PhotocopierScreen.this.numberOfCopies);
}
}));
addRenderableWidget(new ImageButton(startX + 42, startY + 23, 14, 13, 96, 0, 14, PHOTOCOPIER_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.PhotocopierScreen.2
C00912() {
}
public void onPress(Button arg0) {
PhotocopierScreen.this.numberOfCopies++;
PhotocopierScreen.this.numberOfCopies = ServerboundCanvasCopyRequestPacket.sanitizeNumberOfCopies(PhotocopierScreen.this.numberOfCopies);
}
}));
addRenderableWidget(new ImageButton(startX + 18, startY + 51, 14, 13, 111, 0, 14, PHOTOCOPIER_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.PhotocopierScreen.3
C00923() {
}
public void onPress(Button arg0) {
Minecraft.getInstance().setScreen((Screen) null);
}
}));
addRenderableWidget(new ImageButton(startX + 48, startY + 51, 14, 13, 126, 0, 14, PHOTOCOPIER_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.PhotocopierScreen.4
C00934() {
}
public void onPress(Button arg0) {
CompoundTag tag;
if (PhotocopierScreen.this.numberOfCopies <= 0) {
Minecraft.getInstance().setScreen((Screen) null);
return;
}
ItemStack canvasItem = Minecraft.getInstance().player.getMainHandItem();
if (canvasItem.is(CustomBlocks.ITEM_CANVAS.get()) && (tag = canvasItem.getTag()) != null && tag.contains("UniqueId")) {
Minecraft.getInstance().player.displayClientMessage(new TextComponent("Job added to queue"), false);
long uniqueId = tag.getLong("UniqueId");
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundCanvasCopyRequestPacket(uniqueId, PhotocopierScreen.this.numberOfCopies, canvasItem.getTag(), PhotocopierScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
}
}));
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.PhotocopierScreen$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/PhotocopierScreen$1.class */
class C00901 implements Button.OnPress {
C00901() {
}
public void onPress(Button arg0) {
PhotocopierScreen.this.numberOfCopies--;
PhotocopierScreen.this.numberOfCopies = ServerboundCanvasCopyRequestPacket.sanitizeNumberOfCopies(PhotocopierScreen.this.numberOfCopies);
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.PhotocopierScreen$2 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/PhotocopierScreen$2.class */
class C00912 implements Button.OnPress {
C00912() {
}
public void onPress(Button arg0) {
PhotocopierScreen.this.numberOfCopies++;
PhotocopierScreen.this.numberOfCopies = ServerboundCanvasCopyRequestPacket.sanitizeNumberOfCopies(PhotocopierScreen.this.numberOfCopies);
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.PhotocopierScreen$3 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/PhotocopierScreen$3.class */
class C00923 implements Button.OnPress {
C00923() {
}
public void onPress(Button arg0) {
Minecraft.getInstance().setScreen((Screen) null);
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.PhotocopierScreen$4 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/PhotocopierScreen$4.class */
class C00934 implements Button.OnPress {
C00934() {
}
public void onPress(Button arg0) {
CompoundTag tag;
if (PhotocopierScreen.this.numberOfCopies <= 0) {
Minecraft.getInstance().setScreen((Screen) null);
return;
}
ItemStack canvasItem = Minecraft.getInstance().player.getMainHandItem();
if (canvasItem.is(CustomBlocks.ITEM_CANVAS.get()) && (tag = canvasItem.getTag()) != null && tag.contains("UniqueId")) {
Minecraft.getInstance().player.displayClientMessage(new TextComponent("Job added to queue"), false);
long uniqueId = tag.getLong("UniqueId");
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundCanvasCopyRequestPacket(uniqueId, PhotocopierScreen.this.numberOfCopies, canvasItem.getTag(), PhotocopierScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
}
}
public boolean isPauseScreen() {
return false;
}
private void drawCenteredStringNoShadow(PoseStack p_238472_0_, Font p_238472_1_, Component p_238472_2_, int p_238472_3_, int p_238472_4_, int p_238472_5_) {
FormattedCharSequence lvt_6_1_ = p_238472_2_.getVisualOrderText();
p_238472_1_.draw(p_238472_0_, lvt_6_1_, p_238472_3_ - (p_238472_1_.width(lvt_6_1_) / 2), p_238472_4_, p_238472_5_);
}
public void render(PoseStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) {
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, PHOTOCOPIER_GUI);
int startX = (this.width - 80) / 2;
int startY = (this.height - 68) / 2;
m_93228_(p_230430_1_, startX, startY, 0, 0, 80, 68);
String copiesText = String.valueOf(this.numberOfCopies);
drawCenteredStringNoShadow(p_230430_1_, this.minecraft.font, new TextComponent(copiesText), startX + 22, startY + 32, 0);
super.render(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_);
}
}

View File

@ -1,311 +0,0 @@
package com.dairymoose.modernlife.blocks.gui;
import com.dairymoose.modernlife.core.ModernLifeNetwork;
import com.dairymoose.modernlife.network.play.client.ServerboundPrintSizePacket;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.ImageButton;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextColor;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.FormattedCharSequence;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@OnlyIn(Dist.CLIENT)
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/PrinterScreen.class */
public class PrinterScreen extends Screen {
private static final Logger LOGGER = LogManager.getLogger();
private static final ResourceLocation PRINTER_GUI = new ResourceLocation("modernlife", "textures/gui/gui_printer.png");
final int GUI_WIDTH = 132;
final int GUI_HEIGHT = 175;
BlockPos pos;
private boolean widePrintMode;
private static final String PRINT_SIZE = "Print Size";
private static Component getComponentForTitle(String title) {
return new TextComponent(title).m_6270_(Style.EMPTY.withColor(TextColor.fromRgb(4210752)));
}
public PrinterScreen(BlockPos pos) {
super(getComponentForTitle(PRINT_SIZE));
this.GUI_WIDTH = 132;
this.GUI_HEIGHT = 175;
this.widePrintMode = true;
this.pos = pos;
}
protected void addSquareButton(int startX, int startY) {
if (this.widePrintMode) {
addRenderableWidget(new ImageButton(startX, startY + 96, 106, 20, 150, 160, 20, PRINTER_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.PrinterScreen.1
final /* synthetic */ PrinterScreen val$thisPrinter;
final /* synthetic */ int val$startX;
final /* synthetic */ int val$startY;
C00941(PrinterScreen this, int startX2, int startY2) {
this = this;
startX = startX2;
startY = startY2;
}
public void onPress(Button arg0) {
this.removeWidget(arg0);
this.widePrintMode = false;
this.addSquareButton(startX, startY);
}
}));
} else {
addRenderableWidget(new ImageButton(startX2, startY2 + 96, 106, 20, 150, 200, 20, PRINTER_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.PrinterScreen.2
final /* synthetic */ PrinterScreen val$thisPrinter;
final /* synthetic */ int val$startX;
final /* synthetic */ int val$startY;
C00952(PrinterScreen this, int startX2, int startY2) {
this = this;
startX = startX2;
startY = startY2;
}
public void onPress(Button arg0) {
this.removeWidget(arg0);
this.widePrintMode = true;
this.addSquareButton(startX, startY);
}
}));
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.PrinterScreen$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/PrinterScreen$1.class */
public class C00941 implements Button.OnPress {
final /* synthetic */ PrinterScreen val$thisPrinter;
final /* synthetic */ int val$startX;
final /* synthetic */ int val$startY;
C00941(PrinterScreen this, int startX2, int startY2) {
this = this;
startX = startX2;
startY = startY2;
}
public void onPress(Button arg0) {
this.removeWidget(arg0);
this.widePrintMode = false;
this.addSquareButton(startX, startY);
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.PrinterScreen$2 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/PrinterScreen$2.class */
public class C00952 implements Button.OnPress {
final /* synthetic */ PrinterScreen val$thisPrinter;
final /* synthetic */ int val$startX;
final /* synthetic */ int val$startY;
C00952(PrinterScreen this, int startX2, int startY2) {
this = this;
startX = startX2;
startY = startY2;
}
public void onPress(Button arg0) {
this.removeWidget(arg0);
this.widePrintMode = true;
this.addSquareButton(startX, startY);
}
}
protected void init() {
int startX = ((this.width - 132) / 2) + 13;
int startY = ((this.height - 175) / 2) + 25;
addRenderableWidget(new ImageButton(startX, startY + 0, 106, 20, 150, 0, 20, PRINTER_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.PrinterScreen.3
final /* synthetic */ PrinterScreen val$thisPrinter;
C00963(PrinterScreen this) {
this = this;
}
public void onPress(Button arg0) {
if (this.widePrintMode) {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(1, PrinterScreen.this.pos));
} else {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(1, PrinterScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
}
}));
addRenderableWidget(new ImageButton(startX, startY + 24, 106, 20, 150, 40, 20, PRINTER_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.PrinterScreen.4
final /* synthetic */ PrinterScreen val$thisPrinter;
C00974(PrinterScreen this) {
this = this;
}
public void onPress(Button arg0) {
if (this.widePrintMode) {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(2, PrinterScreen.this.pos));
} else {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(5, PrinterScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
}
}));
addRenderableWidget(new ImageButton(startX, startY + 48, 106, 20, 150, 80, 20, PRINTER_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.PrinterScreen.5
final /* synthetic */ PrinterScreen val$thisPrinter;
C00985(PrinterScreen this) {
this = this;
}
public void onPress(Button arg0) {
if (this.widePrintMode) {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(3, PrinterScreen.this.pos));
} else {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(6, PrinterScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
}
}));
addRenderableWidget(new ImageButton(startX, startY + 72, 106, 20, 150, 120, 20, PRINTER_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.PrinterScreen.6
final /* synthetic */ PrinterScreen val$thisPrinter;
C00996(PrinterScreen this) {
this = this;
}
public void onPress(Button arg0) {
if (this.widePrintMode) {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(4, PrinterScreen.this.pos));
} else {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(7, PrinterScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
}
}));
addSquareButton(startX, startY);
addRenderableWidget(new ImageButton(startX, startY + 120, 106, 20, 44, 200, 20, PRINTER_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.PrinterScreen.7
C01007() {
}
public void onPress(Button arg0) {
Minecraft.getInstance().setScreen(new CustomPrintScreen(PrinterScreen.this.pos));
}
}));
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.PrinterScreen$3 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/PrinterScreen$3.class */
class C00963 implements Button.OnPress {
final /* synthetic */ PrinterScreen val$thisPrinter;
C00963(PrinterScreen this) {
this = this;
}
public void onPress(Button arg0) {
if (this.widePrintMode) {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(1, PrinterScreen.this.pos));
} else {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(1, PrinterScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.PrinterScreen$4 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/PrinterScreen$4.class */
class C00974 implements Button.OnPress {
final /* synthetic */ PrinterScreen val$thisPrinter;
C00974(PrinterScreen this) {
this = this;
}
public void onPress(Button arg0) {
if (this.widePrintMode) {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(2, PrinterScreen.this.pos));
} else {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(5, PrinterScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.PrinterScreen$5 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/PrinterScreen$5.class */
class C00985 implements Button.OnPress {
final /* synthetic */ PrinterScreen val$thisPrinter;
C00985(PrinterScreen this) {
this = this;
}
public void onPress(Button arg0) {
if (this.widePrintMode) {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(3, PrinterScreen.this.pos));
} else {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(6, PrinterScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.PrinterScreen$6 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/PrinterScreen$6.class */
class C00996 implements Button.OnPress {
final /* synthetic */ PrinterScreen val$thisPrinter;
C00996(PrinterScreen this) {
this = this;
}
public void onPress(Button arg0) {
if (this.widePrintMode) {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(4, PrinterScreen.this.pos));
} else {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundPrintSizePacket(7, PrinterScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.PrinterScreen$7 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/PrinterScreen$7.class */
class C01007 implements Button.OnPress {
C01007() {
}
public void onPress(Button arg0) {
Minecraft.getInstance().setScreen(new CustomPrintScreen(PrinterScreen.this.pos));
}
}
public boolean isPauseScreen() {
return false;
}
private void drawCenteredStringNoShadow(PoseStack p_238472_0_, Font p_238472_1_, Component p_238472_2_, int p_238472_3_, int p_238472_4_, int p_238472_5_) {
FormattedCharSequence lvt_6_1_ = p_238472_2_.getVisualOrderText();
p_238472_1_.draw(p_238472_0_, lvt_6_1_, p_238472_3_ - (p_238472_1_.width(lvt_6_1_) / 2), p_238472_4_, p_238472_5_);
}
public void render(PoseStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) {
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, PRINTER_GUI);
int lvt_5_1_ = (this.width - 132) / 2;
int lvt_6_1_ = (this.height - 175) / 2;
m_93228_(p_230430_1_, lvt_5_1_, lvt_6_1_, 0, 0, 132, 175);
drawCenteredStringNoShadow(p_230430_1_, this.minecraft.font, this.title, lvt_5_1_ + 66, lvt_6_1_ + 5, 0);
super.render(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_);
}
}

View File

@ -1,191 +0,0 @@
package com.dairymoose.modernlife.blocks.gui;
import com.dairymoose.modernlife.blocks.RadiatorBlock;
import com.dairymoose.modernlife.core.ModernLifeCommon;
import com.dairymoose.modernlife.core.ModernLifeNetwork;
import com.dairymoose.modernlife.network.play.client.ServerboundRadiatorPacket;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.ImageButton;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextColor;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.FormattedCharSequence;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@OnlyIn(Dist.CLIENT)
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/RadiatorScreen.class */
public class RadiatorScreen extends Screen {
private static final Logger LOGGER = LogManager.getLogger();
private static final ResourceLocation RADIATOR_GUI = new ResourceLocation("modernlife", "textures/gui/gui_radiator_all.png");
final int GUI_WIDTH = 126;
final int GUI_HEIGHT = 42;
private Level world;
private BlockPos pos;
public RadiatorScreen(Level world, BlockPos radiatorBlock) {
super(new TextComponent("Radiator").m_6270_(Style.EMPTY.withColor(TextColor.fromRgb(4210752))));
this.GUI_WIDTH = 126;
this.GUI_HEIGHT = 42;
this.world = null;
this.pos = null;
this.world = world;
this.pos = radiatorBlock;
}
protected void init() {
ModernLifeCommon.LOGGER.debug("in init!");
int startX = ((this.width - 126) / 2) + 5;
int startY = ((this.height - 42) / 2) + 11;
addRenderableWidget(new ImageButton(startX, startY, 24, 24, 5, 11, 42, RADIATOR_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.RadiatorScreen.1
C01011() {
}
public void onPress(Button arg0) {
BlockState bs = RadiatorScreen.this.world.getBlockState(RadiatorScreen.this.pos);
if (bs.getBlock().getClass() == RadiatorBlock.class) {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundRadiatorPacket(RadiatorBlock.HeatType.off, RadiatorScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
ModernLifeCommon.LOGGER.debug("pressed button: off");
}
}));
addRenderableWidget(new ImageButton(startX + 30, startY, 24, 24, 35, 11, 42, RADIATOR_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.RadiatorScreen.2
C01022() {
}
public void onPress(Button arg0) {
BlockState bs = RadiatorScreen.this.world.getBlockState(RadiatorScreen.this.pos);
if (bs.getBlock().getClass() == RadiatorBlock.class) {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundRadiatorPacket(RadiatorBlock.HeatType.low, RadiatorScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
ModernLifeCommon.LOGGER.debug("pressed button: low");
}
}));
addRenderableWidget(new ImageButton(startX + 60, startY, 24, 24, 65, 11, 42, RADIATOR_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.RadiatorScreen.3
C01033() {
}
public void onPress(Button arg0) {
BlockState bs = RadiatorScreen.this.world.getBlockState(RadiatorScreen.this.pos);
if (bs.getBlock().getClass() == RadiatorBlock.class) {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundRadiatorPacket(RadiatorBlock.HeatType.medium, RadiatorScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
ModernLifeCommon.LOGGER.debug("pressed button: med");
}
}));
addRenderableWidget(new ImageButton(startX + 90, startY, 24, 24, 95, 11, 42, RADIATOR_GUI, new Button.OnPress() { // from class: com.dairymoose.modernlife.blocks.gui.RadiatorScreen.4
C01044() {
}
public void onPress(Button arg0) {
BlockState bs = RadiatorScreen.this.world.getBlockState(RadiatorScreen.this.pos);
if (bs.getBlock().getClass() == RadiatorBlock.class) {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundRadiatorPacket(RadiatorBlock.HeatType.high, RadiatorScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
ModernLifeCommon.LOGGER.debug("pressed button: high");
}
}));
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.RadiatorScreen$1 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/RadiatorScreen$1.class */
class C01011 implements Button.OnPress {
C01011() {
}
public void onPress(Button arg0) {
BlockState bs = RadiatorScreen.this.world.getBlockState(RadiatorScreen.this.pos);
if (bs.getBlock().getClass() == RadiatorBlock.class) {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundRadiatorPacket(RadiatorBlock.HeatType.off, RadiatorScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
ModernLifeCommon.LOGGER.debug("pressed button: off");
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.RadiatorScreen$2 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/RadiatorScreen$2.class */
class C01022 implements Button.OnPress {
C01022() {
}
public void onPress(Button arg0) {
BlockState bs = RadiatorScreen.this.world.getBlockState(RadiatorScreen.this.pos);
if (bs.getBlock().getClass() == RadiatorBlock.class) {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundRadiatorPacket(RadiatorBlock.HeatType.low, RadiatorScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
ModernLifeCommon.LOGGER.debug("pressed button: low");
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.RadiatorScreen$3 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/RadiatorScreen$3.class */
class C01033 implements Button.OnPress {
C01033() {
}
public void onPress(Button arg0) {
BlockState bs = RadiatorScreen.this.world.getBlockState(RadiatorScreen.this.pos);
if (bs.getBlock().getClass() == RadiatorBlock.class) {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundRadiatorPacket(RadiatorBlock.HeatType.medium, RadiatorScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
ModernLifeCommon.LOGGER.debug("pressed button: med");
}
}
/* renamed from: com.dairymoose.modernlife.blocks.gui.RadiatorScreen$4 */
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/RadiatorScreen$4.class */
class C01044 implements Button.OnPress {
C01044() {
}
public void onPress(Button arg0) {
BlockState bs = RadiatorScreen.this.world.getBlockState(RadiatorScreen.this.pos);
if (bs.getBlock().getClass() == RadiatorBlock.class) {
ModernLifeNetwork.INSTANCE.sendToServer(new ServerboundRadiatorPacket(RadiatorBlock.HeatType.high, RadiatorScreen.this.pos));
}
Minecraft.getInstance().setScreen((Screen) null);
ModernLifeCommon.LOGGER.debug("pressed button: high");
}
}
public boolean isPauseScreen() {
return false;
}
private void drawCenteredStringNoShadow(PoseStack p_238472_0_, Font p_238472_1_, Component p_238472_2_, int p_238472_3_, int p_238472_4_, int p_238472_5_) {
FormattedCharSequence lvt_6_1_ = p_238472_2_.getVisualOrderText();
p_238472_1_.draw(p_238472_0_, lvt_6_1_, p_238472_3_ - (p_238472_1_.width(lvt_6_1_) / 2), p_238472_4_, p_238472_5_);
}
public void render(PoseStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) {
renderBackground(p_230430_1_);
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
RenderSystem.setShaderTexture(0, RADIATOR_GUI);
int lvt_5_1_ = (this.width - 126) / 2;
int lvt_6_1_ = (this.height - 42) / 2;
m_93228_(p_230430_1_, lvt_5_1_, lvt_6_1_, 0, 0, 126, 42);
drawCenteredStringNoShadow(p_230430_1_, this.minecraft.font, this.title, lvt_5_1_ + 63, lvt_6_1_ + 2, 0);
super.render(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_);
}
}

View File

@ -1,55 +0,0 @@
package com.dairymoose.modernlife.blocks.gui;
import com.dairymoose.inventory.container.TrashCanContainer;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@OnlyIn(Dist.CLIENT)
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/SeedSpreaderScreen.class */
public class SeedSpreaderScreen extends AbstractContainerScreen<TrashCanContainer> {
private static final Logger LOGGER = LogManager.getLogger();
private static final ResourceLocation TRASH_CAN_GUI = new ResourceLocation("modernlife", "textures/gui/gui_seed_spreader.png");
static final int GUI_WIDTH = 256;
static final int GUI_HEIGHT = 206;
Inventory inventory;
public SeedSpreaderScreen(TrashCanContainer trashCanContainer, Inventory inventory, Component title) {
super(trashCanContainer, inventory, title == null ? new TextComponent("Container") : title);
this.inventoryLabelX = 31;
this.inventoryLabelY = 103;
this.imageWidth = GUI_WIDTH;
this.imageHeight = GUI_HEIGHT;
}
protected void init() {
super.init();
}
public boolean isPauseScreen() {
return false;
}
public void render(PoseStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) {
super.render(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_);
super.renderTooltip(p_230430_1_, p_230430_2_, p_230430_3_);
}
protected void renderBg(PoseStack var1, float var2, int var3, int var4) {
m_7333_(var1);
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, TRASH_CAN_GUI);
int lvt_5_1_ = (this.f_96543_ - GUI_WIDTH) / 2;
int lvt_6_1_ = (this.f_96544_ - GUI_HEIGHT) / 2;
m_93228_(var1, lvt_5_1_, lvt_6_1_, 0, 0, GUI_WIDTH, GUI_HEIGHT);
}
}

View File

@ -1,54 +0,0 @@
package com.dairymoose.modernlife.blocks.gui;
import com.dairymoose.inventory.container.TrashCanContainer;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@OnlyIn(Dist.CLIENT)
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/gui/TrashCanScreen.class */
public class TrashCanScreen extends AbstractContainerScreen<TrashCanContainer> {
private static final Logger LOGGER = LogManager.getLogger();
private static final ResourceLocation TRASH_CAN_GUI = new ResourceLocation("modernlife", "textures/gui/gui_trash.png");
static final int GUI_WIDTH = 176;
static final int GUI_HEIGHT = 132;
Inventory inventory;
public TrashCanScreen(TrashCanContainer trashCanContainer, Inventory inventory, Component title) {
super(trashCanContainer, inventory, title == null ? new TextComponent("Container") : title);
this.inventoryLabelY = 39;
this.imageWidth = GUI_WIDTH;
this.imageHeight = GUI_HEIGHT;
}
protected void init() {
super.init();
}
public boolean isPauseScreen() {
return false;
}
public void render(PoseStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) {
super.render(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_);
super.renderTooltip(p_230430_1_, p_230430_2_, p_230430_3_);
}
protected void renderBg(PoseStack var1, float var2, int var3, int var4) {
m_7333_(var1);
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, TRASH_CAN_GUI);
int lvt_5_1_ = (this.f_96543_ - GUI_WIDTH) / 2;
int lvt_6_1_ = (this.f_96544_ - GUI_HEIGHT) / 2;
m_93228_(var1, lvt_5_1_, lvt_6_1_, 0, 0, GUI_WIDTH, GUI_HEIGHT);
}
}

Some files were not shown because too many files have changed in this diff Show More