Skip to content

Commit

Permalink
Add initial version of source files
Browse files Browse the repository at this point in the history
  • Loading branch information
MasonSchleider committed Jan 11, 2020
1 parent 4d9aaac commit e11c203
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/main/java/com/masonschleider/breakbedrock/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.masonschleider.breakbedrock;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@Mod(Main.MODID)
@Mod.EventBusSubscriber(modid = Main.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE)
public final class Main {
public static final String MODID = "breakbedrock";

private static final Logger LOGGER = LogManager.getLogger(Main.MODID);

@SubscribeEvent
public static void onPlayerLeftClickBlock(PlayerInteractEvent.LeftClickBlock event) {
BlockPos blockPos = event.getPos();
PlayerEntity playerEntity = event.getPlayer();
World world = playerEntity.world;

if (world.isRemote || blockPos.getY() == 0)
return;

BlockState blockState = world.getBlockState(blockPos);
Block block = blockState.getBlock();

if (block != Blocks.BEDROCK)
return;

world.destroyBlock(blockPos, false);
}
}
48 changes: 48 additions & 0 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[28,)" #mandatory (26 is current forge version)
# A URL to refer people to when problems occur with this mod
issueTrackerURL="https://github.com/MasonSchleider/BreakBedrock/issues" #optional

# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId="breakbedrock" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
version="${version}" #mandatory
# A display name for the mod
displayName="BreakBedrock" #mandatory
# A URL to query for updates for this mod. See the JSON update specification <here>
#updateJSONURL="" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
displayURL="https://github.com/MasonSchleider/BreakBedrock" #optional
# A file name (in the root of the mod JAR) containing a logo for display
#logoFile="breakbedrock.png" #optional
# A text field displayed in the mod UI
authors="Mason Schleider" #optional
# The description text for the mod (multi line!) (#mandatory)
description='''
Allows bedrock blocks to be broken above y = 0.
'''

# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.breakbedrock]] #optional
# the modid of the dependency
modId="forge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="[28,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
side="BOTH"

# Here's another dependency
[[dependencies.breakbedrock]]
modId="minecraft"
mandatory=true
versionRange="[1.14.4]"
ordering="NONE"
side="BOTH"
7 changes: 7 additions & 0 deletions src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"pack": {
"description": "examplemod resources",
"pack_format": 4,
"_comment": "A pack_format of 4 requires json lang files. Note: we require v4 pack meta for all mods."
}
}

0 comments on commit e11c203

Please sign in to comment.