Added creative mode tab. Replaced player.level with level(). Replaced mojang.math with org.joml.
Using new SoundEvent.createVariableRangeEvent.
This commit is contained in:
@@ -155,7 +155,7 @@ jar {
|
||||
"Specification-Title": "effortlessbuilding",
|
||||
"Specification-Vendor": "requios",
|
||||
"Specification-Version": "1",
|
||||
"Implementation-Title": project.jar.baseName,
|
||||
"Implementation-Title": project.jar.archiveBaseName,
|
||||
"Implementation-Version": project.jar.archiveVersion,
|
||||
"Implementation-Vendor" :"requios",
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
@@ -167,7 +167,7 @@ task jarJarRelease {
|
||||
group = 'jarjar'
|
||||
doLast {
|
||||
tasks.jarJar {
|
||||
classifier = ''
|
||||
archiveClassifier = ''
|
||||
}
|
||||
}
|
||||
finalizedBy tasks.jarJar
|
||||
|
||||
@@ -3,7 +3,7 @@ package nl.requios.effortlessbuilding;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import org.joml.Matrix4f;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
|
||||
@@ -5,6 +5,7 @@ import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.common.CreativeModeTabRegistry;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package nl.requios.effortlessbuilding;
|
||||
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
|
||||
public class EBCreativeModeTab implements CreativeModeTab.DisplayItemsGenerator {
|
||||
|
||||
@Override
|
||||
public void accept(CreativeModeTab.ItemDisplayParameters pParameters, CreativeModeTab.Output pOutput) {
|
||||
pOutput.accept(EffortlessBuilding.RANDOMIZER_BAG_ITEM.get());
|
||||
pOutput.accept(EffortlessBuilding.GOLDEN_RANDOMIZER_BAG_ITEM.get());
|
||||
pOutput.accept(EffortlessBuilding.DIAMOND_RANDOMIZER_BAG_ITEM.get());
|
||||
|
||||
pOutput.accept(EffortlessBuilding.REACH_UPGRADE_1_ITEM.get());
|
||||
pOutput.accept(EffortlessBuilding.REACH_UPGRADE_2_ITEM.get());
|
||||
pOutput.accept(EffortlessBuilding.REACH_UPGRADE_3_ITEM.get());
|
||||
|
||||
pOutput.accept(EffortlessBuilding.MUSCLES_ITEM.get());
|
||||
pOutput.accept(EffortlessBuilding.ELASTIC_HAND_ITEM.get());
|
||||
pOutput.accept(EffortlessBuilding.BUILDING_TECHNIQUES_BOOK_ITEM.get());
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
package nl.requios.effortlessbuilding;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.flag.FeatureFlagSet;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.loot.IGlobalLootModifier;
|
||||
@@ -54,6 +58,7 @@ public class EffortlessBuilding {
|
||||
private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
|
||||
private static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, EffortlessBuilding.MODID);
|
||||
public static final DeferredRegister<Codec<? extends IGlobalLootModifier>> LOOT_MODIFIERS = DeferredRegister.create(ForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, EffortlessBuilding.MODID);
|
||||
private static final DeferredRegister<CreativeModeTab> CREATIVE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, EffortlessBuilding.MODID);
|
||||
|
||||
public static final RegistryObject<Item> RANDOMIZER_BAG_ITEM = ITEMS.register("randomizer_bag", RandomizerBagItem::new);
|
||||
public static final RegistryObject<Item> GOLDEN_RANDOMIZER_BAG_ITEM = ITEMS.register("golden_randomizer_bag", GoldenRandomizerBagItem::new);
|
||||
@@ -69,6 +74,12 @@ public class EffortlessBuilding {
|
||||
public static final RegistryObject<MenuType<GoldenRandomizerBagContainer>> GOLDEN_RANDOMIZER_BAG_CONTAINER = CONTAINERS.register("golden_randomizer_bag", () -> registerContainer(GoldenRandomizerBagContainer::new));
|
||||
public static final RegistryObject<MenuType<DiamondRandomizerBagContainer>> DIAMOND_RANDOMIZER_BAG_CONTAINER = CONTAINERS.register("diamond_randomizer_bag", () -> registerContainer(DiamondRandomizerBagContainer::new));
|
||||
|
||||
public static final RegistryObject<CreativeModeTab> CREATIVE_TAB = CREATIVE_TABS.register("effortlessbuilding",
|
||||
() -> CreativeModeTab.builder()
|
||||
.title(Component.translatable("key.effortlessbuilding.category"))
|
||||
.icon(() -> new ItemStack(RANDOMIZER_BAG_ITEM.get()))
|
||||
.displayItems(new EBCreativeModeTab())
|
||||
.build());
|
||||
|
||||
public EffortlessBuilding() {
|
||||
instance = this;
|
||||
@@ -87,6 +98,8 @@ public class EffortlessBuilding {
|
||||
var singleItemLootModifier = SingleItemLootModifier.CODEC; //load this class to register the loot modifier
|
||||
LOOT_MODIFIERS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
||||
|
||||
CREATIVE_TABS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
||||
|
||||
//Register config
|
||||
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, CommonConfig.spec);
|
||||
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, ClientConfig.spec);
|
||||
@@ -100,7 +113,7 @@ public class EffortlessBuilding {
|
||||
}
|
||||
|
||||
public static <T extends AbstractContainerMenu> MenuType<T> registerContainer(IContainerFactory<T> fact){
|
||||
MenuType<T> type = new MenuType<T>(fact);
|
||||
MenuType<T> type = new MenuType<T>(fact, FeatureFlagSet.of());
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package nl.requios.effortlessbuilding.buildmode;
|
||||
|
||||
import com.mojang.math.Vector4f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
public enum BuildModeCategoryEnum {
|
||||
BASIC(new Vector4f(0f, .5f, 1f, .8f)),
|
||||
|
||||
@@ -109,7 +109,7 @@ public class BuildModes {
|
||||
if (!skipRaytrace) {
|
||||
//collision within a 1 block radius to selected is fine
|
||||
ClipContext rayTraceContext = new ClipContext(start, lineBound, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, player);
|
||||
HitResult rayTraceResult = player.level.clip(rayTraceContext);
|
||||
HitResult rayTraceResult = player.level().clip(rayTraceContext);
|
||||
intersects = rayTraceResult != null && rayTraceResult.getType() == HitResult.Type.BLOCK &&
|
||||
planeBound.subtract(rayTraceResult.getLocation()).lengthSqr() > 4;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ModeOptions {
|
||||
case CIRCLE_START_CORNER -> circleStart = ActionEnum.CIRCLE_START_CORNER;
|
||||
}
|
||||
|
||||
if (player.level.isClientSide &&
|
||||
if (player.level().isClientSide &&
|
||||
action != ActionEnum.OPEN_MODIFIER_SETTINGS &&
|
||||
action != ActionEnum.OPEN_PLAYER_SETTINGS &&
|
||||
action != ActionEnum.PREVIOUS_BUILD_MODE &&
|
||||
|
||||
@@ -120,11 +120,11 @@ public class RadialMirror extends BaseModifier {
|
||||
BlockState newBlockState = blockState;
|
||||
|
||||
if (startAngleToCenter < -0.751 * Math.PI || startAngleToCenter > 0.749 * Math.PI) {
|
||||
newBlockState = blockState.rotate(player.level, startPos, Rotation.CLOCKWISE_180);
|
||||
newBlockState = blockState.rotate(player.level(), startPos, Rotation.CLOCKWISE_180);
|
||||
} else if (startAngleToCenter < -0.251 * Math.PI) {
|
||||
newBlockState = blockState.rotate(player.level, startPos, Rotation.COUNTERCLOCKWISE_90);
|
||||
newBlockState = blockState.rotate(player.level(), startPos, Rotation.COUNTERCLOCKWISE_90);
|
||||
} else if (startAngleToCenter > 0.249 * Math.PI) {
|
||||
newBlockState = blockState.rotate(player.level, startPos, Rotation.CLOCKWISE_90);
|
||||
newBlockState = blockState.rotate(player.level(), startPos, Rotation.CLOCKWISE_90);
|
||||
}
|
||||
|
||||
return newBlockState;
|
||||
@@ -135,17 +135,17 @@ public class RadialMirror extends BaseModifier {
|
||||
double angleToCenter = Mth.atan2(relVec.x, relVec.z); //between -PI and PI
|
||||
|
||||
if (angleToCenter < -0.751 * Math.PI || angleToCenter > 0.749 * Math.PI) {
|
||||
newBlockState = blockState.rotate(player.level, startPos, Rotation.CLOCKWISE_180);
|
||||
newBlockState = blockState.rotate(player.level(), startPos, Rotation.CLOCKWISE_180);
|
||||
if (alternate) {
|
||||
newBlockState = newBlockState.mirror(Mirror.FRONT_BACK);
|
||||
}
|
||||
} else if (angleToCenter < -0.251 * Math.PI) {
|
||||
newBlockState = blockState.rotate(player.level, startPos, Rotation.CLOCKWISE_90);
|
||||
newBlockState = blockState.rotate(player.level(), startPos, Rotation.CLOCKWISE_90);
|
||||
if (alternate) {
|
||||
newBlockState = newBlockState.mirror(Mirror.LEFT_RIGHT);
|
||||
}
|
||||
} else if (angleToCenter > 0.249 * Math.PI) {
|
||||
newBlockState = blockState.rotate(player.level, startPos, Rotation.COUNTERCLOCKWISE_90);
|
||||
newBlockState = blockState.rotate(player.level(), startPos, Rotation.COUNTERCLOCKWISE_90);
|
||||
if (alternate) {
|
||||
newBlockState = newBlockState.mirror(Mirror.LEFT_RIGHT);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package nl.requios.effortlessbuilding.create.foundation.gui;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import org.joml.Matrix4f;
|
||||
import nl.requios.effortlessbuilding.create.Create;
|
||||
import nl.requios.effortlessbuilding.create.foundation.gui.element.DelegatedStencilElement;
|
||||
import nl.requios.effortlessbuilding.create.foundation.gui.element.ScreenElement;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package nl.requios.effortlessbuilding.create.foundation.gui;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import com.mojang.math.Vector3f;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class CustomLightingSettings implements ILightingSettings {
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package nl.requios.effortlessbuilding.create.foundation.gui;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.Tesselator;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import org.joml.Matrix4f;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
|
||||
@@ -6,8 +6,8 @@ import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.*;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import com.mojang.math.Vector3f;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector3f;
|
||||
import nl.requios.effortlessbuilding.create.foundation.utility.Color;
|
||||
import nl.requios.effortlessbuilding.create.foundation.utility.Couple;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
@@ -2,7 +2,7 @@ package nl.requios.effortlessbuilding.create.foundation.gui.element;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.*;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import org.joml.Matrix4f;
|
||||
import nl.requios.effortlessbuilding.create.foundation.utility.Color;
|
||||
import nl.requios.effortlessbuilding.create.foundation.utility.Couple;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.mojang.blaze3d.platform.GlStateManager.SourceFactor;
|
||||
import com.mojang.blaze3d.platform.Lighting;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Vector3f;
|
||||
import org.joml.Vector3f;
|
||||
//import nl.requios.effortlessbuilding.create.foundation.fluid.FluidRenderer;
|
||||
import nl.requios.effortlessbuilding.create.foundation.gui.ILightingSettings;
|
||||
import nl.requios.effortlessbuilding.create.foundation.gui.UIRenderHelper;
|
||||
|
||||
@@ -14,11 +14,11 @@ import com.jozufozu.flywheel.util.transform.Transform;
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Matrix3f;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import com.mojang.math.Quaternion;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Vector4f;
|
||||
import org.joml.Matrix3f;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
import nl.requios.effortlessbuilding.create.foundation.block.render.SpriteShiftEntry;
|
||||
import nl.requios.effortlessbuilding.create.foundation.utility.Color;
|
||||
|
||||
@@ -264,7 +264,7 @@ public class SuperByteBuffer implements Transform<SuperByteBuffer>, TStack<Super
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuperByteBuffer multiply(Quaternion quaternion) {
|
||||
public SuperByteBuffer multiply(Quaternionf quaternion) {
|
||||
transforms.mulPose(quaternion);
|
||||
return this;
|
||||
}
|
||||
@@ -321,7 +321,7 @@ public class SuperByteBuffer implements Transform<SuperByteBuffer>, TStack<Super
|
||||
return this;
|
||||
}
|
||||
|
||||
public SuperByteBuffer rotateCentered(Quaternion q) {
|
||||
public SuperByteBuffer rotateCentered(Quaternionf q) {
|
||||
translate(.5f, .5f, .5f).multiply(q)
|
||||
.translate(-.5f, -.5f, -.5f);
|
||||
return this;
|
||||
|
||||
@@ -6,8 +6,8 @@ import com.jozufozu.flywheel.config.BackendType;
|
||||
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import com.mojang.math.Vector4f;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector4f;
|
||||
import nl.requios.effortlessbuilding.create.Create;
|
||||
import nl.requios.effortlessbuilding.create.foundation.utility.AnimationTickHolder;
|
||||
import nl.requios.effortlessbuilding.create.foundation.utility.RegisteredObjects;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package nl.requios.effortlessbuilding.create.foundation.utility;
|
||||
|
||||
import com.google.common.hash.Hashing;
|
||||
import com.mojang.math.Vector3f;
|
||||
import org.joml.Vector3f;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package nl.requios.effortlessbuilding.create.foundation.utility;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.Tesselator;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import org.joml.Matrix4f;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package nl.requios.effortlessbuilding.create.foundation.utility;
|
||||
|
||||
import com.mojang.math.Quaternion;
|
||||
import com.mojang.math.Vector3f;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -237,7 +237,7 @@ public class VecHelper {
|
||||
*/
|
||||
Camera ari = Minecraft.getInstance().gameRenderer.getMainCamera();
|
||||
Vec3 camera_pos = ari.getPosition();
|
||||
Quaternion camera_rotation_conj = ari.rotation()
|
||||
Quaternionf camera_rotation_conj = ari.rotation()
|
||||
.copy();
|
||||
camera_rotation_conj.conj();
|
||||
|
||||
@@ -257,12 +257,12 @@ public class VecHelper {
|
||||
float f = distwalked_modified - playerentity.walkDistO;
|
||||
float f1 = -(distwalked_modified + f * partialTicks);
|
||||
float f2 = Mth.lerp(partialTicks, playerentity.oBob, playerentity.bob);
|
||||
Quaternion q2 =
|
||||
new Quaternion(Vector3f.XP, Math.abs(Mth.cos(f1 * (float) Math.PI - 0.2F) * f2) * 5.0F, true);
|
||||
Quaternionf q2 =
|
||||
new Quaternionf(Vector3f.XP, Math.abs(Mth.cos(f1 * (float) Math.PI - 0.2F) * f2) * 5.0F, true);
|
||||
q2.conj();
|
||||
result3f.transform(q2);
|
||||
|
||||
Quaternion q1 = new Quaternion(Vector3f.ZP, Mth.sin(f1 * (float) Math.PI) * f2 * 3.0F, true);
|
||||
Quaternionf q1 = new Quaternionf(Vector3f.ZP, Mth.sin(f1 * (float) Math.PI) * f2 * 3.0F, true);
|
||||
q1.conj();
|
||||
result3f.transform(q1);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package nl.requios.effortlessbuilding.create.foundation.utility.outliner;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Matrix3f;
|
||||
import org.joml.Matrix3f;
|
||||
import nl.requios.effortlessbuilding.create.AllSpecialTextures;
|
||||
import nl.requios.effortlessbuilding.create.foundation.render.RenderTypes;
|
||||
import nl.requios.effortlessbuilding.create.foundation.render.SuperRenderTypeBuffer;
|
||||
|
||||
@@ -141,7 +141,7 @@ public class DiamondRandomizerBagContainer extends AbstractContainerMenu {
|
||||
@Override
|
||||
public void removed(Player player) {
|
||||
super.removed(player);
|
||||
if (!player.level.isClientSide) {
|
||||
if (!player.level().isClientSide) {
|
||||
broadcastChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class GoldenRandomizerBagContainer extends AbstractContainerMenu {
|
||||
@Override
|
||||
public void removed(Player player) {
|
||||
super.removed(player);
|
||||
if (!player.level.isClientSide) {
|
||||
if (!player.level().isClientSide) {
|
||||
broadcastChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class RandomizerBagContainer extends AbstractContainerMenu {
|
||||
@Override
|
||||
public void removed(Player player) {
|
||||
super.removed(player);
|
||||
if (!player.level.isClientSide) {
|
||||
if (!player.level().isClientSide) {
|
||||
broadcastChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package nl.requios.effortlessbuilding.gui.buildmode;
|
||||
|
||||
import com.mojang.blaze3d.vertex.*;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.math.Vector4f;
|
||||
import org.joml.Vector4f;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
@@ -476,7 +476,7 @@ public class RadialMenu extends Screen {
|
||||
public static void playRadialMenuSound() {
|
||||
final float volume = 0.1f;
|
||||
if (volume >= 0.0001f) {
|
||||
SimpleSoundInstance sound = new SimpleSoundInstance(SoundEvents.UI_BUTTON_CLICK, SoundSource.MASTER, volume,
|
||||
SimpleSoundInstance sound = new SimpleSoundInstance(SoundEvents.UI_BUTTON_CLICK.get(), SoundSource.MASTER, volume,
|
||||
1.0f, RandomSource.create(), Minecraft.getInstance().player.blockPosition());
|
||||
Minecraft.getInstance().getSoundManager().play(sound);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public abstract class AbstractRandomizerBagItem extends Item {
|
||||
private static final Random rand = new Random(currentSeed);
|
||||
|
||||
public AbstractRandomizerBagItem() {
|
||||
super(new Item.Properties().tab(CreativeModeTab.TAB_TOOLS).stacksTo(1));
|
||||
super(new Item.Properties().stacksTo(1));
|
||||
}
|
||||
|
||||
public abstract int getInventorySize();
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
@MethodsReturnNonnullByDefault
|
||||
public class PowerLevelItem extends Item {
|
||||
public PowerLevelItem() {
|
||||
super(new Item.Properties().tab(CreativeModeTab.TAB_TOOLS));
|
||||
super(new Item.Properties());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,7 +39,7 @@ public class PowerLevelItem extends Item {
|
||||
EffortlessBuilding.log(player, "Upgraded power level to " + EffortlessBuildingClient.POWER_LEVEL.getPowerLevel());
|
||||
player.setItemInHand(hand, ItemStack.EMPTY);
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("entity.player.levelup"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("entity.player.levelup"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
|
||||
return InteractionResultHolder.consume(player.getItemInHand(hand));
|
||||
@@ -48,7 +48,7 @@ public class PowerLevelItem extends Item {
|
||||
|
||||
EffortlessBuilding.log(player, "Already reached maximum power level!");
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
|
||||
return InteractionResultHolder.fail(player.getItemInHand(hand));
|
||||
|
||||
@@ -27,7 +27,7 @@ import net.minecraft.world.InteractionResultHolder;
|
||||
public class ReachUpgrade1Item extends Item {
|
||||
|
||||
public ReachUpgrade1Item() {
|
||||
super(new Item.Properties().tab(CreativeModeTab.TAB_TOOLS).stacksTo(1));
|
||||
super(new Item.Properties().stacksTo(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,7 +42,7 @@ public class ReachUpgrade1Item extends Item {
|
||||
EffortlessBuilding.log(player, "Upgraded power level to " + EffortlessBuildingClient.POWER_LEVEL.getPowerLevel());
|
||||
player.setItemInHand(hand, ItemStack.EMPTY);
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("entity.player.levelup"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("entity.player.levelup"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
|
||||
return InteractionResultHolder.consume(player.getItemInHand(hand));
|
||||
@@ -51,7 +51,7 @@ public class ReachUpgrade1Item extends Item {
|
||||
|
||||
EffortlessBuilding.log(player, "Already used this upgrade! Current power level is " + EffortlessBuildingClient.POWER_LEVEL.getPowerLevel() + ".");
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import net.minecraft.world.InteractionResultHolder;
|
||||
public class ReachUpgrade2Item extends Item {
|
||||
|
||||
public ReachUpgrade2Item() {
|
||||
super(new Item.Properties().tab(CreativeModeTab.TAB_TOOLS).stacksTo(1));
|
||||
super(new Item.Properties().stacksTo(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,7 +43,7 @@ public class ReachUpgrade2Item extends Item {
|
||||
EffortlessBuilding.log(player, "Upgraded power level to " + EffortlessBuildingClient.POWER_LEVEL.getPowerLevel());
|
||||
player.setItemInHand(hand, ItemStack.EMPTY);
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("entity.player.levelup"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("entity.player.levelup"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
|
||||
return InteractionResultHolder.consume(player.getItemInHand(hand));
|
||||
@@ -52,7 +52,7 @@ public class ReachUpgrade2Item extends Item {
|
||||
|
||||
EffortlessBuilding.log(player, "Use Reach Upgrade 1 first.");
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class ReachUpgrade2Item extends Item {
|
||||
|
||||
EffortlessBuilding.log(player, "Already used this upgrade! Current power level is " + EffortlessBuildingClient.POWER_LEVEL.getPowerLevel() + ".");
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import net.minecraft.world.InteractionResultHolder;
|
||||
public class ReachUpgrade3Item extends Item {
|
||||
|
||||
public ReachUpgrade3Item() {
|
||||
super(new Item.Properties().tab(CreativeModeTab.TAB_TOOLS).stacksTo(1));
|
||||
super(new Item.Properties().stacksTo(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,7 +43,7 @@ public class ReachUpgrade3Item extends Item {
|
||||
EffortlessBuilding.log(player, "Upgraded power level to " + EffortlessBuildingClient.POWER_LEVEL.getPowerLevel());
|
||||
player.setItemInHand(hand, ItemStack.EMPTY);
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("entity.player.levelup"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("entity.player.levelup"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
|
||||
return InteractionResultHolder.consume(player.getItemInHand(hand));
|
||||
@@ -53,7 +53,7 @@ public class ReachUpgrade3Item extends Item {
|
||||
if (currentLevel == 0) EffortlessBuilding.log(player, "Use Reach Upgrade 1 and 2 first.");
|
||||
if (currentLevel == 1) EffortlessBuilding.log(player, "Use Reach Upgrade 2 first.");
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ReachUpgrade3Item extends Item {
|
||||
|
||||
EffortlessBuilding.log(player, "Already used this upgrade! Current power level is " + EffortlessBuildingClient.POWER_LEVEL.getPowerLevel() + ".");
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
|
||||
}
|
||||
|
||||
@@ -148,10 +148,10 @@ public class BlockPreviews {
|
||||
if (EffortlessBuildingClient.BUILDER_CHAIN.getLookingAtNear() != null) return;
|
||||
|
||||
AABB aabb = new AABB(pos);
|
||||
if (player.level.isLoaded(pos)) {
|
||||
var blockState = player.level.getBlockState(pos);
|
||||
if (player.level().isLoaded(pos)) {
|
||||
var blockState = player.level().getBlockState(pos);
|
||||
if (!blockState.isAir()) {
|
||||
aabb = blockState.getShape(player.level, pos).bounds().move(pos);
|
||||
aabb = blockState.getShape(player.level(), pos).bounds().move(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package nl.requios.effortlessbuilding.render;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource.BufferSource;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import org.joml.Matrix4f;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -88,7 +88,7 @@ public class BuilderChain {
|
||||
player.swing(InteractionHand.MAIN_HAND);
|
||||
|
||||
blocks.skipFirst = buildMode == BuildModeEnum.DISABLED;
|
||||
long placeTime = player.level.getGameTime();
|
||||
long placeTime = player.level().getGameTime();
|
||||
if (blocks.size() > 1) placeTime += ClientConfig.visuals.appearAnimationLength.get();
|
||||
PacketHandler.INSTANCE.sendToServer(new ServerPlaceBlocksPacket(blocks, placeTime));
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class BuilderChain {
|
||||
blocks.setStartPos(new BlockEntry(startPosForBreaking));
|
||||
EffortlessBuildingClient.BUILD_MODIFIERS.findCoordinates(blocks, player);
|
||||
EffortlessBuildingClient.BUILDER_FILTER.filterOnCoordinates(blocks, player);
|
||||
findExistingBlockStates(player.level);
|
||||
findExistingBlockStates(player.level());
|
||||
EffortlessBuildingClient.BUILDER_FILTER.filterOnExistingBlockStates(blocks, player);
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ public class BuilderChain {
|
||||
|
||||
//Offset in direction of sidehit if not quickreplace and not replaceable
|
||||
boolean shouldOffsetStartPosition = EffortlessBuildingClient.BUILD_SETTINGS.shouldOffsetStartPosition();
|
||||
boolean replaceable = player.level.getBlockState(startPos).getMaterial().isReplaceable();
|
||||
boolean replaceable = player.level().getBlockState(startPos).getMaterial().isReplaceable();
|
||||
boolean becomesDoubleSlab = SurvivalHelper.doesBecomeDoubleSlab(player, startPos);
|
||||
if (!shouldOffsetStartPosition && !replaceable && !becomesDoubleSlab) {
|
||||
startPos = startPos.relative(lookingAt.getDirection());
|
||||
@@ -281,7 +281,7 @@ public class BuilderChain {
|
||||
}
|
||||
|
||||
//Find new blockstate
|
||||
blockEntry.setItemAndFindNewBlockState(itemStack, player.level, originalDirection, clickedFace, relativeHitVec);
|
||||
blockEntry.setItemAndFindNewBlockState(itemStack, player.level(), originalDirection, clickedFace, relativeHitVec);
|
||||
|
||||
//Filter on new blockstate
|
||||
if (EffortlessBuildingClient.BUILDER_FILTER.filterOnNewBlockState(blockEntry, player)) {
|
||||
@@ -320,9 +320,9 @@ public class BuilderChain {
|
||||
|
||||
if (blocks.getLastBlockEntry() != null && blocks.getLastBlockEntry().newBlockState != null) {
|
||||
var lastBlockState = blocks.getLastBlockEntry().newBlockState;
|
||||
SoundType soundType = lastBlockState.getBlock().getSoundType(lastBlockState, player.level, blocks.lastPos, player);
|
||||
SoundType soundType = lastBlockState.getBlock().getSoundType(lastBlockState, player.level(), blocks.lastPos, player);
|
||||
SoundEvent soundEvent = buildingState == BuildingState.BREAKING ? soundType.getBreakSound() : soundType.getPlaceSound();
|
||||
player.level.playSound(player, player.blockPosition(), soundEvent, SoundSource.BLOCKS, 0.3f, 0.8f);
|
||||
player.level().playSound(player, player.blockPosition(), soundEvent, SoundSource.BLOCKS, 0.3f, 0.8f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import nl.requios.effortlessbuilding.utilities.SurvivalHelper;
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class BuilderFilter {
|
||||
public void filterOnCoordinates(BlockSet blocks, Player player) {
|
||||
var world = player.level;
|
||||
var world = player.level();
|
||||
var iter = blocks.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
var pos = iter.next().getValue().blockPos;
|
||||
@@ -43,7 +43,7 @@ public class BuilderFilter {
|
||||
if (placing && !buildSettings.shouldReplaceFiltered()) {
|
||||
if (!buildSettings.shouldReplaceAir() && blockState.isAir()) remove = true;
|
||||
boolean isReplaceable = blockState.getMaterial().isReplaceable();
|
||||
// boolean isSolid = blockState.isRedstoneConductor(player.level, blockEntry.blockPos);
|
||||
// boolean isSolid = blockState.isRedstoneConductor(player.level(), blockEntry.blockPos);
|
||||
if (!buildSettings.shouldReplaceBlocks() && !isReplaceable) remove = true;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class BuilderFilter {
|
||||
|
||||
boolean remove = false;
|
||||
|
||||
if (placing && !PlaceChecker.shouldPlaceBlock(player.level, blockEntry)) remove = true;
|
||||
if (placing && !PlaceChecker.shouldPlaceBlock(player.level(), blockEntry)) remove = true;
|
||||
|
||||
return remove;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ServerBlockPlacer {
|
||||
//Iterator to prevent concurrent modification exception
|
||||
for (var iterator = delayedEntries.iterator(); iterator.hasNext(); ) {
|
||||
DelayedEntry entry = iterator.next();
|
||||
long gameTime = entry.player.level.getGameTime();
|
||||
long gameTime = entry.player.level().getGameTime();
|
||||
if (gameTime >= entry.placeTime) {
|
||||
applyBlockSet(entry.player, entry.blocks);
|
||||
iterator.remove();
|
||||
@@ -104,7 +104,7 @@ public class ServerBlockPlacer {
|
||||
|
||||
private boolean applyBlockEntry(Player player, BlockEntry block) {
|
||||
|
||||
block.existingBlockState = player.level.getBlockState(block.blockPos);
|
||||
block.existingBlockState = player.level().getBlockState(block.blockPos);
|
||||
boolean breaking = BlockUtilities.isNullOrAir(block.newBlockState);
|
||||
if (!validateBlockEntry(player, block, breaking)) return false;
|
||||
|
||||
@@ -139,7 +139,7 @@ public class ServerBlockPlacer {
|
||||
if (!validateBlockEntry(player, tempBlockEntry, breaking)) return false;
|
||||
|
||||
//Update newBlockState for future redo's
|
||||
block.newBlockState = player.level.getBlockState(block.blockPos);
|
||||
block.newBlockState = player.level().getBlockState(block.blockPos);
|
||||
|
||||
boolean success;
|
||||
isPlacingOrBreakingBlocks = true;
|
||||
@@ -236,7 +236,7 @@ public class ServerBlockPlacer {
|
||||
|
||||
private boolean validateBlockEntry(Player player, BlockEntry block, boolean breaking) {
|
||||
|
||||
if (!player.level.isLoaded(block.blockPos)) return false;
|
||||
if (!player.level().isLoaded(block.blockPos)) return false;
|
||||
|
||||
if (breaking && BlockUtilities.isNullOrAir(block.existingBlockState)) return false;
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ public class UndoRedo {
|
||||
//
|
||||
// //add to undo stack
|
||||
// public static void addUndo(Player player, UndoRedoBlockSet blockSet) {
|
||||
// Map<UUID, FixedStack<UndoRedoBlockSet>> undoStacks = player.level.isClientSide ? undoStacksClient : undoStacksServer;
|
||||
// Map<UUID, FixedStack<UndoRedoBlockSet>> undoStacks = player.level().isClientSide ? undoStacksClient : undoStacksServer;
|
||||
//
|
||||
// //Assert coordinates is as long as previous and new blockstate lists
|
||||
// if (blockSet.getCoordinates().size() != blockSet.getPreviousBlockStates().size() ||
|
||||
@@ -127,7 +127,7 @@ public class UndoRedo {
|
||||
// }
|
||||
//
|
||||
// private static void addRedo(Player player, UndoRedoBlockSet blockSet) {
|
||||
// Map<UUID, FixedStack<UndoRedoBlockSet>> redoStacks = player.level.isClientSide ? redoStacksClient : redoStacksServer;
|
||||
// Map<UUID, FixedStack<UndoRedoBlockSet>> redoStacks = player.level().isClientSide ? redoStacksClient : redoStacksServer;
|
||||
//
|
||||
// //(No asserts necessary, it's private)
|
||||
//
|
||||
@@ -140,7 +140,7 @@ public class UndoRedo {
|
||||
// }
|
||||
//
|
||||
// public static boolean undo(Player player) {
|
||||
// Map<UUID, FixedStack<UndoRedoBlockSet>> undoStacks = player.level.isClientSide ? undoStacksClient : undoStacksServer;
|
||||
// Map<UUID, FixedStack<UndoRedoBlockSet>> undoStacks = player.level().isClientSide ? undoStacksClient : undoStacksServer;
|
||||
//
|
||||
// if (!undoStacks.containsKey(player.getUUID())) return false;
|
||||
//
|
||||
@@ -156,7 +156,7 @@ public class UndoRedo {
|
||||
// //Find up to date itemstacks in player inventory
|
||||
// List<ItemStack> itemStacks = findItemStacksInInventory(player, previousBlockStates);
|
||||
//
|
||||
// if (player.level.isClientSide) {
|
||||
// if (player.level().isClientSide) {
|
||||
//// BlockPreviews.onBlocksBroken(coordinates, itemStacks, newBlockStates, blockSet.getSecondPos(), blockSet.getFirstPos());
|
||||
// } else {
|
||||
// //break all those blocks, reset to what they were
|
||||
@@ -172,7 +172,7 @@ public class UndoRedo {
|
||||
// previousBlockState = ((BlockItem) itemStack.getItem()).getBlock().defaultBlockState();
|
||||
// }
|
||||
//
|
||||
// if (player.level.isLoaded(coordinate)) {
|
||||
// if (player.level().isLoaded(coordinate)) {
|
||||
// //check itemstack empty
|
||||
// if (itemStack.isEmpty() && !player.isCreative()) {
|
||||
// itemStack = findItemStackInInventory(player, previousBlockStates.get(i));
|
||||
@@ -185,9 +185,9 @@ public class UndoRedo {
|
||||
// previousBlockState = Blocks.AIR.defaultBlockState();
|
||||
// }
|
||||
// }
|
||||
// if (itemStack.isEmpty()) SurvivalHelper.breakBlock(player.level, player, coordinate, true);
|
||||
// if (itemStack.isEmpty()) SurvivalHelper.breakBlock(player.level(), player, coordinate, true);
|
||||
// //if previousBlockState is air, placeBlock will set it to air
|
||||
// SurvivalHelper.placeBlock(player.level, player, coordinate, previousBlockState, itemStack, true, false, false);
|
||||
// SurvivalHelper.placeBlock(player.level(), player, coordinate, previousBlockState, itemStack, true, false, false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -199,7 +199,7 @@ public class UndoRedo {
|
||||
// }
|
||||
//
|
||||
// public static boolean redo(Player player) {
|
||||
// Map<UUID, FixedStack<UndoRedoBlockSet>> redoStacks = player.level.isClientSide ? redoStacksClient : redoStacksServer;
|
||||
// Map<UUID, FixedStack<UndoRedoBlockSet>> redoStacks = player.level().isClientSide ? redoStacksClient : redoStacksServer;
|
||||
//
|
||||
// if (!redoStacks.containsKey(player.getUUID())) return false;
|
||||
//
|
||||
@@ -215,7 +215,7 @@ public class UndoRedo {
|
||||
// //Find up to date itemstacks in player inventory
|
||||
// List<ItemStack> itemStacks = findItemStacksInInventory(player, newBlockStates);
|
||||
//
|
||||
// if (player.level.isClientSide) {
|
||||
// if (player.level().isClientSide) {
|
||||
//// BlockPreviews.onBlocksPlaced(coordinates, itemStacks, newBlockStates, blockSet.getFirstPos(), blockSet.getSecondPos());
|
||||
// } else {
|
||||
// //place blocks
|
||||
@@ -231,7 +231,7 @@ public class UndoRedo {
|
||||
// newBlockState = ((BlockItem) itemStack.getItem()).getBlock().defaultBlockState();
|
||||
// }
|
||||
//
|
||||
// if (player.level.isLoaded(coordinate)) {
|
||||
// if (player.level().isLoaded(coordinate)) {
|
||||
// //check itemstack empty
|
||||
// if (itemStack.isEmpty() && !player.isCreative()) {
|
||||
// itemStack = findItemStackInInventory(player, newBlockStates.get(i));
|
||||
@@ -244,8 +244,8 @@ public class UndoRedo {
|
||||
// newBlockState = Blocks.AIR.defaultBlockState();
|
||||
// }
|
||||
// }
|
||||
// if (itemStack.isEmpty()) SurvivalHelper.breakBlock(player.level, player, coordinate, true);
|
||||
// SurvivalHelper.placeBlock(player.level, player, coordinate, newBlockState, itemStack, true, false, false);
|
||||
// if (itemStack.isEmpty()) SurvivalHelper.breakBlock(player.level(), player, coordinate, true);
|
||||
// SurvivalHelper.placeBlock(player.level(), player, coordinate, newBlockState, itemStack, true, false, false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -286,8 +286,8 @@ public class UndoRedo {
|
||||
//then anything it drops
|
||||
if (itemStack.isEmpty()) {
|
||||
//Cannot check drops on clientside because loot tables are server only
|
||||
if (!player.level.isClientSide) {
|
||||
List<ItemStack> itemsDropped = Block.getDrops(blockState, (ServerLevel) player.level, BlockPos.ZERO, null);
|
||||
if (!player.level().isClientSide) {
|
||||
List<ItemStack> itemsDropped = Block.getDrops(blockState, (ServerLevel) player.level(), BlockPos.ZERO, null);
|
||||
for (ItemStack itemStackDropped : itemsDropped) {
|
||||
if (itemStackDropped.getItem() instanceof BlockItem) {
|
||||
Block block = ((BlockItem) itemStackDropped.getItem()).getBlock();
|
||||
|
||||
@@ -35,7 +35,7 @@ public class BlockPlacerHelper {
|
||||
}
|
||||
}
|
||||
|
||||
boolean brokeBlock = BlockHelper.destroyBlockAs(player.level, blockEntry.blockPos, player, usedTool, 0f, stack -> {
|
||||
boolean brokeBlock = BlockHelper.destroyBlockAs(player.level(), blockEntry.blockPos, player, usedTool, 0f, stack -> {
|
||||
if (!player.isCreative()) {
|
||||
ItemHandlerHelper.giveItemToPlayer(player, stack);
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public class BlockPlacerHelper {
|
||||
//ForgeHooks::onPlaceItemIntoWorld, removed itemstack usage
|
||||
public static boolean placeBlock(Player player, BlockEntry blockEntry) {
|
||||
|
||||
Level level = player.level;
|
||||
Level level = player.level();
|
||||
var itemStack = new ItemStack(blockEntry.item);
|
||||
|
||||
level.captureBlockSnapshots = true;
|
||||
|
||||
@@ -43,13 +43,13 @@ public class ClientBlockUtilities {
|
||||
if (blockEntry == null || blockEntry.newBlockState == null)
|
||||
return;
|
||||
|
||||
SoundType soundType = blockEntry.newBlockState.getBlock().getSoundType(blockEntry.newBlockState, player.level, blockEntry.blockPos, player);
|
||||
SoundType soundType = blockEntry.newBlockState.getBlock().getSoundType(blockEntry.newBlockState, player.level(), blockEntry.blockPos, player);
|
||||
SoundEvent soundEvent = breaking ? soundType.getBreakSound() : soundType.getPlaceSound();
|
||||
player.level.playSound(player, player.blockPosition(), soundEvent, SoundSource.BLOCKS, 0.6f, soundType.getPitch());
|
||||
player.level().playSound(player, player.blockPosition(), soundEvent, SoundSource.BLOCKS, 0.6f, soundType.getPitch());
|
||||
}
|
||||
|
||||
public static BlockHitResult getLookingAtFar(Player player) {
|
||||
Level world = player.level;
|
||||
Level world = player.level();
|
||||
|
||||
//base distance off of player ability (config)
|
||||
float raytraceRange = EffortlessBuildingClient.POWER_LEVEL.getPlacementReach(player);
|
||||
|
||||
@@ -43,7 +43,7 @@ public class SurvivalHelper {
|
||||
|
||||
public static boolean doesBecomeDoubleSlab(Player player, BlockPos pos) {
|
||||
|
||||
BlockState placedBlockState = player.level.getBlockState(pos);
|
||||
BlockState placedBlockState = player.level().getBlockState(pos);
|
||||
|
||||
ItemStack itemstack = player.getItemInHand(InteractionHand.MAIN_HAND);
|
||||
if (CompatHelper.isItemBlockProxy(itemstack))
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "examplemod resources",
|
||||
"pack_format": 10,
|
||||
"forge:resource_pack_format": 9,
|
||||
"forge:data_pack_format": 10
|
||||
"description": "Effortless Building resources",
|
||||
"pack_format": 15
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user