Disabled shader reload key.

Disabled build modes when reach is 0.
Removed incomplete build mode icons.
Removed sound event (unused).
This commit is contained in:
Christian Knaapen
2019-02-18 20:29:52 +01:00
parent be865d273c
commit 2986b11983
16 changed files with 51 additions and 66 deletions

View File

@@ -11,7 +11,7 @@ apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
version = "1.1a"
version = "1.12.2-2.0"
group = "nl.requios.effortlessbuilding" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "effortlessbuilding"

View File

@@ -58,10 +58,14 @@ public class BuildConfig {
@Comment({"Show a block preview if you have a block in hand on build mode Normal"})
public boolean alwaysShowBlockPreview = false;
@Comment({"How long the dissolve effect takes when placing blocks, in ticks."})
public int dissolveTime = 40;
@Comment({"How long the dissolve effect takes when placing blocks.",
"Default between 30 and 60 ticks, you can multiply that here.",
"Recommended values:",
"Snappy: 0.7",
"Relaxing: 1.5"})
public double dissolveTimeMultiplier = 1.0;
@Comment({"Switch to using the simple performance shader when placing more than so many blocks."})
@Comment({"Switch to using the simple performance shader when placing more than this many blocks."})
public int shaderTreshold = 1500;
@Comment({"Use fancy shaders while placing blocks"})

View File

@@ -39,7 +39,7 @@ public class EffortlessBuilding
{
public static final String MODID = "effortlessbuilding";
public static final String NAME = "Effortless Building";
public static final String VERSION = "1.1a";
public static final String VERSION = "1.12.2-2.0";
@Mod.Instance(EffortlessBuilding.MODID)
public static EffortlessBuilding instance;
@@ -59,8 +59,6 @@ public class EffortlessBuilding
public static final ItemReachUpgrade2 ITEM_REACH_UPGRADE_2 = new ItemReachUpgrade2();
public static final ItemReachUpgrade3 ITEM_REACH_UPGRADE_3 = new ItemReachUpgrade3();
public static final SoundEvent SOUND_BUILD_CLICK = createSoundEvent("build_click");
public static final Block[] BLOCKS = {
};
@@ -71,10 +69,6 @@ public class EffortlessBuilding
ITEM_REACH_UPGRADE_3
};
public static final SoundEvent[] SOUND_EVENTS = {
SOUND_BUILD_CLICK
};
public static final int RANDOMIZER_BAG_GUI = 0;
@EventHandler
@@ -141,9 +135,4 @@ public class EffortlessBuilding
public static void log(EntityPlayer player, String msg, boolean actionBar){
player.sendStatusMessage(new TextComponentString(msg), actionBar);
}
private static SoundEvent createSoundEvent(String soundName) {
final ResourceLocation soundID = new ResourceLocation(EffortlessBuilding.MODID, soundName);
return new SoundEvent(soundID).setRegistryName(soundID);
}
}

View File

