This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
primes = [] | |
first100primes = [] | |
START_VALS = range(0,3) | |
SIZE_VALS = range(1,4) | |
class XY: | |
def __init__(self, x, y): | |
self.x = x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Helper class that we use to register things | |
*/ | |
public class Registrator<T extends IForgeRegistryEntry<T>> | |
{ | |
public IForgeRegistry<T> registry; | |
public Registrator(IForgeRegistry<T> registry) | |
{ | |
this.registry = registry; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
how does furnace logic flow? | |
if burning, decrement burn time | |
rest of tick is on server worlds only | |
if burning, or if can start burning fuel and has a smeltable input | |
if not burning but can start cooking | |
set burn time based on fuel input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static final Direction D = Direction.DOWN; | |
public static final Direction U = Direction.UP; | |
public static final Direction N = Direction.NORTH; | |
public static final Direction S = Direction.SOUTH; | |
public static final Direction W = Direction.WEST; | |
public static final Direction E = Direction.EAST; | |
public static final Direction[] SAMES ={D,U,N,S,W,E}; | |
public static final Direction[] OPPOSITES = {U,D,S,N,E,W}; | |
public static final Direction[] ROTATE_X_DNUS = {N,S,U,D,W,E}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns an array of numbers [a0, a1, a2 ... a(n-1)] | |
* Where each number aX is unique, | |
* n is given by permutationSize, | |
* and the different possible numbers returnable are in the range [0, possibilities). | |
* | |
* Implements the algorithms given here | |
* https://stackoverflow.com/questions/158716/how-do-you-efficiently-generate-a-list-of-k-non-repeating-integers-between-0-and-n | |
* https://www.geeksforgeeks.org/generate-a-random-permutation-of-1-to-n/ | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FluidTest | |
{ | |
public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(ForgeRegistries.FLUIDS, "modid"); | |
public static final Pair<RegistryObject<ForgeFlowingFluid.Source>, RegistryObject<ForgeFlowingFluid.Flowing>> TEST_FLUIDS = | |
registerFluid("test_fluid", "flowing_test_fluid", | |
ForgeFlowingFluid.Source::new, | |
ForgeFlowingFluid.Flowing::new, | |
FluidAttributes.builder(new ResourceLocation("modid:block/test_fluid_still"), new ResourceLocation("modid:block/test_fluid_flowing"))); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The MIT License (MIT) | |
Copyright (c) 2020 Joseph Bettendorff a.k.a. "Commoble" | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
idletime has these interactions: | |
is reset to 0 when: | |
when attacked | |
in the despawn check, when: | |
when the despawn fails due to persistance flag set or preventDespawn returning true | |
when the forge event is denied | |
when the nearest player is closer than the random despawn distance | |
when piglin or raider uses a ranged attack | |
when raider starts targeting a home |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
water slowdown mechanics | |
assume an entity is in water | |
let moveSpeed = movement speed attribute | |
defaults to 0.7 for players? | |
let swimSpeed = swim speed modifier attribute | |
defaults to 1.0 | |
let depthStriderEnchantment be 0F, 1F, 2F, or 3F (depends on enchantment tier, hard capped at 3) if on ground, or half that if treading water | |
let depthStriderFactor = depthStriderEnchantment / 3F (results in a number in the range [0,1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
The MIT License (MIT) | |
Copyright (c) Joseph "Commoble" Bettendorff 2020 | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
OlderNewer