Skip to content

Instantly share code, notes, and snippets.

View Lothrazar's full-sized avatar

- Lothrazar

View GitHub Profile
@Lothrazar
Lothrazar / primer steps
Last active July 2, 2023 02:42
1.20 port steps with reminders and links
0. read https://gist.github.com/ChampionAsh5357/cf818acc53ffea6f4387fe28c2977d56
1. download https://files.minecraftforge.net/net/minecraftforge/forge/index_1.20.1.html
2. copy gradle files&folders
3. update settings.gradle plugin
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
}
4. update meta-inf normal changes along with
version="${mod_version}" #mandatory
5. pack mcmeta (optional) "pack_format": 15
@Lothrazar
Lothrazar / cauldronInteraction.java
Created August 31, 2022 07:52
CauldronInteraction water recipe
private void setup(final FMLCommonSetupEvent event) {
event.enqueueWork(() -> {
CauldronInteraction WASH_PEEL = (state, level, pos, player, hand, stack) -> {
if (stack.is(Items.POTATO)) {
//replace all the item, be generous. we could instead stack.shrink and drop just one
player.setItemInHand(hand, new ItemStack(PotatoModRegistry.PEELED.get(), stack.getCount()));
LayeredCauldronBlock.lowerFillLevel(state, level, pos);
return InteractionResult.sidedSuccess(level.isClientSide);
}
return InteractionResult.PASS;
{
"multipart": [
{ "apply": { "model": "tinylightbulbs:block/part_base" }},
{ "when": { "color": "black" },
"apply": { "model": "tinylightbulbs:block/bulb_black", "uvlock": true }
},
{ "when": { "color": "blue" },
"apply": { "model": "tinylightbulbs:block/bulb_blue", "uvlock": true }
},
{ "when": { "color": "brown" },
@Lothrazar
Lothrazar / forge 1.18.2 porting to 1.19
Created June 19, 2022 16:32
forge 1.18.2 porting to 1.19
clone new copy of source code, dont use a 1.18 workspace.
IE make new root folder C:\code\mc119
git clone [email protected]:Lothrazar/ForgeTemplate.git
Download forge mdk zip. we will need the following files.
https://files.minecraftforge.net/net/minecraftforge/forge/index_1.19.html
@Lothrazar
Lothrazar / ExtractFluidMultiTarget.java
Last active March 21, 2022 18:58
Extracts fluids from the world in minecraft: cauldron, waterlogged block, water source in-world. Fills the given tank one buckets worth
// PUBLIC DOMAIN
public static void extractFluidFromBlock(Level level, BlockPos posTarget, IFluidHandler tank) {
//fills always gonna be one bucket but we dont know what type yet
//test if its a source block, or a waterlogged block
BlockState targetState = level.getBlockState(posTarget);
FluidState fluidState = level.getFluidState(posTarget);
if (targetState.hasProperty(BlockStateProperties.WATERLOGGED) && targetState.getValue(BlockStateProperties.WATERLOGGED) == true) {
//for waterlogged it is hardcoded to water
int simFill = tank.fill(new FluidStack(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), FluidAttributes.BUCKET_VOLUME), FluidAction.SIMULATE);
if (simFill == FluidAttributes.BUCKET_VOLUME
@Lothrazar
Lothrazar / end_stone_bricks.properties
Created September 25, 2020 02:04
end_stone_bricks.properties in assets/minecraft/optifine/ctm/yourfolder
matchBlocks=stone_bricks mossy_stone_bricks cracked_stone_bricks oak_planks spruce_planks acacia_planks birch_planks dark_oak_planks jungle_planks warped_planks crimson_planks polished_blackstone_bricks cracked_polished_blackstone_bricks purpur_block cobblestone end_stone polished_diorite polished_granite polished_andesite diorite granite andesite stone bricks nether_bricks sandstone cut_sandstone smooth_sandstone white_concrete orange_concrete magenta_concrete light_blue_concrete yellow_concrete lime_concrete pink_concrete gray_concrete light_gray_concrete cyan_concrete purple_concrete blue_concrete brown_concrete green_concrete red_concrete black_concrete terracotta white_terracotta orange_terracotta magenta_terracotta light_blue_terracotta yellow_terracotta lime_terracotta pink_terracotta gray_terracotta light_gray_terracotta cyan_terracotta purple_terracotta blue_terracotta brown_terracotta green_terracotta red_terracotta black_terracotta
connectBlocks=end_stone_bricks
method=overlay
tiles=0-16
connect=
@Lothrazar
Lothrazar / button death screen minecraft
Created March 23, 2020 02:21
button death screen minecraft
@SubscribeEvent
public void onRenderDeathScreen(InitGuiEvent e) {
if (e.getGui() instanceof DeathScreen) {
DeathScreen screen = (DeathScreen) e.getGui();
//
try {
Method m = ObfuscationReflectionHelper.findMethod(Screen.class, "addButton", Widget.class);
m.setAccessible(true);
Button b = new Button(screen.width / 2 - 100, screen.height / 4 + 96 + 24, 200, 20, "hello twitter", (thing) -> {
`[21:25:01] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] LZMP加入了游戏
[21:25:01] [Server thread/INFO] [Waila]: Player EntityPlayerMP['LZMP'/219, l='新的世界', x=-242.50, y=81.00, z=232.50] connected. Sending ping
[21:25:01] [Server thread/INFO] [EnderCore]: Sending server configs to client for com.enderio.core.common.config.ConfigHandler
[21:25:01] [Server thread/INFO] [Actually Additions]: Sending Player Data to player LZMP with UUID eb1efc42-b162-3072-8659-93b0eb622cf9.
[21:25:09] [Netty Server IO #4/ERROR] [FML]: NetworkDispatcher exception
io.netty.handler.codec.DecoderException: java.io.IOException: Packet 0/27 (CPacketCreativeInventoryAction) was larger than I expected, found 1 bytes extra whilst reading packet 27
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:442) ~[netty-all-4.1.9.Final.jar:4.1.9.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:248) ~[netty-all-4.1.9.Final.jar:4.1.9.Final]
at io.netty.ch
#General settings
[growthcontrols]
#List of biomes for sapling
"minecraft:birch_sapling" = ["minecraft:birch_forest", "minecraft:forest", "minecraft:birch_forest_hills", "minecraft:tall_birch_forest", "minecraft:tall_birch_hills"]
#List of biomes for sapling
"minecraft:jungle_sapling" = ["minecraft:jungle_edge", "minecraft:jungle", "minecraft:jungle_hills", "minecraft:modified_jungle", "minecraft:bamboo_jungle", "minecraft:bamboo_jungle_hills", "minecraft:modified_jungle_edge", "minecraft:modified_jungle"]
#List of biomes for sapling
"minecraft:oak_sapling" = ["minecraft:forest", "minecraft:dark_forest", "minecraft:wooded_mountains", "minecraft:wooded_hills", "minecraft:swamp", "minecraft:swamp_hills", "minecraft:flower_forest"]
#List of biomes for sapling
@Lothrazar
Lothrazar / elementaryores.toml
Created July 29, 2019 15:16
elementaryores.toml
#General settings
[elementaryores]
[elementaryores.end]
[elementaryores.end.ender]
#Min and max y levels for spawn
#Range: 0 ~ 256
high = 127