@@ -54,11 +54,6 @@ public class EventHandler
}
}
@SubscribeEvent
public static void registerSounds(RegistryEvent.Register<SoundEvent> event) {
event.getRegistry().registerAll(EffortlessBuilding.SOUND_EVENTS);
}
@SubscribeEvent
public static void attachCapabilities(AttachCapabilitiesEvent<Entity> event) {
if (event.getObject() instanceof EntityPlayer) {

View File

@@ -31,10 +31,10 @@ public class BuildModes {
Line ("Line", new Line()),
Wall ("Wall", new Wall()),
Floor ("Floor", new Floor()),
DiagonalLine ("Diagonal Line", new DiagonalLine()),
DiagonalWall ("Diagonal Wall", new DiagonalWall()),
SlopeFloor ("Slope Floor", new SlopeFloor()),
Cube ("Cube", new Cube());
DiagonalLine ("", new DiagonalLine()),
DiagonalWall ("", new DiagonalWall()),
SlopeFloor ("", new SlopeFloor()),
Cube ("", new Cube());
public String name;
public IBuildMode instance;

View File

@@ -135,6 +135,7 @@ public class Line implements IBuildMode {
zDistSquared > 4 && zDistSquared < reach * reach;
//select the one that is closest (from wall position to its line counterpart) and is valid
//TODO: if multiple are very close, choose closest to player
Vec3d selected = null;
double selectedDistToLine = 0;

View File

@@ -81,8 +81,8 @@ public class SurvivalHelper {
//Check if can break
if (canBreak(world, player, pos))
{
player.addStat(StatList.getBlockStats(world.getBlockState(pos).getBlock()));
player.addExhaustion(0.005F);
// player.addStat(StatList.getBlockStats(world.getBlockState(pos).getBlock()));
// player.addExhaustion(0.005F);
//Drop existing block
dropBlock(world, player, pos);

View File

@@ -73,14 +73,14 @@ public class ClientProxy implements IProxy {
@Override
public void init(FMLInitializationEvent event) {
// register key bindings
keyBindings = new KeyBinding[5];
keyBindings = new KeyBinding[4];
// instantiate the key bindings
keyBindings[0] = new KeyBinding("key.effortlessbuilding.hud.desc", Keyboard.KEY_ADD, "key.effortlessbuilding.category");
keyBindings[1] = new KeyBinding("key.effortlessbuilding.replace.desc", Keyboard.KEY_SUBTRACT, "key.effortlessbuilding.category");
keyBindings[2] = new KeyBinding("key.effortlessbuilding.creative.desc", Keyboard.KEY_F4, "key.effortlessbuilding.category");
keyBindings[2] = new KeyBinding("key.effortlessbuilding.creative.desc", Keyboard.KEY_NONE, "key.effortlessbuilding.category");
keyBindings[3] = new KeyBinding("key.effortlessbuilding.mode.desc", Keyboard.KEY_LMENU, "key.effortlessbuilding.category");
keyBindings[4] = new KeyBinding("Reload shaders", Keyboard.KEY_TAB, "key.effortlessbuilding.category");
// keyBindings[4] = new KeyBinding("Reload shaders", Keyboard.KEY_TAB, "key.effortlessbuilding.category");
// register all the key bindings
for (int i = 0; i < keyBindings.length; ++i) {
@@ -221,7 +221,7 @@ public class ClientProxy implements IProxy {
if (keyBindings[0].isPressed()) {
//Disabled if max reach is 0, might be set in the config that way.
if (ReachHelper.getMaxReach(player) == 0) {
EffortlessBuilding.log(player, "Effortless Building is disabled until your reach has increased. Increase your reach with craftable reach upgrades.");
EffortlessBuilding.log(player, "Build modifiers are disabled until your reach has increased. Increase your reach with craftable reach upgrades.");
} else {
if (Minecraft.getMinecraft().currentScreen == null) {
Minecraft.getMinecraft().displayGuiScreen(new ModifierSettingsGui());
@@ -249,13 +249,11 @@ public class ClientProxy implements IProxy {
}
}
if (keyBindings[4].isPressed()) {
//TODO remove
ShaderHandler.init();
EffortlessBuilding.log(player, "Reloaded shaders");
//player.playSound(SoundEvents.UI_BUTTON_CLICK, 1f, 1f);
//player.playSound(EffortlessBuilding.SOUND_BUILD_CLICK, 1f, 1f);
}
// if (keyBindings[4].isPressed()) {
// //TODO remove
// ShaderHandler.init();
// EffortlessBuilding.log(player, "Reloaded shaders");
// }
}

View File

@@ -12,6 +12,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.fml.relauncher.Side;
@@ -83,14 +84,18 @@ public class BlockPreviewRenderer {
PlacedData placed = placedDataList.get(i);
if (placed.coordinates != null && !placed.coordinates.isEmpty()) {
float dissolve = (ClientProxy.ticksInGame - placed.time) / (float) BuildConfig.visuals.dissolveTime;
double totalTime = MathHelper.clampedLerp(30, 60, placed.firstPos.distanceSq(placed.secondPos) / 100.0) * BuildConfig.visuals.dissolveTimeMultiplier;
float dissolve = (ClientProxy.ticksInGame - placed.time) / (float) totalTime;
renderBlockPreviews(placed.coordinates, placed.blockStates, placed.itemStacks, dissolve, placed.firstPos, placed.secondPos, false, placed.breaking);
}
}
RenderHandler.endBlockPreviews();
}
//Expire
placedDataList.removeIf(placed -> placed.time + BuildConfig.visuals.dissolveTime < ClientProxy.ticksInGame);
placedDataList.removeIf(placed -> {
double totalTime = MathHelper.clampedLerp(30, 60, placed.firstPos.distanceSq(placed.secondPos) / 100.0) * BuildConfig.visuals.dissolveTimeMultiplier;
return placed.time + totalTime < ClientProxy.ticksInGame;
});
//Render block previews
RayTraceResult lookingAt = ClientProxy.getLookingAt(player);
@@ -294,7 +299,7 @@ public class BlockPreviewRenderer {
//Save current coordinates, blockstates and itemstacks
if (!previousCoordinates.isEmpty() && previousBlockStates.size() == previousCoordinates.size() &&
previousCoordinates.size() < BuildConfig.visuals.shaderTreshold) {
previousCoordinates.size() > 1 && previousCoordinates.size() < BuildConfig.visuals.shaderTreshold) {
placedDataList.add(new PlacedData(ClientProxy.ticksInGame, previousCoordinates, previousBlockStates,
previousItemStacks, previousFirstPos, previousSecondPos, false));
@@ -313,7 +318,7 @@ public class BlockPreviewRenderer {
//Save current coordinates, blockstates and itemstacks
if (!previousCoordinates.isEmpty() && previousBlockStates.size() == previousCoordinates.size() &&
previousCoordinates.size() < BuildConfig.visuals.shaderTreshold) {
previousCoordinates.size() > 1 && previousCoordinates.size() < BuildConfig.visuals.shaderTreshold) {
placedDataList.add(new PlacedData(ClientProxy.ticksInGame, previousCoordinates, previousBlockStates,
previousItemStacks, previousFirstPos, previousSecondPos, true));

View File

@@ -33,6 +33,7 @@ import nl.requios.effortlessbuilding.buildmodifier.BuildModifiers;
import nl.requios.effortlessbuilding.buildmodifier.ModifierSettingsManager;
import nl.requios.effortlessbuilding.gui.buildmode.RadialMenu;
import nl.requios.effortlessbuilding.compatibility.CompatHelper;
import nl.requios.effortlessbuilding.helper.ReachHelper;
import nl.requios.effortlessbuilding.helper.SurvivalHelper;
import nl.requios.effortlessbuilding.network.ModeSettingsMessage;
import nl.requios.effortlessbuilding.proxy.ClientProxy;
@@ -69,7 +70,8 @@ public class RenderHandler implements IWorldEventListener {
@SubscribeEvent
//Display Radial Menu
public static void onRenderGameOverlay(final RenderGameOverlayEvent.Post event ) {
EntityPlayerSP player = Minecraft.getMinecraft().player;
Minecraft mc = Minecraft.getMinecraft();
EntityPlayerSP player = mc.player;
//check if chisel and bits tool in hand (and has menu)
final boolean hasChiselInHand = CompatHelper.chiselsAndBitsProxy.isHoldingChiselTool(EnumHand.MAIN_HAND);
@@ -79,8 +81,12 @@ public class RenderHandler implements IWorldEventListener {
final boolean wasVisible = RadialMenu.instance.isVisible();
if (ClientProxy.keyBindings[3].isKeyDown()) {
if (ReachHelper.getMaxReach(player) > 0) {
RadialMenu.instance.actionUsed = false;
RadialMenu.instance.raiseVisibility();
} else if (ClientProxy.keyBindings[3].isPressed()) {
EffortlessBuilding.log(player, "Build modes are disabled until your reach has increased. Increase your reach with craftable reach upgrades.");
}
} else {
if ( !RadialMenu.instance.actionUsed ) {
ModeSettingsManager.ModeSettings modeSettings = ModeSettingsManager.getModeSettings(player);
@@ -109,21 +115,21 @@ public class RenderHandler implements IWorldEventListener {
RadialMenu.instance.configure(res.getScaledWidth(), res.getScaledHeight());
if (!wasVisible) {
RadialMenu.instance.mc.inGameHasFocus = false;
RadialMenu.instance.mc.mouseHelper.ungrabMouseCursor();
mc.inGameHasFocus = false;
mc.mouseHelper.ungrabMouseCursor();
}
if (RadialMenu.instance.mc.inGameHasFocus) {
if (mc.inGameHasFocus) {
KeyBinding.unPressAllKeys();
}
final int k1 = Mouse.getX() * res.getScaledWidth() / RadialMenu.instance.mc.displayWidth;
final int l1 = res.getScaledHeight() - Mouse.getY() * res.getScaledHeight() / RadialMenu.instance.mc.displayHeight - 1;
final int k1 = Mouse.getX() * res.getScaledWidth() / mc.displayWidth;
final int l1 = res.getScaledHeight() - Mouse.getY() * res.getScaledHeight() / mc.displayHeight - 1;
net.minecraftforge.client.ForgeHooksClient.drawScreen(RadialMenu.instance, k1, l1, event.getPartialTicks());
} else {
if (wasVisible) {
RadialMenu.instance.mc.setIngameFocus();
mc.setIngameFocus();
}
}
}

View File

@@ -1,5 +1,5 @@
key.effortlessbuilding.category=Effortless Building
key.effortlessbuilding.hud.desc=Open Settings
key.effortlessbuilding.hud.desc=Modifier Menu
key.effortlessbuilding.replace.desc=Toggle QuickReplace
key.effortlessbuilding.creative.desc=Toggle Survival/Creative Mode
key.effortlessbuilding.mode.desc=Radial Menu
@@ -10,5 +10,3 @@ item.effortlessbuilding:reach_upgrade2.name=Reach Upgrade 2
item.effortlessbuilding:reach_upgrade3.name=Reach Upgrade 3
commands.reach.usage=/reach <level>
effortlessbuilding.subtitle.build_click=Click

View File

@@ -1,11 +0,0 @@
{
"build_click": {
"category": "block",
"subtitle": "effortlessbuilding.subtitle.build_click",
"sounds": [
{
"name": "effortlessbuilding:build_click"
}
]
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 319 B

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 B

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 B

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 B

After

Width:  |  Height:  |  Size: 299 B