mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 09:05:17 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
982ed69776 | ||
|
|
1f46169e1e | ||
|
|
7bac75f370 | ||
|
|
06d9b6531c | ||
|
|
2991e767dd | ||
|
|
a901d80dd5 | ||
|
|
d86f58a0df | ||
|
|
0ad574257e | ||
|
|
4839d18c73 | ||
|
|
e539e7ecbb | ||
|
|
1b618fae90 | ||
|
|
f12a93fe1e | ||
|
|
617159c825 | ||
|
|
c72d6e9122 | ||
|
|
69ae178bf4 | ||
|
|
d391299340 | ||
|
|
40091678a8 | ||
|
|
2b43aa6301 | ||
|
|
44d9fff2b4 | ||
|
|
509a28efd3 |
No files matched your search
+13
-1
@@ -183,6 +183,12 @@ project(':forge') {
|
||||
srcDirs = ["$rootDir/src/userdev/resources"]
|
||||
}
|
||||
}
|
||||
userdev_test {
|
||||
compileClasspath += sourceSets.userdev.runtimeClasspath
|
||||
runtimeClasspath += sourceSets.userdev.runtimeClasspath
|
||||
compileClasspath += sourceSets.test.runtimeClasspath
|
||||
runtimeClasspath += sourceSets.test.runtimeClasspath
|
||||
}
|
||||
}
|
||||
//Eclipse adds the sourcesets twice, once where we tell it to, once in the projects folder. No idea why. So delete them
|
||||
eclipse.classpath.file.whenMerged { cls -> cls.entries.removeIf { e -> e instanceof SourceFolder && e.path.startsWith('src/') && !e.path.startsWith('src/main/') } }
|
||||
@@ -204,7 +210,7 @@ project(':forge') {
|
||||
MCP_ARTIFACT = project(':mcp').mcp.config
|
||||
SPECIAL_SOURCE = 'net.md-5:SpecialSource:1.8.5'
|
||||
VERSION_JSON = project(':mcp').file('build/mcp/downloadJson/version.json')
|
||||
BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.0.7:fatjar'
|
||||
BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.0.12:fatjar'
|
||||
}
|
||||
|
||||
def getVersion = {
|
||||
@@ -266,6 +272,8 @@ project(':forge') {
|
||||
|
||||
environment 'MOD_CLASSES', 'dummy' // Needed to work around FG limitation, FG will replace this!
|
||||
|
||||
ideaModule "${rootProject.name}.${project.name}.userdev_test"
|
||||
|
||||
mods {
|
||||
TestMods { sources sourceSets.test }
|
||||
}
|
||||
@@ -298,6 +306,8 @@ project(':forge') {
|
||||
|
||||
environment 'MOD_CLASSES', 'dummy' // Needed to work around FG limitation, FG will replace this!
|
||||
|
||||
ideaModule "${rootProject.name}.${project.name}.userdev_test"
|
||||
|
||||
mods {
|
||||
TestMods { sources sourceSets.test }
|
||||
}
|
||||
@@ -333,6 +343,8 @@ project(':forge') {
|
||||
|
||||
environment 'MOD_CLASSES', 'dummy' // Needed to work around FG limitation, FG will replace this!
|
||||
|
||||
ideaModule "${rootProject.name}.${project.name}.userdev_test"
|
||||
|
||||
mods {
|
||||
tests { sources sourceSets.test }
|
||||
}
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
public class PoweredRailBlock extends AbstractRailBlock {
|
||||
public static final EnumProperty<RailShape> field_176568_b = BlockStateProperties.field_208166_S;
|
||||
public static final BooleanProperty field_176569_M = BlockStateProperties.field_208194_u;
|
||||
+ private final boolean isActivator;
|
||||
+ private final boolean isActivator; // TRUE for an Activator Rail, FALSE for Powered Rail
|
||||
|
||||
protected PoweredRailBlock(Block.Properties p_i48349_1_) {
|
||||
- super(true, p_i48349_1_);
|
||||
+ this(p_i48349_1_, false);
|
||||
+ }
|
||||
+
|
||||
+ protected PoweredRailBlock(Block.Properties builder, boolean isActivator) {
|
||||
+ protected PoweredRailBlock(Block.Properties builder, boolean isPoweredRail) {
|
||||
+ super(true, builder);
|
||||
this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176568_b, RailShape.NORTH_SOUTH).func_206870_a(field_176569_M, Boolean.valueOf(false)));
|
||||
+ this.isActivator = isActivator;
|
||||
+ this.isActivator = !isPoweredRail;
|
||||
}
|
||||
|
||||
protected boolean func_176566_a(World p_176566_1_, BlockPos p_176566_2_, BlockState p_176566_3_, boolean p_176566_4_, int p_176566_5_) {
|
||||
@@ -35,3 +35,12 @@
|
||||
return p_208071_1_.func_175640_z(p_208071_2_) ? true : this.func_176566_a(p_208071_1_, p_208071_2_, blockstate, p_208071_3_, p_208071_4_ + 1);
|
||||
} else {
|
||||
return false;
|
||||
@@ -255,4 +261,8 @@
|
||||
protected void func_206840_a(StateContainer.Builder<Block, BlockState> p_206840_1_) {
|
||||
p_206840_1_.func_206894_a(field_176568_b, field_176569_M);
|
||||
}
|
||||
+
|
||||
+ public boolean isActivatorRail() {
|
||||
+ return isActivator;
|
||||
+ }
|
||||
}
|
||||
@@ -38,11 +38,8 @@
|
||||
}
|
||||
|
||||
for(SoundCategory soundcategory : SoundCategory.values()) {
|
||||
@@ -712,6 +718,25 @@
|
||||
}
|
||||
}
|
||||
@@ -714,4 +720,22 @@
|
||||
|
||||
+ if (net.minecraftforge.fml.client.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted.
|
||||
p_198017_1_.func_198985_a(set);
|
||||
}
|
||||
+
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
Util.field_211180_a = RenderSystem.initBackendSystem();
|
||||
this.field_195557_T = new VirtualScreen(this);
|
||||
this.field_195558_d = this.field_195557_T.func_217626_a(screensize, this.field_71474_y.field_198019_u, this.func_230149_ax_());
|
||||
@@ -383,7 +384,6 @@
|
||||
@@ -383,13 +384,13 @@
|
||||
|
||||
this.field_195558_d.func_216526_a(this.field_71474_y.field_74350_i);
|
||||
this.field_71417_B = new MouseHelper(this);
|
||||
@@ -32,14 +32,13 @@
|
||||
this.field_195559_v = new KeyboardListener(this);
|
||||
this.field_195559_v.func_197968_a(this.field_195558_d.func_198092_i());
|
||||
RenderSystem.initRenderer(this.field_71474_y.field_209231_W, false);
|
||||
@@ -391,6 +391,7 @@
|
||||
this.field_147124_at = new Framebuffer(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l(), true, field_142025_a);
|
||||
this.field_147124_at.func_147604_a(0.0F, 0.0F, 0.0F, 0.0F);
|
||||
this.field_110451_am = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES, this.field_152352_aC);
|
||||
this.field_71474_y.func_198017_a(this.field_110448_aq);
|
||||
+ net.minecraftforge.fml.client.ClientModLoader.begin(this, this.field_110448_aq, this.field_110451_am, this.field_195554_ax);
|
||||
this.field_71474_y.func_198017_a(this.field_110448_aq);
|
||||
this.field_110448_aq.func_198983_a();
|
||||
this.field_135017_as = new LanguageManager(this.field_71474_y.field_74363_ab);
|
||||
this.field_110451_am.func_219534_a(this.field_135017_as);
|
||||
@@ -434,12 +435,14 @@
|
||||
this.func_193986_ar();
|
||||
this.field_110451_am.func_219534_a(this.field_193995_ae);
|
||||
@@ -303,13 +302,7 @@
|
||||
WorkingScreen workingscreen = new WorkingScreen();
|
||||
workingscreen.func_200210_a(new TranslationTextComponent("connect.joining"));
|
||||
this.func_213241_c(workingscreen);
|
||||
@@ -1608,15 +1665,18 @@
|
||||
if (clientplaynethandler != null) {
|
||||
this.func_213159_be();
|
||||
clientplaynethandler.func_147296_c();
|
||||
+ net.minecraftforge.client.MinecraftForgeClient.clearRenderCache();
|
||||
}
|
||||
|
||||
@@ -1613,10 +1670,12 @@
|
||||
IntegratedServer integratedserver = this.field_71437_Z;
|
||||
this.field_71437_Z = null;
|
||||
this.field_71460_t.func_190564_k();
|
||||
@@ -322,7 +315,23 @@
|
||||
if (integratedserver != null) {
|
||||
while(!integratedserver.func_213201_w()) {
|
||||
this.func_195542_b(false);
|
||||
@@ -1674,112 +1734,9 @@
|
||||
@@ -1627,6 +1686,7 @@
|
||||
this.field_71456_v.func_181029_i();
|
||||
this.field_71422_O = null;
|
||||
this.field_71455_al = false;
|
||||
+ net.minecraftforge.fml.client.ClientHooks.handleClientWorldClosing(field_71441_e);
|
||||
this.field_213274_aO.func_216815_b();
|
||||
}
|
||||
|
||||
@@ -1649,6 +1709,7 @@
|
||||
this.field_71452_i.func_78870_a(p_213257_1_);
|
||||
TileEntityRendererDispatcher.field_147556_a.func_147543_a(p_213257_1_);
|
||||
this.func_230150_b_();
|
||||
+ net.minecraftforge.client.MinecraftForgeClient.clearRenderCache();
|
||||
}
|
||||
|
||||
public final boolean func_71355_q() {
|
||||
@@ -1674,112 +1735,9 @@
|
||||
|
||||
private void func_147112_ai() {
|
||||
if (this.field_71476_x != null && this.field_71476_x.func_216346_c() != RayTraceResult.Type.MISS) {
|
||||
@@ -438,7 +447,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1861,6 +1818,7 @@
|
||||
@@ -1861,6 +1819,7 @@
|
||||
return field_71432_P;
|
||||
}
|
||||
|
||||
@@ -446,7 +455,7 @@
|
||||
public CompletableFuture<Void> func_213245_w() {
|
||||
return this.func_213169_a(this::func_213237_g).thenCompose((p_229993_0_) -> {
|
||||
return p_229993_0_;
|
||||
@@ -1988,6 +1946,8 @@
|
||||
@@ -1988,6 +1947,8 @@
|
||||
}
|
||||
|
||||
public MusicTicker.MusicType func_147109_W() {
|
||||
@@ -455,7 +464,7 @@
|
||||
if (this.field_71462_r instanceof WinGameScreen) {
|
||||
return MusicTicker.MusicType.CREDITS;
|
||||
} else if (this.field_71439_g == null) {
|
||||
@@ -2164,7 +2124,7 @@
|
||||
@@ -2164,7 +2125,7 @@
|
||||
supplier = func_228022_c_(supplier);
|
||||
}
|
||||
|
||||
@@ -464,7 +473,7 @@
|
||||
}
|
||||
|
||||
private static Supplier<IResourcePack> func_228021_b_(Supplier<IResourcePack> p_228021_0_) {
|
||||
@@ -2182,4 +2142,12 @@
|
||||
@@ -2182,4 +2143,12 @@
|
||||
public void func_228020_b_(int p_228020_1_) {
|
||||
this.field_175617_aL.func_229355_a_(p_228020_1_);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
}
|
||||
|
||||
return p_178893_1_.equals(this.field_178895_c) && flag;
|
||||
@@ -256,13 +264,19 @@
|
||||
@@ -256,13 +264,24 @@
|
||||
return ActionResultType.FAIL;
|
||||
} else {
|
||||
ItemStack itemstack = p_217292_1_.func_184586_b(p_217292_3_);
|
||||
@@ -105,6 +105,11 @@
|
||||
return ActionResultType.SUCCESS;
|
||||
} else {
|
||||
- boolean flag = !p_217292_1_.func_184614_ca().func_190926_b() || !p_217292_1_.func_184592_cb().func_190926_b();
|
||||
+ ItemUseContext itemusecontext = new ItemUseContext(p_217292_1_, p_217292_3_, p_217292_4_);
|
||||
+ if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) {
|
||||
+ ActionResultType result = itemstack.onItemUseFirst(itemusecontext);
|
||||
+ if (result != ActionResultType.PASS) return result;
|
||||
+ }
|
||||
+ boolean flag = !p_217292_1_.func_184614_ca().doesSneakBypassUse(p_217292_2_,blockpos,p_217292_1_) || !p_217292_1_.func_184592_cb().doesSneakBypassUse(p_217292_2_,blockpos,p_217292_1_);
|
||||
boolean flag1 = p_217292_1_.func_226563_dT_() && flag;
|
||||
- if (!flag1) {
|
||||
@@ -112,15 +117,17 @@
|
||||
ActionResultType actionresulttype = p_217292_2_.func_180495_p(blockpos).func_227031_a_(p_217292_2_, p_217292_1_, p_217292_3_, p_217292_4_);
|
||||
if (actionresulttype.func_226246_a_()) {
|
||||
this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_));
|
||||
@@ -271,6 +285,7 @@
|
||||
@@ -271,8 +290,8 @@
|
||||
}
|
||||
|
||||
this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_));
|
||||
+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return ActionResultType.PASS;
|
||||
if (!itemstack.func_190926_b() && !p_217292_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) {
|
||||
ItemUseContext itemusecontext = new ItemUseContext(p_217292_1_, p_217292_3_, p_217292_4_);
|
||||
- ItemUseContext itemusecontext = new ItemUseContext(p_217292_1_, p_217292_3_, p_217292_4_);
|
||||
ActionResultType actionresulttype1;
|
||||
@@ -300,11 +315,14 @@
|
||||
if (this.field_78779_k.func_77145_d()) {
|
||||
int i = itemstack.func_190916_E();
|
||||
@@ -300,11 +319,14 @@
|
||||
if (p_187101_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) {
|
||||
return ActionResultType.PASS;
|
||||
} else {
|
||||
@@ -135,7 +142,7 @@
|
||||
}
|
||||
|
||||
return actionresult.func_188397_a();
|
||||
@@ -329,6 +347,9 @@
|
||||
@@ -329,6 +351,9 @@
|
||||
public ActionResultType func_187097_a(PlayerEntity p_187097_1_, Entity p_187097_2_, Hand p_187097_3_) {
|
||||
this.func_78750_j();
|
||||
this.field_78774_b.func_147297_a(new CUseEntityPacket(p_187097_2_, p_187097_3_));
|
||||
@@ -145,7 +152,7 @@
|
||||
return this.field_78779_k == GameType.SPECTATOR ? ActionResultType.PASS : p_187097_1_.func_190775_a(p_187097_2_, p_187097_3_);
|
||||
}
|
||||
|
||||
@@ -336,6 +357,9 @@
|
||||
@@ -336,6 +361,9 @@
|
||||
this.func_78750_j();
|
||||
Vec3d vec3d = p_187102_3_.func_216347_e().func_178786_a(p_187102_2_.func_226277_ct_(), p_187102_2_.func_226278_cu_(), p_187102_2_.func_226281_cx_());
|
||||
this.field_78774_b.func_147297_a(new CUseEntityPacket(p_187102_2_, p_187102_4_, vec3d));
|
||||
|
||||
@@ -35,14 +35,14 @@
|
||||
if (flag) {
|
||||
float f5 = hand == Hand.MAIN_HAND ? f : 0.0F;
|
||||
float f2 = 1.0F - MathHelper.func_219799_g(p_228396_1_, this.field_187470_g, this.field_187469_f);
|
||||
+ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(Hand.MAIN_HAND, p_228396_2_, p_228396_1_, f1, f3, f5, this.field_187467_d))
|
||||
+ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(Hand.MAIN_HAND, p_228396_2_, p_228396_3_, p_228396_5_, p_228396_1_, f1, f3, f5, this.field_187467_d))
|
||||
this.func_228405_a_(p_228396_4_, p_228396_1_, f1, Hand.MAIN_HAND, f5, this.field_187467_d, f2, p_228396_2_, p_228396_3_, p_228396_5_);
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
float f6 = hand == Hand.OFF_HAND ? f : 0.0F;
|
||||
float f7 = 1.0F - MathHelper.func_219799_g(p_228396_1_, this.field_187472_i, this.field_187471_h);
|
||||
+ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(Hand.OFF_HAND, p_228396_2_, p_228396_1_, f1, f4, f6, this.field_187468_e))
|
||||
+ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(Hand.OFF_HAND, p_228396_2_, p_228396_3_, p_228396_5_, p_228396_1_, f1, f4, f6, this.field_187468_e))
|
||||
this.func_228405_a_(p_228396_4_, p_228396_1_, f1, Hand.OFF_HAND, f6, this.field_187468_e, f7, p_228396_2_, p_228396_3_, p_228396_5_);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,19 @@
|
||||
flag7 = true;
|
||||
}
|
||||
|
||||
@@ -222,10 +223,10 @@
|
||||
flag7 = true;
|
||||
BlockPos blockpos = p_228796_2_.func_177972_a(direction);
|
||||
TextureAtlasSprite textureatlassprite2 = atextureatlassprite[1];
|
||||
- if (!flag) {
|
||||
+ if (atextureatlassprite[2] != null) {
|
||||
Block block = p_228796_1_.func_180495_p(blockpos).func_177230_c();
|
||||
if (block == Blocks.field_150359_w || block instanceof StainedGlassBlock) {
|
||||
- textureatlassprite2 = this.field_187501_d;
|
||||
+ textureatlassprite2 = atextureatlassprite[2];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,15 +240,15 @@
|
||||
float f31 = 1.0F * f30 * f;
|
||||
float f32 = 1.0F * f30 * f1;
|
||||
@@ -59,15 +72,16 @@
|
||||
- this.func_228797_a_(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, f49, f28, k);
|
||||
- this.func_228797_a_(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, f49, f29, k);
|
||||
- this.func_228797_a_(p_228796_3_, d3, d1 + (double)f12, d4, f31, f32, f33, f48, f29, k);
|
||||
+ this.func_228797_a_(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, alpha, f48, f50, k);
|
||||
+ this.func_228797_a_(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, alpha, f49, f28, k);
|
||||
+ this.func_228797_a_(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, alpha, f49, f29, k);
|
||||
+ this.func_228797_a_(p_228796_3_, d3, d1 + (double)f12, d4, f31, f32, f33, alpha, f48, f29, k);
|
||||
if (textureatlassprite2 != this.field_187501_d) {
|
||||
- if (textureatlassprite2 != this.field_187501_d) {
|
||||
- this.func_228797_a_(p_228796_3_, d3, d1 + (double)f12, d4, f31, f32, f33, f48, f29, k);
|
||||
- this.func_228797_a_(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, f49, f29, k);
|
||||
- this.func_228797_a_(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, f49, f28, k);
|
||||
- this.func_228797_a_(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, f48, f50, k);
|
||||
+ this.func_228797_a_(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, alpha, f48, f50, k);
|
||||
+ this.func_228797_a_(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, alpha, f49, f28, k);
|
||||
+ this.func_228797_a_(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, alpha, f49, f29, k);
|
||||
+ this.func_228797_a_(p_228796_3_, d3, d1 + (double)f12, d4, f31, f32, f33, alpha, f48, f29, k);
|
||||
+ if (textureatlassprite2 != atextureatlassprite[2]) {
|
||||
+ this.func_228797_a_(p_228796_3_, d3, d1 + (double)f12, d4, f31, f32, f33, alpha, f48, f29, k);
|
||||
+ this.func_228797_a_(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, alpha, f49, f29, k);
|
||||
+ this.func_228797_a_(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, alpha, f49, f28, k);
|
||||
|
||||
@@ -18,15 +18,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,6 +360,7 @@
|
||||
}
|
||||
|
||||
boolean flag = this.field_78531_r.func_175606_aa() instanceof LivingEntity && ((LivingEntity)this.field_78531_r.func_175606_aa()).func_70608_bn();
|
||||
+ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(field_78531_r.field_71438_f, p_228381_1_, p_228381_3_))
|
||||
if (this.field_78531_r.field_71474_y.field_74320_O == 0 && !flag && !this.field_78531_r.field_71474_y.field_74319_N && this.field_78531_r.field_71442_b.func_178889_l() != GameType.SPECTATOR) {
|
||||
this.field_78513_d.func_205109_c();
|
||||
this.field_78516_c.func_228396_a_(p_228381_3_, p_228381_1_, this.field_228374_i_.func_228487_b_(), this.field_78531_r.field_71439_g, this.field_78531_r.func_175598_ae().func_229085_a_(this.field_78531_r.field_71439_g, p_228381_3_));
|
||||
@@ -475,7 +478,7 @@
|
||||
@@ -475,7 +477,7 @@
|
||||
}
|
||||
} else if (this.field_78531_r.field_71462_r != null) {
|
||||
try {
|
||||
@@ -35,7 +27,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport1 = CrashReport.func_85055_a(throwable, "Rendering screen");
|
||||
CrashReportCategory crashreportcategory1 = crashreport1.func_85058_a("Screen render details");
|
||||
@@ -588,9 +591,16 @@
|
||||
@@ -588,9 +590,16 @@
|
||||
Matrix4f matrix4f = matrixstack.func_227866_c_().func_227870_a_();
|
||||
this.func_228379_a_(matrix4f);
|
||||
activerenderinfo.func_216772_a(this.field_78531_r.field_71441_e, (Entity)(this.field_78531_r.func_175606_aa() == null ? this.field_78531_r.field_71439_g : this.field_78531_r.func_175606_aa()), this.field_78531_r.field_71474_y.field_74320_O > 0, this.field_78531_r.field_71474_y.field_74320_O == 2, p_228378_1_);
|
||||
@@ -52,7 +44,7 @@
|
||||
this.field_78531_r.func_213239_aq().func_219895_b("hand");
|
||||
if (this.field_175074_C) {
|
||||
RenderSystem.clear(256, Minecraft.field_142025_a);
|
||||
@@ -670,4 +680,9 @@
|
||||
@@ -670,4 +679,9 @@
|
||||
public OverlayTexture func_228385_m_() {
|
||||
return this.field_228375_t_;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
this.func_174967_a(p_228426_3_ + l1);
|
||||
iprofiler.func_219895_b("terrain");
|
||||
this.func_228441_a_(RenderType.func_228639_c_(), p_228426_1_, d0, d1, d2);
|
||||
+ this.field_72777_q.func_209506_al().func_229356_a_(AtlasTexture.field_110575_b).func_174937_a(false, this.field_72777_q.field_71474_y.field_151442_I > 0); // FORGE: fix flickering leaves when mods mess up the blurMipmap settings
|
||||
+ this.field_72777_q.func_209506_al().func_229356_a_(AtlasTexture.field_110575_b).setBlurMipmap(false, this.field_72777_q.field_71474_y.field_151442_I > 0); // FORGE: fix flickering leaves when mods mess up the blurMipmap settings
|
||||
this.func_228441_a_(RenderType.func_228641_d_(), p_228426_1_, d0, d1, d2);
|
||||
+ this.field_72777_q.func_209506_al().func_229356_a_(AtlasTexture.field_110575_b).restoreLastBlurMipmap();
|
||||
this.func_228441_a_(RenderType.func_228643_e_(), p_228426_1_, d0, d1, d2);
|
||||
@@ -68,7 +68,7 @@
|
||||
BlockPos blockpos = ((BlockRayTraceResult)raytraceresult).func_216350_a();
|
||||
BlockState blockstate = this.field_72769_h.func_180495_p(blockpos);
|
||||
- if (!blockstate.func_196958_f() && this.field_72769_h.func_175723_af().func_177746_a(blockpos)) {
|
||||
+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(this, p_228426_6_, field_72777_q.field_71476_x, 0, p_228426_2_))
|
||||
+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(this, p_228426_6_, field_72777_q.field_71476_x, p_228426_2_, p_228426_1_, irendertypebuffer$impl))
|
||||
+ if (!blockstate.isAir(this.field_72769_h, blockpos) && this.field_72769_h.func_175723_af().func_177746_a(blockpos)) {
|
||||
IVertexBuilder ivertexbuilder2 = irendertypebuffer$impl.getBuffer(RenderType.func_228659_m_());
|
||||
this.func_228429_a_(p_228426_1_, ivertexbuilder2, p_228426_6_.func_216773_g(), d0, d1, d2, blockpos, blockstate);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
+ int i = mapdata != null ? p_225623_1_.func_82333_j() % 4 * 2 : p_225623_1_.func_82333_j();
|
||||
p_225623_4_.func_227863_a_(Vector3f.field_229183_f_.func_229187_a_((float)i * 360.0F / 8.0F));
|
||||
- if (flag) {
|
||||
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderItemInFrameEvent(p_225623_1_, this))) {
|
||||
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderItemInFrameEvent(p_225623_1_, this, p_225623_4_, p_225623_5_, p_225623_6_))) {
|
||||
+ if (mapdata != null) {
|
||||
p_225623_4_.func_227863_a_(Vector3f.field_229183_f_.func_229187_a_(180.0F));
|
||||
float f = 0.0078125F;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
}
|
||||
|
||||
public void func_225623_a_(T p_225623_1_, float p_225623_2_, float p_225623_3_, MatrixStack p_225623_4_, IRenderTypeBuffer p_225623_5_, int p_225623_6_) {
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre<T, M>(p_225623_1_, this, p_225623_3_, p_225623_4_))) return;
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre<T, M>(p_225623_1_, this, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_))) return;
|
||||
p_225623_4_.func_227860_a_();
|
||||
this.field_77045_g.field_217112_c = this.func_77040_d(p_225623_1_, p_225623_3_);
|
||||
- this.field_77045_g.field_217113_d = p_225623_1_.func_184218_aH();
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
p_225623_4_.func_227865_b_();
|
||||
super.func_225623_a_(p_225623_1_, p_225623_2_, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_);
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post<T, M>(p_225623_1_, this, p_225623_3_, p_225623_4_));
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post<T, M>(p_225623_1_, this, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
public void func_225623_a_(AbstractClientPlayerEntity p_225623_1_, float p_225623_2_, float p_225623_3_, MatrixStack p_225623_4_, IRenderTypeBuffer p_225623_5_, int p_225623_6_) {
|
||||
this.func_177137_d(p_225623_1_);
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(p_225623_1_, this, p_225623_3_, p_225623_4_))) return;
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(p_225623_1_, this, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_))) return;
|
||||
super.func_225623_a_(p_225623_1_, p_225623_2_, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_);
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_225623_1_, this, p_225623_3_, p_225623_4_));
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_225623_1_, this, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_));
|
||||
}
|
||||
|
||||
public Vec3d func_225627_b_(AbstractClientPlayerEntity p_225627_1_, float p_225627_2_) {
|
||||
@@ -5,7 +5,7 @@
|
||||
private final ItemCameraTransforms field_177651_f;
|
||||
|
||||
+ public Builder(net.minecraftforge.client.model.IModelConfiguration model, ItemOverrideList overrides) {
|
||||
+ this(model.useSmoothLighting(), model.isShadedInGui(), true/*TODO: Forge*/, model.getCameraTransforms(), overrides);
|
||||
+ this(model.useSmoothLighting(), model.isShadedInGui(), model.isSideLit(), model.getCameraTransforms(), overrides);
|
||||
+ }
|
||||
+
|
||||
public Builder(BlockModel p_i230060_1_, ItemOverrideList p_i230060_2_, boolean p_i230060_3_) {
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
--- a/net/minecraft/client/renderer/texture/Texture.java
|
||||
+++ b/net/minecraft/client/renderer/texture/Texture.java
|
||||
@@ -33,6 +33,11 @@
|
||||
@@ -33,6 +33,20 @@
|
||||
GlStateManager.func_227677_b_(3553, 10240, j);
|
||||
}
|
||||
|
||||
+ // FORGE: This seems to have been stripped out, but we need it
|
||||
+ private boolean lastBlur;
|
||||
+ private boolean lastMipmap;
|
||||
+
|
||||
+ public void setBlurMipmap(boolean blur, boolean mipmap) {
|
||||
+ this.lastBlur = this.field_174940_b;
|
||||
+ this.lastMipmap = this.field_174941_c;
|
||||
+ func_174937_a(blur, mipmap);
|
||||
+ }
|
||||
+
|
||||
+ public void restoreLastBlurMipmap() {
|
||||
+ func_174937_a(this.field_174940_b, this.field_174941_c);
|
||||
+ func_174937_a(this.lastBlur, this.lastMipmap);
|
||||
+ }
|
||||
+
|
||||
public int func_110552_b() {
|
||||
|
||||
+3
-4
@@ -17,14 +17,13 @@
|
||||
p_195667_3_[i].func_227788_a_(i, this.field_110975_c >> i, this.field_110974_d >> i, p_195667_1_ >> i, p_195667_2_ >> i, this.field_229226_c_.field_229245_b_ >> i, this.field_229226_c_.field_229246_c_ >> i, this.field_195670_c.length > 1, false);
|
||||
}
|
||||
|
||||
@@ -341,4 +342,10 @@
|
||||
@@ -341,4 +342,9 @@
|
||||
|
||||
}
|
||||
}
|
||||
+
|
||||
+
|
||||
+ // Forge Start
|
||||
+
|
||||
+ public int getPixelRGBA(int frameIndex, int x, int y) {
|
||||
+ return this.field_195670_c[frameIndex].func_195709_a(x + this.field_195671_d[frameIndex] * func_94211_a(), y + this.field_195672_e[frameIndex] * func_94216_b());
|
||||
+ return this.field_195670_c[0].func_195709_a(x + this.field_195671_d[frameIndex] * func_94211_a(), y + this.field_195672_e[frameIndex] * func_94216_b());
|
||||
+ }
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/client/renderer/tileentity/ChestTileEntityRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/tileentity/ChestTileEntityRenderer.java
|
||||
@@ -98,7 +98,7 @@
|
||||
f1 = 1.0F - f1;
|
||||
f1 = 1.0F - f1 * f1 * f1;
|
||||
int i = icallbackwrapper.apply(new DualBrightnessCallback<>()).applyAsInt(p_225616_5_);
|
||||
- Material material = Atlases.func_228771_a_(p_225616_1_, chesttype, this.field_147509_j);
|
||||
+ Material material = this.getMaterial(p_225616_1_, chesttype);
|
||||
IVertexBuilder ivertexbuilder = material.func_229311_a_(p_225616_4_, RenderType::func_228638_b_);
|
||||
if (flag1) {
|
||||
if (chesttype == ChestType.LEFT) {
|
||||
@@ -121,4 +121,8 @@
|
||||
p_228871_4_.func_228308_a_(p_228871_1_, p_228871_2_, p_228871_7_, p_228871_8_);
|
||||
p_228871_5_.func_228308_a_(p_228871_1_, p_228871_2_, p_228871_7_, p_228871_8_);
|
||||
}
|
||||
+
|
||||
+ protected Material getMaterial(T tileEntity, ChestType chestType) {
|
||||
+ return Atlases.func_228771_a_(tileEntity, chestType, this.field_147509_j);
|
||||
+ }
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
public static void func_197981_a(InputMappings.Input p_197981_0_) {
|
||||
- KeyBinding keybinding = field_74514_b.get(p_197981_0_);
|
||||
+ for (KeyBinding keybinding : field_74514_b.lookupAll(p_197981_0_))
|
||||
+ KeyBinding keybinding = field_74514_b.lookupActive(p_197981_0_);
|
||||
if (keybinding != null) {
|
||||
++keybinding.field_151474_i;
|
||||
}
|
||||
|
||||
@@ -222,15 +222,27 @@
|
||||
}
|
||||
|
||||
public boolean func_70028_i(Entity p_70028_1_) {
|
||||
@@ -2046,6 +2073,7 @@
|
||||
@@ -2046,6 +2073,11 @@
|
||||
|
||||
@Nullable
|
||||
public Entity func_212321_a(DimensionType p_212321_1_) {
|
||||
+ return this.changeDimension(p_212321_1_, func_184102_h().func_71218_a(p_212321_1_).func_85176_s());
|
||||
+ }
|
||||
+ @Nullable
|
||||
+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) {
|
||||
+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_212321_1_)) return null;
|
||||
if (!this.field_70170_p.field_72995_K && !this.field_70128_L) {
|
||||
this.field_70170_p.func_217381_Z().func_76320_a("changeDimension");
|
||||
MinecraftServer minecraftserver = this.func_184102_h();
|
||||
@@ -2063,16 +2091,9 @@
|
||||
@@ -2055,6 +2087,7 @@
|
||||
this.field_71093_bK = p_212321_1_;
|
||||
this.func_213319_R();
|
||||
this.field_70170_p.func_217381_Z().func_76320_a("reposition");
|
||||
+ Entity transportedEntity = teleporter.placeEntity(this, serverworld, serverworld1, this.field_70177_z, spawnPortal -> { //Forge: Start vanilla logic
|
||||
Vec3d vec3d = this.func_213322_ci();
|
||||
float f = 0.0F;
|
||||
BlockPos blockpos;
|
||||
@@ -2063,16 +2096,9 @@
|
||||
} else if (p_212321_1_ == DimensionType.field_223229_c_) {
|
||||
blockpos = serverworld1.func_180504_m();
|
||||
} else {
|
||||
@@ -250,16 +262,41 @@
|
||||
|
||||
double d3 = Math.min(-2.9999872E7D, serverworld1.func_175723_af().func_177726_b() + 16.0D);
|
||||
double d4 = Math.min(-2.9999872E7D, serverworld1.func_175723_af().func_177736_c() + 16.0D);
|
||||
@@ -2101,7 +2122,7 @@
|
||||
@@ -2082,6 +2108,7 @@
|
||||
d1 = MathHelper.func_151237_a(d1, d4, d6);
|
||||
Vec3d vec3d1 = this.func_181014_aG();
|
||||
blockpos = new BlockPos(d0, this.func_226278_cu_(), d1);
|
||||
+ if (spawnPortal) {
|
||||
BlockPattern.PortalInfo blockpattern$portalinfo = serverworld1.func_85176_s().func_222272_a(blockpos, vec3d, this.func_181012_aH(), vec3d1.field_72450_a, vec3d1.field_72448_b, this instanceof PlayerEntity);
|
||||
if (blockpattern$portalinfo == null) {
|
||||
return null;
|
||||
@@ -2090,6 +2117,7 @@
|
||||
blockpos = new BlockPos(blockpattern$portalinfo.field_222505_a);
|
||||
vec3d = blockpattern$portalinfo.field_222506_b;
|
||||
f = (float)blockpattern$portalinfo.field_222507_c;
|
||||
+ }
|
||||
}
|
||||
|
||||
this.field_70170_p.func_217381_Z().func_219895_b("reloading");
|
||||
@@ -2100,13 +2128,15 @@
|
||||
entity.func_213317_d(vec3d);
|
||||
serverworld1.func_217460_e(entity);
|
||||
}
|
||||
+ return entity;
|
||||
+ });//Forge: End vanilla logic
|
||||
|
||||
- this.field_70128_L = true;
|
||||
+ this.remove(false);
|
||||
this.field_70170_p.func_217381_Z().func_76319_b();
|
||||
serverworld.func_82742_i();
|
||||
serverworld1.func_82742_i();
|
||||
@@ -2129,10 +2150,12 @@
|
||||
this.field_70170_p.func_217381_Z().func_76319_b();
|
||||
- return entity;
|
||||
+ return transportedEntity;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@@ -2129,10 +2159,12 @@
|
||||
}
|
||||
|
||||
public Vec3d func_181014_aG() {
|
||||
@@ -272,7 +309,7 @@
|
||||
return this.field_181018_ap;
|
||||
}
|
||||
|
||||
@@ -2261,7 +2284,7 @@
|
||||
@@ -2261,7 +2293,7 @@
|
||||
Pose pose = this.func_213283_Z();
|
||||
EntitySize entitysize1 = this.func_213305_a(pose);
|
||||
this.field_213325_aI = entitysize1;
|
||||
@@ -281,7 +318,7 @@
|
||||
if (entitysize1.field_220315_a < entitysize.field_220315_a) {
|
||||
double d0 = (double)entitysize1.field_220315_a / 2.0D;
|
||||
this.func_174826_a(new AxisAlignedBB(this.func_226277_ct_() - d0, this.func_226278_cu_(), this.func_226281_cx_() - d0, this.func_226277_ct_() + d0, this.func_226278_cu_() + (double)entitysize1.field_220316_b, this.func_226281_cx_() + d0));
|
||||
@@ -2713,6 +2736,7 @@
|
||||
@@ -2713,6 +2745,7 @@
|
||||
this.field_70165_t = p_226288_1_;
|
||||
this.field_70163_u = p_226288_3_;
|
||||
this.field_70161_v = p_226288_5_;
|
||||
@@ -289,7 +326,7 @@
|
||||
}
|
||||
|
||||
public void func_70623_bb() {
|
||||
@@ -2726,4 +2750,69 @@
|
||||
@@ -2726,4 +2759,69 @@
|
||||
public interface IMoveCallback {
|
||||
void accept(Entity p_accept_1_, double p_accept_2_, double p_accept_4_, double p_accept_6_);
|
||||
}
|
||||
|
||||
@@ -22,3 +22,17 @@
|
||||
}
|
||||
} else if (livingentity != null) {
|
||||
livingentity.func_70634_a(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_());
|
||||
@@ -121,11 +124,11 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- public Entity func_212321_a(DimensionType p_212321_1_) {
|
||||
+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) {
|
||||
if (this.field_70192_c.field_71093_bK != p_212321_1_) {
|
||||
this.field_70192_c = null;
|
||||
}
|
||||
|
||||
- return super.func_212321_a(p_212321_1_);
|
||||
+ return super.changeDimension(p_212321_1_, teleporter);
|
||||
}
|
||||
}
|
||||
@@ -109,6 +109,17 @@
|
||||
this.func_70106_y();
|
||||
itemstack.func_190920_e(i);
|
||||
}
|
||||
@@ -300,8 +328,8 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- public Entity func_212321_a(DimensionType p_212321_1_) {
|
||||
- Entity entity = super.func_212321_a(p_212321_1_);
|
||||
+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) {
|
||||
+ Entity entity = super.changeDimension(p_212321_1_, teleporter);
|
||||
if (!this.field_70170_p.field_72995_K && entity instanceof ItemEntity) {
|
||||
((ItemEntity)entity).func_85054_d();
|
||||
}
|
||||
@@ -366,7 +394,7 @@
|
||||
|
||||
public void func_174870_v() {
|
||||
|
||||
+13
-4
@@ -31,15 +31,18 @@
|
||||
}
|
||||
|
||||
public double func_70042_X() {
|
||||
@@ -239,7 +241,7 @@
|
||||
@@ -239,9 +241,9 @@
|
||||
|
||||
BlockPos blockpos = new BlockPos(i, j, k);
|
||||
BlockState blockstate = this.field_70170_p.func_180495_p(blockpos);
|
||||
- if (blockstate.func_203425_a(BlockTags.field_203437_y)) {
|
||||
+ if (canUseRail() && blockstate.func_203425_a(BlockTags.field_203437_y)) {
|
||||
this.func_180460_a(blockpos, blockstate);
|
||||
if (blockstate.func_177230_c() == Blocks.field_150408_cc) {
|
||||
- if (blockstate.func_177230_c() == Blocks.field_150408_cc) {
|
||||
+ if (blockstate.func_177230_c() instanceof PoweredRailBlock && ((PoweredRailBlock) blockstate.func_177230_c()).isActivatorRail()) {
|
||||
this.func_96095_a(i, j, k, blockstate.func_177229_b(PoweredRailBlock.field_176569_M));
|
||||
}
|
||||
} else {
|
||||
@@ -266,8 +268,11 @@
|
||||
}
|
||||
|
||||
@@ -98,7 +101,13 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -327,24 +341,23 @@
|
||||
@@ -322,29 +336,28 @@
|
||||
boolean flag = false;
|
||||
boolean flag1 = false;
|
||||
AbstractRailBlock abstractrailblock = (AbstractRailBlock)p_180460_2_.func_177230_c();
|
||||
- if (abstractrailblock == Blocks.field_196552_aC) {
|
||||
+ if (abstractrailblock instanceof PoweredRailBlock && !((PoweredRailBlock) abstractrailblock).isActivatorRail()) {
|
||||
flag = p_180460_2_.func_177229_b(PoweredRailBlock.field_176569_M);
|
||||
flag1 = !flag;
|
||||
}
|
||||
|
||||
@@ -238,7 +247,7 @@
|
||||
+ public void moveMinecartOnRail(BlockPos pos) { //Non-default because getMaximumSpeed is protected
|
||||
+ AbstractMinecartEntity mc = getMinecart();
|
||||
+ double d24 = mc.func_184207_aI() ? 0.75D : 1.0D;
|
||||
+ double d25 = mc.func_174898_m();
|
||||
+ double d25 = mc.getMaxSpeedWithRail();
|
||||
+ Vec3d vec3d1 = mc.func_213322_ci();
|
||||
+ mc.func_213315_a(MoverType.SELF, new Vec3d(MathHelper.func_151237_a(d24 * vec3d1.field_72450_a, -d25, d25), 0.0D, MathHelper.func_151237_a(d24 * vec3d1.field_72449_c, -d25, d25)));
|
||||
+ }
|
||||
|
||||
+9
-2
@@ -1,7 +1,14 @@
|
||||
--- a/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java
|
||||
+++ b/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java
|
||||
@@ -115,12 +115,14 @@
|
||||
return super.func_212321_a(p_212321_1_);
|
||||
@@ -110,17 +110,19 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- public Entity func_212321_a(DimensionType p_212321_1_) {
|
||||
+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) {
|
||||
this.field_94112_b = false;
|
||||
- return super.func_212321_a(p_212321_1_);
|
||||
+ return super.changeDimension(p_212321_1_, teleporter);
|
||||
}
|
||||
|
||||
- public void func_70106_y() {
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
--- a/net/minecraft/entity/merchant/villager/AbstractVillagerEntity.java
|
||||
+++ b/net/minecraft/entity/merchant/villager/AbstractVillagerEntity.java
|
||||
@@ -179,9 +179,9 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- public Entity func_212321_a(DimensionType p_212321_1_) {
|
||||
+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) {
|
||||
this.func_213750_eg();
|
||||
- return super.func_212321_a(p_212321_1_);
|
||||
+ return super.changeDimension(p_212321_1_, teleporter);
|
||||
}
|
||||
|
||||
protected void func_213750_eg() {
|
||||
@@ -312,14 +312,14 @@
|
||||
return this.func_230126_g_(p_190774_1_) || this.func_230126_g_(p_190774_1_.func_177972_a(p_190774_2_.func_176734_d()));
|
||||
}
|
||||
|
||||
@@ -1289,6 +1357,7 @@
|
||||
@@ -1287,6 +1355,7 @@
|
||||
}
|
||||
|
||||
public void func_225652_a_(boolean p_225652_1_, boolean p_225652_2_) {
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_225652_1_, p_225652_2_);
|
||||
super.func_213366_dy();
|
||||
if (this.field_70170_p instanceof ServerWorld && p_225652_2_) {
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_225652_1_, p_225652_2_);
|
||||
((ServerWorld)this.field_70170_p).func_72854_c();
|
||||
}
|
||||
|
||||
@@ -1300,17 +1369,17 @@
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
|
||||
+ @Override
|
||||
@Nullable
|
||||
public Entity func_212321_a(DimensionType p_212321_1_) {
|
||||
- public Entity func_212321_a(DimensionType p_212321_1_) {
|
||||
+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) {
|
||||
+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_212321_1_)) return null;
|
||||
this.field_184851_cj = true;
|
||||
DimensionType dimensiontype = this.field_71093_bK;
|
||||
@@ -25,7 +26,7 @@
|
||||
if (!this.field_71136_j) {
|
||||
this.field_71136_j = true;
|
||||
this.field_71135_a.func_147359_a(new SChangeGameStatePacket(4, this.field_192040_cp ? 0.0F : 1.0F));
|
||||
@@ -569,12 +572,13 @@
|
||||
@@ -569,12 +572,14 @@
|
||||
this.field_71093_bK = p_212321_1_;
|
||||
ServerWorld serverworld1 = this.field_71133_b.func_71218_a(p_212321_1_);
|
||||
WorldInfo worldinfo = serverworld1.func_72912_H();
|
||||
@@ -38,10 +39,11 @@
|
||||
- this.field_70128_L = false;
|
||||
+ serverworld.removeEntity(this, true); //Forge: the player entity is moved to the new world, NOT cloned. So keep the data alive with no matching invalidate call.
|
||||
+ this.revive();
|
||||
+ Entity e = teleporter.placeEntity(this, serverworld, serverworld1, this.field_70177_z, spawnPortal -> {//Forge: Start vanilla logic
|
||||
double d0 = this.func_226277_ct_();
|
||||
double d1 = this.func_226278_cu_();
|
||||
double d2 = this.func_226281_cx_();
|
||||
@@ -583,13 +587,11 @@
|
||||
@@ -583,13 +588,11 @@
|
||||
double d3 = 8.0D;
|
||||
float f2 = f1;
|
||||
serverworld.func_217381_Z().func_76320_a("moving");
|
||||
@@ -58,7 +60,26 @@
|
||||
} else if (dimensiontype == DimensionType.field_223227_a_ && p_212321_1_ == DimensionType.field_223229_c_) {
|
||||
BlockPos blockpos = serverworld1.func_180504_m();
|
||||
d0 = (double)blockpos.func_177958_n();
|
||||
@@ -653,6 +655,7 @@
|
||||
@@ -630,7 +633,7 @@
|
||||
|
||||
this.func_70012_b((double)i, (double)j, (double)k, f1, 0.0F);
|
||||
this.func_213317_d(Vec3d.field_186680_a);
|
||||
- } else if (!serverworld1.func_85176_s().func_222268_a(this, f2)) {
|
||||
+ } else if (spawnPortal && !serverworld1.func_85176_s().func_222268_a(this, f2)) {
|
||||
serverworld1.func_85176_s().func_85188_a(this);
|
||||
serverworld1.func_85176_s().func_222268_a(this, f2);
|
||||
}
|
||||
@@ -640,6 +643,9 @@
|
||||
serverworld1.func_217447_b(this);
|
||||
this.func_213846_b(serverworld);
|
||||
this.field_71135_a.func_147364_a(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), f1, f);
|
||||
+ return this;//forge: this is part of the ITeleporter patch
|
||||
+ });//Forge: End vanilla logic
|
||||
+ if (e != this) throw new java.lang.IllegalArgumentException(String.format("Teleporter %s returned not the player entity but instead %s, expected PlayerEntity %s", teleporter, e, this));
|
||||
this.field_71134_c.func_73080_a(serverworld1);
|
||||
this.field_71135_a.func_147359_a(new SPlayerAbilitiesPacket(this.field_71075_bZ));
|
||||
playerlist.func_72354_b(this, serverworld1);
|
||||
@@ -653,6 +659,7 @@
|
||||
this.field_71144_ck = -1;
|
||||
this.field_71149_ch = -1.0F;
|
||||
this.field_71146_ci = -1;
|
||||
@@ -66,7 +87,7 @@
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -788,6 +791,7 @@
|
||||
@@ -788,6 +795,7 @@
|
||||
this.field_71135_a.func_147359_a(new SOpenWindowPacket(container.field_75152_c, container.func_216957_a(), p_213829_1_.func_145748_c_()));
|
||||
container.func_75132_a(this);
|
||||
this.field_71070_bA = container;
|
||||
@@ -74,7 +95,7 @@
|
||||
return OptionalInt.of(this.field_71139_cq);
|
||||
}
|
||||
}
|
||||
@@ -806,6 +810,7 @@
|
||||
@@ -806,6 +814,7 @@
|
||||
this.field_71135_a.func_147359_a(new SOpenHorseWindowPacket(this.field_71139_cq, p_184826_2_.func_70302_i_(), p_184826_1_.func_145782_y()));
|
||||
this.field_71070_bA = new HorseInventoryContainer(this.field_71139_cq, this.field_71071_by, p_184826_2_, p_184826_1_);
|
||||
this.field_71070_bA.func_75132_a(this);
|
||||
@@ -82,7 +103,7 @@
|
||||
}
|
||||
|
||||
public void func_184814_a(ItemStack p_184814_1_, Hand p_184814_2_) {
|
||||
@@ -863,6 +868,7 @@
|
||||
@@ -863,6 +872,7 @@
|
||||
|
||||
public void func_71128_l() {
|
||||
this.field_71070_bA.func_75134_a(this);
|
||||
@@ -90,7 +111,7 @@
|
||||
this.field_71070_bA = this.field_71069_bz;
|
||||
}
|
||||
|
||||
@@ -989,6 +995,20 @@
|
||||
@@ -989,6 +999,20 @@
|
||||
this.field_193110_cw = p_193104_1_.field_193110_cw;
|
||||
this.func_192029_h(p_193104_1_.func_192023_dk());
|
||||
this.func_192031_i(p_193104_1_.func_192025_dl());
|
||||
@@ -111,12 +132,13 @@
|
||||
}
|
||||
|
||||
protected void func_70670_a(EffectInstance p_70670_1_) {
|
||||
@@ -1207,15 +1227,16 @@
|
||||
@@ -1207,15 +1231,17 @@
|
||||
this.func_184210_p();
|
||||
if (p_200619_1_ == this.field_70170_p) {
|
||||
this.field_71135_a.func_147364_a(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_);
|
||||
- } else {
|
||||
+ } else if (net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_200619_1_.field_73011_w.func_186058_p())) {
|
||||
+ DimensionType oldDimension = this.field_71093_bK;
|
||||
ServerWorld serverworld = this.func_71121_q();
|
||||
this.field_71093_bK = p_200619_1_.field_73011_w.func_186058_p();
|
||||
WorldInfo worldinfo = p_200619_1_.func_72912_H();
|
||||
@@ -131,15 +153,15 @@
|
||||
this.func_70012_b(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_);
|
||||
this.func_70029_a(p_200619_1_);
|
||||
p_200619_1_.func_217446_a(this);
|
||||
@@ -1224,6 +1245,7 @@
|
||||
@@ -1224,6 +1250,7 @@
|
||||
this.field_71134_c.func_73080_a(p_200619_1_);
|
||||
this.field_71133_b.func_184103_al().func_72354_b(this, p_200619_1_);
|
||||
this.field_71133_b.func_184103_al().func_72385_f(this);
|
||||
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerChangedDimensionEvent(this, p_200619_1_.field_73011_w.func_186058_p(), this.field_71093_bK);
|
||||
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerChangedDimensionEvent(this, oldDimension, this.field_71093_bK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1261,6 +1283,8 @@
|
||||
@@ -1261,6 +1288,8 @@
|
||||
if (itementity == null) {
|
||||
return null;
|
||||
} else {
|
||||
|
||||
+10
-3
@@ -122,12 +122,19 @@
|
||||
int i = p_187250_3_.func_190916_E();
|
||||
int j = p_187250_3_.func_77952_i();
|
||||
ActionResult<ItemStack> actionresult = p_187250_3_.func_77957_a(p_187250_2_, p_187250_1_, p_187250_4_);
|
||||
@@ -296,9 +321,16 @@
|
||||
@@ -287,6 +312,8 @@
|
||||
public ActionResultType func_219441_a(PlayerEntity p_219441_1_, World p_219441_2_, ItemStack p_219441_3_, Hand p_219441_4_, BlockRayTraceResult p_219441_5_) {
|
||||
BlockPos blockpos = p_219441_5_.func_216350_a();
|
||||
BlockState blockstate = p_219441_2_.func_180495_p(blockpos);
|
||||
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks.onRightClickBlock(p_219441_1_, p_219441_4_, blockpos, p_219441_5_.func_216354_b());
|
||||
+ if (event.isCanceled()) return event.getCancellationResult();
|
||||
if (this.field_73091_c == GameType.SPECTATOR) {
|
||||
INamedContainerProvider inamedcontainerprovider = blockstate.func_215699_b(p_219441_2_, blockpos);
|
||||
if (inamedcontainerprovider != null) {
|
||||
@@ -296,9 +323,14 @@
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
} else {
|
||||
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks.onRightClickBlock(p_219441_1_, p_219441_4_, blockpos, p_219441_5_.func_216354_b());
|
||||
+ if (event.isCanceled()) return event.getCancellationResult();
|
||||
+ ItemUseContext itemusecontext = new ItemUseContext(p_219441_1_, p_219441_4_, p_219441_5_);
|
||||
+ if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) {
|
||||
+ ActionResultType result = p_219441_3_.onItemUseFirst(itemusecontext);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/Teleporter.java
|
||||
+++ b/net/minecraft/world/Teleporter.java
|
||||
@@ -23,7 +23,7 @@
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraft.world.server.TicketType;
|
||||
|
||||
-public class Teleporter {
|
||||
+public class Teleporter implements net.minecraftforge.common.util.ITeleporter {
|
||||
protected final ServerWorld field_85192_a;
|
||||
protected final Random field_77187_a;
|
||||
|
||||
@@ -17,7 +17,24 @@
|
||||
chunkprimer.func_201637_h(blockpos);
|
||||
}
|
||||
}
|
||||
@@ -294,12 +295,22 @@
|
||||
@@ -182,6 +183,7 @@
|
||||
}
|
||||
|
||||
if (chunkstatus$type == ChunkStatus.Type.LEVELCHUNK) {
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Load(ichunk, compoundnbt, chunkstatus$type));
|
||||
return new ChunkPrimerWrapper((Chunk)ichunk);
|
||||
} else {
|
||||
ChunkPrimer chunkprimer1 = (ChunkPrimer)ichunk;
|
||||
@@ -215,6 +217,8 @@
|
||||
chunkprimer1.func_205767_a(generationstage$carving, BitSet.valueOf(compoundnbt5.func_74770_j(s1)));
|
||||
}
|
||||
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Load(ichunk, compoundnbt, chunkstatus$type));
|
||||
+
|
||||
return chunkprimer1;
|
||||
}
|
||||
}
|
||||
@@ -294,12 +298,22 @@
|
||||
for(int k = 0; k < chunk.func_177429_s().length; ++k) {
|
||||
for(Entity entity : chunk.func_177429_s()[k]) {
|
||||
CompoundNBT compoundnbt3 = new CompoundNBT();
|
||||
|
||||
@@ -52,6 +52,7 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.model.pipeline.LightUtil;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -126,8 +127,6 @@ import net.minecraftforge.client.event.InputUpdateEvent;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.event.RecipesUpdatedEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.event.RenderSpecificHandEvent;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.client.event.ScreenshotEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
@@ -160,17 +159,17 @@ public class ForgeHooksClient
|
||||
return result != null ? result : _default;
|
||||
}
|
||||
|
||||
public static boolean onDrawBlockHighlight(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks)
|
||||
public static boolean onDrawBlockHighlight(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, float partialTicks, MatrixStack matrix, IRenderTypeBuffer buffers)
|
||||
{
|
||||
switch (target.getType()) {
|
||||
case BLOCK:
|
||||
if (!(target instanceof BlockRayTraceResult)) return false;
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawHighlightEvent.HighlightBlock(context, info, target, subID, partialTicks));
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawHighlightEvent.HighlightBlock(context, info, target, partialTicks, matrix, buffers));
|
||||
case ENTITY:
|
||||
if (!(target instanceof EntityRayTraceResult)) return false;
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawHighlightEvent.HighlightEntity(context, info, target, subID, partialTicks));
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawHighlightEvent.HighlightEntity(context, info, target, partialTicks, matrix, buffers));
|
||||
}
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawHighlightEvent(context, info, target, subID, partialTicks));
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawHighlightEvent(context, info, target, partialTicks, matrix, buffers));
|
||||
}
|
||||
|
||||
public static void dispatchRenderLast(WorldRenderer context, MatrixStack mat, float partialTicks)
|
||||
@@ -178,14 +177,9 @@ public class ForgeHooksClient
|
||||
MinecraftForge.EVENT_BUS.post(new RenderWorldLastEvent(context, mat, partialTicks));
|
||||
}
|
||||
|
||||
public static boolean renderFirstPersonHand(WorldRenderer context, MatrixStack mat, float partialTicks)
|
||||
public static boolean renderSpecificFirstPersonHand(Hand hand, MatrixStack mat, IRenderTypeBuffer buffers, int light, float partialTicks, float interpPitch, float swingProgress, float equipProgress, ItemStack stack)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new RenderHandEvent(context, mat, partialTicks));
|
||||
}
|
||||
|
||||
public static boolean renderSpecificFirstPersonHand(Hand hand, MatrixStack mat, float partialTicks, float interpPitch, float swingProgress, float equipProgress, ItemStack stack)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new RenderSpecificHandEvent(hand, mat, partialTicks, interpPitch, swingProgress, equipProgress, stack));
|
||||
return MinecraftForge.EVENT_BUS.post(new RenderHandEvent(hand, mat, buffers, light, partialTicks, interpPitch, swingProgress, equipProgress, stack));
|
||||
}
|
||||
|
||||
public static void onTextureStitchedPre(AtlasTexture map, Set<ResourceLocation> resourceLocations)
|
||||
@@ -531,9 +525,11 @@ public class ForgeHooksClient
|
||||
@SuppressWarnings("deprecation")
|
||||
public static TextureAtlasSprite[] getFluidSprites(ILightReader world, BlockPos pos, IFluidState fluidStateIn)
|
||||
{
|
||||
ResourceLocation overlayTexture = fluidStateIn.getFluid().getAttributes().getOverlayTexture();
|
||||
return new TextureAtlasSprite[] {
|
||||
Minecraft.getInstance().func_228015_a_(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(fluidStateIn.getFluid().getAttributes().getStillTexture(world, pos)),
|
||||
Minecraft.getInstance().func_228015_a_(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(fluidStateIn.getFluid().getAttributes().getFlowingTexture(world, pos)),
|
||||
overlayTexture == null ? null : Minecraft.getInstance().func_228015_a_(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(overlayTexture),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.EntityRayTraceResult;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
@@ -37,23 +39,26 @@ public class DrawHighlightEvent extends Event
|
||||
private final WorldRenderer context;
|
||||
private final ActiveRenderInfo info;
|
||||
private final RayTraceResult target;
|
||||
private final int subID;
|
||||
private final float partialTicks;
|
||||
private final MatrixStack matrix;
|
||||
private final IRenderTypeBuffer buffers;
|
||||
|
||||
public DrawHighlightEvent(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks)
|
||||
public DrawHighlightEvent(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, float partialTicks, MatrixStack matrix, IRenderTypeBuffer buffers)
|
||||
{
|
||||
this.context = context;
|
||||
this.info = info;
|
||||
this.target = target;
|
||||
this.subID = subID;
|
||||
this.partialTicks= partialTicks;
|
||||
this.matrix = matrix;
|
||||
this.buffers = buffers;
|
||||
}
|
||||
|
||||
public WorldRenderer getContext() { return context; }
|
||||
public ActiveRenderInfo getInfo() { return info; }
|
||||
public RayTraceResult getTarget() { return target; }
|
||||
public int getSubID() { return subID; }
|
||||
public float getPartialTicks() { return partialTicks; }
|
||||
public MatrixStack getMatrix() { return matrix; }
|
||||
public IRenderTypeBuffer getBuffers() { return buffers; }
|
||||
|
||||
/**
|
||||
* A variant of the DrawBlockHighlightEvent only called when a block is highlighted.
|
||||
@@ -61,9 +66,9 @@ public class DrawHighlightEvent extends Event
|
||||
@Cancelable
|
||||
public static class HighlightBlock extends DrawHighlightEvent
|
||||
{
|
||||
public HighlightBlock(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks)
|
||||
public HighlightBlock(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, float partialTicks, MatrixStack matrix, IRenderTypeBuffer buffers)
|
||||
{
|
||||
super(context, info, target, subID, partialTicks);
|
||||
super(context, info, target, partialTicks, matrix, buffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,9 +85,9 @@ public class DrawHighlightEvent extends Event
|
||||
@Cancelable
|
||||
public static class HighlightEntity extends DrawHighlightEvent
|
||||
{
|
||||
public HighlightEntity(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks)
|
||||
public HighlightEntity(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, float partialTicks, MatrixStack matrix, IRenderTypeBuffer buffers)
|
||||
{
|
||||
super(context, info, target, subID, partialTicks);
|
||||
super(context, info, target, partialTicks, matrix, buffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,33 +19,53 @@
|
||||
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
/**
|
||||
* This event is fired on {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}
|
||||
* before both hands are rendered.
|
||||
* Canceling this event prevents either hand from being rendered,
|
||||
* and prevents {@link RenderSpecificHandEvent} from firing.
|
||||
* TODO This may get merged in 11 with RenderSpecificHandEvent to make a generic hand rendering
|
||||
* This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}
|
||||
* whenever a hand is rendered in first person.
|
||||
* Canceling the event causes the hand to not render.
|
||||
*/
|
||||
@net.minecraftforge.eventbus.api.Cancelable
|
||||
public class RenderHandEvent extends net.minecraftforge.eventbus.api.Event
|
||||
@Cancelable
|
||||
public class RenderHandEvent extends Event
|
||||
{
|
||||
private final WorldRenderer context;
|
||||
private final Hand hand;
|
||||
private final MatrixStack mat;
|
||||
private final IRenderTypeBuffer buffers;
|
||||
private final int light;
|
||||
private final float partialTicks;
|
||||
public RenderHandEvent(WorldRenderer context, MatrixStack mat, float partialTicks)
|
||||
private final float interpolatedPitch;
|
||||
private final float swingProgress;
|
||||
private final float equipProgress;
|
||||
@Nonnull
|
||||
private final ItemStack stack;
|
||||
|
||||
public RenderHandEvent(Hand hand, MatrixStack mat, IRenderTypeBuffer buffers, int light,
|
||||
float partialTicks, float interpolatedPitch,
|
||||
float swingProgress, float equipProgress, @Nonnull ItemStack stack)
|
||||
{
|
||||
this.context = context;
|
||||
this.hand = hand;
|
||||
this.mat = mat;
|
||||
this.buffers = buffers;
|
||||
this.light = light;
|
||||
this.partialTicks = partialTicks;
|
||||
this.interpolatedPitch = interpolatedPitch;
|
||||
this.swingProgress = swingProgress;
|
||||
this.equipProgress = equipProgress;
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
public WorldRenderer getContext()
|
||||
public Hand getHand()
|
||||
{
|
||||
return context;
|
||||
return hand;
|
||||
}
|
||||
|
||||
public MatrixStack getMatrixStack()
|
||||
@@ -53,8 +73,49 @@ public class RenderHandEvent extends net.minecraftforge.eventbus.api.Event
|
||||
return mat;
|
||||
}
|
||||
|
||||
public IRenderTypeBuffer getBuffers() {
|
||||
return buffers;
|
||||
}
|
||||
|
||||
public int getLight() {
|
||||
return light;
|
||||
}
|
||||
|
||||
public float getPartialTicks()
|
||||
{
|
||||
return partialTicks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The interpolated pitch of the player entity
|
||||
*/
|
||||
public float getInterpolatedPitch()
|
||||
{
|
||||
return interpolatedPitch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The swing progress of the hand being rendered
|
||||
*/
|
||||
public float getSwingProgress()
|
||||
{
|
||||
return swingProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The progress of the equip animation. 1.0 is fully equipped.
|
||||
*/
|
||||
public float getEquipProgress()
|
||||
{
|
||||
return equipProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The ItemStack to be rendered
|
||||
*/
|
||||
@Nonnull
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.entity.ItemFrameRenderer;
|
||||
import net.minecraft.entity.item.ItemFrameEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -38,12 +40,19 @@ public class RenderItemInFrameEvent extends net.minecraftforge.eventbus.api.Even
|
||||
private final ItemStack item;
|
||||
private final ItemFrameEntity entityItemFrame;
|
||||
private final ItemFrameRenderer renderer;
|
||||
private final MatrixStack matrix;
|
||||
private final IRenderTypeBuffer buffers;
|
||||
private final int light;
|
||||
|
||||
public RenderItemInFrameEvent(ItemFrameEntity itemFrame, ItemFrameRenderer renderItemFrame)
|
||||
public RenderItemInFrameEvent(ItemFrameEntity itemFrame, ItemFrameRenderer renderItemFrame, MatrixStack matrix,
|
||||
IRenderTypeBuffer buffers, int light)
|
||||
{
|
||||
item = itemFrame.getDisplayedItem();
|
||||
entityItemFrame = itemFrame;
|
||||
renderer = renderItemFrame;
|
||||
this.matrix = matrix;
|
||||
this.buffers = buffers;
|
||||
this.light = light;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -61,4 +70,16 @@ public class RenderItemInFrameEvent extends net.minecraftforge.eventbus.api.Even
|
||||
{
|
||||
return renderer;
|
||||
}
|
||||
|
||||
public MatrixStack getMatrix() {
|
||||
return matrix;
|
||||
}
|
||||
|
||||
public IRenderTypeBuffer getBuffers() {
|
||||
return buffers;
|
||||
}
|
||||
|
||||
public int getLight() {
|
||||
return light;
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraft.client.renderer.entity.LivingRenderer;
|
||||
@@ -33,29 +34,39 @@ public abstract class RenderLivingEvent<T extends LivingEntity, M extends Entity
|
||||
private final LivingRenderer<T, M> renderer;
|
||||
private final float partialRenderTick;
|
||||
private final MatrixStack matrixStack;
|
||||
private final IRenderTypeBuffer buffers;
|
||||
private final int light;
|
||||
|
||||
public RenderLivingEvent(LivingEntity entity, LivingRenderer<T, M> renderer, float partialRenderTick, MatrixStack matrixStack)
|
||||
public RenderLivingEvent(LivingEntity entity, LivingRenderer<T, M> renderer, float partialRenderTick, MatrixStack matrixStack,
|
||||
IRenderTypeBuffer buffers, int light)
|
||||
{
|
||||
this.entity = entity;
|
||||
this.renderer = renderer;
|
||||
this.partialRenderTick = partialRenderTick;
|
||||
this.matrixStack = matrixStack;
|
||||
this.buffers = buffers;
|
||||
this.light = light;
|
||||
}
|
||||
|
||||
public LivingEntity getEntity() { return entity; }
|
||||
public LivingRenderer<T, M> getRenderer() { return renderer; }
|
||||
public float getPartialRenderTick() { return partialRenderTick; }
|
||||
public MatrixStack getMatrixStack() { return matrixStack; }
|
||||
public IRenderTypeBuffer getBuffers() { return buffers; }
|
||||
public int getLight() { return light; }
|
||||
|
||||
@Cancelable
|
||||
public static class Pre<T extends LivingEntity, M extends EntityModel<T>> extends RenderLivingEvent<T, M>
|
||||
{
|
||||
public Pre(LivingEntity entity, LivingRenderer<T, M> renderer, float partialRenderTick, MatrixStack matrixStack){ super(entity, renderer, partialRenderTick, matrixStack); }
|
||||
public Pre(LivingEntity entity, LivingRenderer<T, M> renderer, float partialRenderTick, MatrixStack matrixStack, IRenderTypeBuffer buffers, int light) {
|
||||
super(entity, renderer, partialRenderTick, matrixStack, buffers, light);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Post<T extends LivingEntity, M extends EntityModel<T>> extends RenderLivingEvent<T, M>
|
||||
{
|
||||
public Post(LivingEntity entity, LivingRenderer<T, M> renderer, float partialRenderTick, MatrixStack matrixStack){ super(entity, renderer, partialRenderTick, matrixStack); }
|
||||
public Post(LivingEntity entity, LivingRenderer<T, M> renderer, float partialRenderTick, MatrixStack matrixStack, IRenderTypeBuffer buffers, int light) {
|
||||
super(entity, renderer, partialRenderTick, matrixStack, buffers, light);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraft.client.renderer.entity.PlayerRenderer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@@ -33,28 +34,38 @@ public abstract class RenderPlayerEvent extends PlayerEvent
|
||||
private final PlayerRenderer renderer;
|
||||
private final float partialRenderTick;
|
||||
private final MatrixStack stack;
|
||||
private final IRenderTypeBuffer buffers;
|
||||
private final int light;
|
||||
|
||||
public RenderPlayerEvent(PlayerEntity player, PlayerRenderer renderer, float partialRenderTick, MatrixStack stack)
|
||||
public RenderPlayerEvent(PlayerEntity player, PlayerRenderer renderer, float partialRenderTick, MatrixStack stack, IRenderTypeBuffer buffers, int light)
|
||||
{
|
||||
super(player);
|
||||
this.renderer = renderer;
|
||||
this.partialRenderTick = partialRenderTick;
|
||||
this.stack = stack;
|
||||
this.buffers = buffers;
|
||||
this.light = light;
|
||||
}
|
||||
|
||||
public PlayerRenderer getRenderer() { return renderer; }
|
||||
public float getPartialRenderTick() { return partialRenderTick; }
|
||||
public MatrixStack getMatrixStack() { return stack; }
|
||||
public IRenderTypeBuffer getBuffers() { return buffers; }
|
||||
public int getLight() { return light; }
|
||||
|
||||
@net.minecraftforge.eventbus.api.Cancelable
|
||||
public static class Pre extends RenderPlayerEvent
|
||||
{
|
||||
public Pre(PlayerEntity player, PlayerRenderer renderer, float tick, MatrixStack stack){ super(player, renderer, tick, stack); }
|
||||
public Pre(PlayerEntity player, PlayerRenderer renderer, float tick, MatrixStack stack, IRenderTypeBuffer buffers, int light) {
|
||||
super(player, renderer, tick, stack, buffers, light);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Post extends RenderPlayerEvent
|
||||
{
|
||||
public Post(PlayerEntity player, PlayerRenderer renderer, float tick, MatrixStack stack){ super(player, renderer, tick, stack); }
|
||||
public Post(PlayerEntity player, PlayerRenderer renderer, float tick, MatrixStack stack, IRenderTypeBuffer buffers, int light) {
|
||||
super(player, renderer, tick, stack, buffers, light);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
/**
|
||||
* This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}
|
||||
* whenever a hand is rendered in first person.
|
||||
* Canceling the event causes the hand to not render.
|
||||
* TODO This may get merged in 11 with RenderHandEvent to make a generic hand rendering
|
||||
*/
|
||||
@Cancelable
|
||||
public class RenderSpecificHandEvent extends Event
|
||||
{
|
||||
private final Hand hand;
|
||||
private final MatrixStack mat;
|
||||
private final float partialTicks;
|
||||
private final float interpolatedPitch;
|
||||
private final float swingProgress;
|
||||
private final float equipProgress;
|
||||
@Nonnull
|
||||
private final ItemStack stack;
|
||||
|
||||
public RenderSpecificHandEvent(Hand hand, MatrixStack mat, float partialTicks, float interpolatedPitch, float swingProgress, float equipProgress, @Nonnull ItemStack stack)
|
||||
{
|
||||
this.hand = hand;
|
||||
this.mat = mat;
|
||||
this.partialTicks = partialTicks;
|
||||
this.interpolatedPitch = interpolatedPitch;
|
||||
this.swingProgress = swingProgress;
|
||||
this.equipProgress = equipProgress;
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
public Hand getHand()
|
||||
{
|
||||
return hand;
|
||||
}
|
||||
|
||||
public MatrixStack getMatrixStack()
|
||||
{
|
||||
return mat;
|
||||
}
|
||||
|
||||
public float getPartialTicks()
|
||||
{
|
||||
return partialTicks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The interpolated pitch of the player entity
|
||||
*/
|
||||
public float getInterpolatedPitch()
|
||||
{
|
||||
return interpolatedPitch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The swing progress of the hand being rendered
|
||||
*/
|
||||
public float getSwingProgress()
|
||||
{
|
||||
return swingProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The progress of the equip animation. 1.0 is fully equipped.
|
||||
*/
|
||||
public float getEquipProgress()
|
||||
{
|
||||
return equipProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The ItemStack to be rendered, or null.
|
||||
*/
|
||||
@Nonnull
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public interface IForgeKeybinding
|
||||
*/
|
||||
default boolean isActiveAndMatches(InputMappings.Input keyCode)
|
||||
{
|
||||
return keyCode.getKeyCode() != 0 && keyCode.equals(getKey()) && getKeyConflictContext().isActive() && getKeyModifier().isActive(getKeyConflictContext());
|
||||
return keyCode != InputMappings.INPUT_INVALID && keyCode.equals(getKey()) && getKeyConflictContext().isActive() && getKeyModifier().isActive(getKeyConflictContext());
|
||||
}
|
||||
|
||||
default void setToDefault()
|
||||
|
||||
@@ -43,13 +43,15 @@ public class BakedItemModel implements IBakedModel
|
||||
protected final ImmutableMap<TransformType, TransformationMatrix> transforms;
|
||||
protected final ItemOverrideList overrides;
|
||||
protected final IBakedModel guiModel;
|
||||
protected final boolean isSideLit;
|
||||
|
||||
public BakedItemModel(ImmutableList<BakedQuad> quads, TextureAtlasSprite particle, ImmutableMap<TransformType, TransformationMatrix> transforms, ItemOverrideList overrides, boolean untransformed)
|
||||
public BakedItemModel(ImmutableList<BakedQuad> quads, TextureAtlasSprite particle, ImmutableMap<TransformType, TransformationMatrix> transforms, ItemOverrideList overrides, boolean untransformed, boolean isSideLit)
|
||||
{
|
||||
this.quads = quads;
|
||||
this.particle = particle;
|
||||
this.transforms = transforms;
|
||||
this.overrides = overrides;
|
||||
this.isSideLit = isSideLit;
|
||||
this.guiModel = untransformed && hasGuiIdentity(transforms) ? new BakedGuiItemModel<>(this) : null;
|
||||
}
|
||||
|
||||
@@ -61,7 +63,7 @@ public class BakedItemModel implements IBakedModel
|
||||
|
||||
@Override public boolean isAmbientOcclusion() { return true; }
|
||||
@Override public boolean isGui3d() { return false; }
|
||||
@Override public boolean func_230044_c_() { return false; }
|
||||
@Override public boolean func_230044_c_() { return isSideLit; }
|
||||
@Override public boolean isBuiltInRenderer() { return false; }
|
||||
@Override public TextureAtlasSprite getParticleTexture() { return particle; }
|
||||
@Override public ItemOverrideList getOverrides() { return overrides; }
|
||||
|
||||
@@ -106,7 +106,13 @@ public class BlockModelConfiguration implements IModelConfiguration
|
||||
|
||||
@Override
|
||||
public boolean isShadedInGui() {
|
||||
return owner.func_230176_c_() == BlockModel.GuiLight.SIDE;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideLit()
|
||||
{
|
||||
return owner.func_230176_c_().func_230178_a_();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.client.model;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* For use when loading a custom model for use in entity/tileentity renderers, or other situations in which the main atlas is not wanted.
|
||||
*/
|
||||
/*
|
||||
public class DummyAtlasSprite extends TextureAtlasSprite
|
||||
{
|
||||
public static final TextureAtlasSprite INSTANCE = new DummyAtlasSprite();
|
||||
public static final Function<ResourceLocation, TextureAtlasSprite> GETTER = t -> INSTANCE;
|
||||
|
||||
private DummyAtlasSprite()
|
||||
{
|
||||
super(new ResourceLocation("forge", "dummy"), 1, 1);
|
||||
// Set the min/max coords to 0..1 range, to use the full texture.
|
||||
func_217789_a(0, 0, 1, 1);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -32,7 +32,6 @@ import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.texture.MissingTextureSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
@@ -185,7 +184,7 @@ public final class DynamicBucketModel implements IModelGeometry<DynamicBucketMod
|
||||
}
|
||||
}
|
||||
|
||||
return new BakedModel(bakery, owner, this, builder.build(), particleSprite, Maps.immutableEnumMap(transformMap), Maps.newHashMap(), transform.isIdentity(), modelTransform);
|
||||
return new BakedModel(bakery, owner, this, builder.build(), particleSprite, Maps.immutableEnumMap(transformMap), Maps.newHashMap(), transform.isIdentity(), modelTransform, owner.isSideLit());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -297,6 +296,7 @@ public final class DynamicBucketModel implements IModelGeometry<DynamicBucketMod
|
||||
private final DynamicBucketModel parent;
|
||||
private final Map<String, IBakedModel> cache; // contains all the baked models since they'll never change
|
||||
private final IModelTransform originalTransform;
|
||||
private final boolean isSideLit;
|
||||
|
||||
BakedModel(ModelBakery bakery,
|
||||
IModelConfiguration owner, DynamicBucketModel parent,
|
||||
@@ -305,13 +305,14 @@ public final class DynamicBucketModel implements IModelGeometry<DynamicBucketMod
|
||||
ImmutableMap<TransformType, TransformationMatrix> transforms,
|
||||
Map<String, IBakedModel> cache,
|
||||
boolean untransformed,
|
||||
IModelTransform originalTransform)
|
||||
IModelTransform originalTransform, boolean isSideLit)
|
||||
{
|
||||
super(quads, particle, transforms, new ContainedFluidOverrideHandler(bakery), untransformed);
|
||||
super(quads, particle, transforms, new ContainedFluidOverrideHandler(bakery), untransformed, isSideLit);
|
||||
this.owner = owner;
|
||||
this.parent = parent;
|
||||
this.cache = cache;
|
||||
this.originalTransform = originalTransform;
|
||||
this.isSideLit = isSideLit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ final class FancyMissingModel implements IUnbakedModel
|
||||
public boolean isGui3d() { return false; }
|
||||
|
||||
@Override
|
||||
public boolean func_230044_c_() { return false; } // TODO: Forge: Auto-generated method stub
|
||||
public boolean func_230044_c_() { return false; }
|
||||
|
||||
@Override
|
||||
public boolean isBuiltInRenderer() { return false; }
|
||||
|
||||
@@ -442,7 +442,6 @@ public final class FluidModel implements IModelGeometry<FluidModel>
|
||||
@Override
|
||||
public boolean func_230044_c_()
|
||||
{
|
||||
// TODO: Forge: Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,11 @@ public interface IModelConfiguration {
|
||||
*/
|
||||
boolean isShadedInGui();
|
||||
|
||||
/**
|
||||
* @return True if the item is lit from the side
|
||||
*/
|
||||
boolean isSideLit();
|
||||
|
||||
/**
|
||||
* @return True if the item requires per-vertex lighting.
|
||||
*/
|
||||
|
||||
@@ -26,7 +26,6 @@ import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -91,7 +90,7 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
|
||||
owner.isTexturePresent("particle") ? owner.resolveTexture("particle") : textures.get(0)
|
||||
);
|
||||
ImmutableMap<TransformType, TransformationMatrix> map = PerspectiveMapWrapper.getTransforms(modelTransform);
|
||||
return new BakedItemModel(quads, particle, map, overrides, transform.isIdentity());
|
||||
return new BakedItemModel(quads, particle, map, overrides, transform.isIdentity(), owner.isSideLit());
|
||||
}
|
||||
|
||||
public static ImmutableList<BakedQuad> getQuadsForSprites(List<Material> textures, TransformationMatrix transform, Function<Material, TextureAtlasSprite> spriteGetter)
|
||||
|
||||
@@ -47,35 +47,50 @@ import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Central hub for custom model loaders.
|
||||
*/
|
||||
public class ModelLoaderRegistry
|
||||
{
|
||||
public static final String WHITE_TEXTURE = "forge:white";
|
||||
|
||||
private static final Map<ResourceLocation, IModelLoader<?>> loaders = Maps.newHashMap();
|
||||
private static volatile boolean registryFrozen = false;
|
||||
|
||||
// Forge built-in loaders
|
||||
public static void init()
|
||||
{
|
||||
registerLoader(new ResourceLocation("forge:obj"), OBJLoader.INSTANCE);
|
||||
registerLoader(new ResourceLocation("forge:bucket"), DynamicBucketModel.Loader.INSTANCE);
|
||||
registerLoader(new ResourceLocation("forge:composite"), CompositeModel.Loader.INSTANCE);
|
||||
registerLoader(new ResourceLocation("minecraft:elements"), VanillaProxy.Loader.INSTANCE);
|
||||
registerLoader(new ResourceLocation("forge:multi-layer"), MultiLayerModel.Loader.INSTANCE);
|
||||
registerLoader(new ResourceLocation("minecraft","elements"), VanillaProxy.Loader.INSTANCE);
|
||||
registerLoader(new ResourceLocation("forge","obj"), OBJLoader.INSTANCE);
|
||||
registerLoader(new ResourceLocation("forge","bucket"), DynamicBucketModel.Loader.INSTANCE);
|
||||
registerLoader(new ResourceLocation("forge","composite"), CompositeModel.Loader.INSTANCE);
|
||||
registerLoader(new ResourceLocation("forge","multi-layer"), MultiLayerModel.Loader.INSTANCE);
|
||||
|
||||
// TODO: Implement as new model loaders
|
||||
//registerLoader(new ResourceLocation("forge:b3d"), new ModelLoaderAdapter(B3DLoader.INSTANCE));
|
||||
//registerLoader(new ResourceLocation("forge:fluid"), new ModelLoaderAdapter(ModelFluid.FluidLoader.INSTANCE));
|
||||
}
|
||||
|
||||
public static void initComplete()
|
||||
{
|
||||
registryFrozen = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes system aware of your loader.
|
||||
*/
|
||||
public static void registerLoader(ResourceLocation id, IModelLoader<?> loader)
|
||||
{
|
||||
loaders.put(id, loader);
|
||||
((IReloadableResourceManager) Minecraft.getInstance().getResourceManager()).addReloadListener(loader);
|
||||
if (registryFrozen)
|
||||
throw new IllegalStateException("Can not register model loaders after models have started loading. Please use FMLClientSetupEvent or ModelRegistryEvent to register your loaders.");
|
||||
|
||||
synchronized(loaders)
|
||||
{
|
||||
loaders.put(id, loader);
|
||||
((IReloadableResourceManager) Minecraft.getInstance().getResourceManager()).addReloadListener(loader);
|
||||
}
|
||||
}
|
||||
|
||||
public static IModelGeometry<?> getModel(ResourceLocation loaderId, JsonDeserializationContext deserializationContext, JsonObject data)
|
||||
@@ -83,7 +98,10 @@ public class ModelLoaderRegistry
|
||||
try
|
||||
{
|
||||
if (!loaders.containsKey(loaderId))
|
||||
throw new IllegalStateException(String.format("Model loader '%s' not found.", loaderId));
|
||||
{
|
||||
throw new IllegalStateException(String.format("Model loader '%s' not found. Registered loaders: %s", loaderId,
|
||||
loaders.keySet().stream().map(ResourceLocation::toString).collect(Collectors.joining(", "))));
|
||||
}
|
||||
|
||||
IModelLoader<?> loader = loaders.get(loaderId);
|
||||
|
||||
@@ -106,12 +124,26 @@ public class ModelLoaderRegistry
|
||||
return getModel(loader, deserializationContext, object);
|
||||
}
|
||||
|
||||
private static final Pattern FILESYSTEM_PATH_TO_RESLOC = Pattern.compile("(?:.*[\\\\/]assets[\\\\/](?<namespace>[a-z_-]+)[\\\\/]textures[\\\\/])?(?<path>[a-z_\\\\/-]+)\\.png");
|
||||
/* Explanation:
|
||||
* This takes anything that looks like a valid resourcepack texture location, and tries to extract a resourcelocation out of it.
|
||||
* 1. it will ignore anything up to and including an /assets/ folder,
|
||||
* 2. it will take the next path component as a namespace,
|
||||
* 3. it will match but skip the /textures/ part of the path,
|
||||
* 4. it will take the rest of the path up to but excluding the .png extension as the resource path
|
||||
* It's a best-effort situation, to allow model files exported by modelling software to be used without post-processing.
|
||||
* Example:
|
||||
* C:\Something\Or Other\src\main\resources\assets\mymodid\textures\item\my_thing.png
|
||||
* ........................................--------_______----------_____________----
|
||||
* <namespace> <path>
|
||||
* Result after replacing '\' to '/': mymodid:item/my_thing
|
||||
*/
|
||||
private static final Pattern FILESYSTEM_PATH_TO_RESLOC =
|
||||
Pattern.compile("(?:.*[\\\\/]assets[\\\\/](?<namespace>[a-z_-]+)[\\\\/]textures[\\\\/])?(?<path>[a-z_\\\\/-]+)\\.png");
|
||||
|
||||
public static Material resolveTexture(@Nullable String tex, IModelConfiguration owner)
|
||||
{
|
||||
if (tex == null)
|
||||
return blockMaterial("forge:white");
|
||||
return blockMaterial(WHITE_TEXTURE);
|
||||
if (tex.startsWith("#"))
|
||||
return owner.resolveTexture(tex);
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ public final class MultiLayerModel implements IModelGeometry<MultiLayerModel>
|
||||
|
||||
return new MultiLayerBakedModel(
|
||||
owner.useSmoothLighting(), owner.isShadedInGui(),
|
||||
spriteGetter.apply(owner.resolveTexture("particle")), overrides,
|
||||
owner.isSideLit(), spriteGetter.apply(owner.resolveTexture("particle")), overrides,
|
||||
buildModels(models, modelTransform, bakery, spriteGetter, modelLocation),
|
||||
missing.func_225613_a_(bakery, spriteGetter, modelTransform, modelLocation),
|
||||
PerspectiveMapWrapper.getTransforms(new ModelTransformComposition(owner.getCombinedTransform(), modelTransform)));
|
||||
@@ -105,14 +105,16 @@ public final class MultiLayerModel implements IModelGeometry<MultiLayerModel>
|
||||
private final ImmutableMap<TransformType, TransformationMatrix> cameraTransforms;
|
||||
protected final boolean ambientOcclusion;
|
||||
protected final boolean gui3d;
|
||||
protected final boolean isSideLit;
|
||||
protected final TextureAtlasSprite particle;
|
||||
protected final ItemOverrideList overrides;
|
||||
private final IBakedModel missing;
|
||||
|
||||
public MultiLayerBakedModel(
|
||||
boolean ambientOcclusion, boolean isGui3d, TextureAtlasSprite particle, ItemOverrideList overrides,
|
||||
boolean ambientOcclusion, boolean isGui3d, boolean isSideLit, TextureAtlasSprite particle, ItemOverrideList overrides,
|
||||
ImmutableMap<RenderType, IBakedModel> models, IBakedModel missing, ImmutableMap<TransformType, TransformationMatrix> cameraTransforms)
|
||||
{
|
||||
this.isSideLit = isSideLit;
|
||||
this.models = models;
|
||||
this.cameraTransforms = cameraTransforms;
|
||||
this.missing = missing;
|
||||
@@ -167,8 +169,7 @@ public final class MultiLayerModel implements IModelGeometry<MultiLayerModel>
|
||||
@Override
|
||||
public boolean func_230044_c_()
|
||||
{
|
||||
// TODO: Forge: Auto-generated method stub
|
||||
return false;
|
||||
return isSideLit;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,7 +44,6 @@ import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.texture.MissingTextureSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
import net.minecraftforge.client.model.*;
|
||||
import net.minecraftforge.common.model.*;
|
||||
@@ -151,9 +150,9 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
|
||||
if(model == null) throw new ModelLoadingException("Error loading model previously: " + file);
|
||||
if(!(model.getRoot().getKind() instanceof Mesh))
|
||||
{
|
||||
return new ModelWrapper(modelLocation, model, ImmutableSet.of(), true, true, 1);
|
||||
return new ModelWrapper(modelLocation, model, ImmutableSet.of(), true, true, true, 1);
|
||||
}
|
||||
return new ModelWrapper(modelLocation, model, ImmutableSet.of(model.getRoot().getName()), true, true, 1);
|
||||
return new ModelWrapper(modelLocation, model, ImmutableSet.of(model.getRoot().getName()), true, true, true, 1);
|
||||
}
|
||||
|
||||
public static final class B3DState implements IModelTransform
|
||||
@@ -406,18 +405,20 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
|
||||
private final ImmutableMap<String, String> textures;
|
||||
private final boolean smooth;
|
||||
private final boolean gui3d;
|
||||
private final boolean isSideLit;
|
||||
private final int defaultKey;
|
||||
|
||||
public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet<String> meshes, boolean smooth, boolean gui3d, int defaultKey)
|
||||
public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet<String> meshes, boolean smooth, boolean gui3d, boolean isSideLit, int defaultKey)
|
||||
{
|
||||
this(modelLocation, model, meshes, smooth, gui3d, defaultKey, buildTextures(model.getTextures()));
|
||||
this(modelLocation, model, meshes, smooth, gui3d, isSideLit, defaultKey, buildTextures(model.getTextures()));
|
||||
}
|
||||
|
||||
public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet<String> meshes, boolean smooth, boolean gui3d, int defaultKey, ImmutableMap<String, String> textures)
|
||||
public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet<String> meshes, boolean smooth, boolean gui3d, boolean isSideLit, int defaultKey, ImmutableMap<String, String> textures)
|
||||
{
|
||||
this.modelLocation = modelLocation;
|
||||
this.model = model;
|
||||
this.meshes = meshes;
|
||||
this.isSideLit = isSideLit;
|
||||
this.textures = textures;
|
||||
this.smooth = smooth;
|
||||
this.gui3d = gui3d;
|
||||
@@ -477,7 +478,7 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
|
||||
}
|
||||
}
|
||||
builder.put("missingno", missing);
|
||||
return new BakedWrapper(model.getRoot(), modelTransform, smooth, gui3d, meshes, builder.build());
|
||||
return new BakedWrapper(model.getRoot(), modelTransform, smooth, gui3d, isSideLit, meshes, builder.build());
|
||||
}
|
||||
|
||||
public ModelWrapper retexture(ImmutableMap<String, String> textures)
|
||||
@@ -501,7 +502,7 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
|
||||
builder.put(e);
|
||||
}
|
||||
}
|
||||
return new ModelWrapper(modelLocation, model, meshes, smooth, gui3d, defaultKey, builder.build());
|
||||
return new ModelWrapper(modelLocation, model, meshes, smooth, gui3d, isSideLit, defaultKey, builder.build());
|
||||
}
|
||||
|
||||
public ModelWrapper process(ImmutableMap<String, String> data)
|
||||
@@ -514,7 +515,7 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
|
||||
JsonElement e = new JsonParser().parse(data.get("mesh"));
|
||||
if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isString())
|
||||
{
|
||||
return new ModelWrapper(modelLocation, model, ImmutableSet.of(e.getAsString()), smooth, gui3d, defaultKey, textures);
|
||||
return new ModelWrapper(modelLocation, model, ImmutableSet.of(e.getAsString()), smooth, gui3d, isSideLit, defaultKey, textures);
|
||||
}
|
||||
else if (e.isJsonArray())
|
||||
{
|
||||
@@ -554,7 +555,7 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
|
||||
return this;
|
||||
}
|
||||
}
|
||||
return hasChanged ? new ModelWrapper(modelLocation, model, newMeshes, smooth, gui3d, newDefaultKey, textures) : this;
|
||||
return hasChanged ? new ModelWrapper(modelLocation, model, newMeshes, smooth, gui3d, isSideLit, newDefaultKey, textures) : this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -578,7 +579,7 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
|
||||
{
|
||||
return this;
|
||||
}
|
||||
return new ModelWrapper(modelLocation, model, meshes, value, gui3d, defaultKey, textures);
|
||||
return new ModelWrapper(modelLocation, model, meshes, value, gui3d, isSideLit, defaultKey, textures);
|
||||
}
|
||||
|
||||
public ModelWrapper gui3d(boolean value)
|
||||
@@ -587,7 +588,7 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
|
||||
{
|
||||
return this;
|
||||
}
|
||||
return new ModelWrapper(modelLocation, model, meshes, smooth, value, defaultKey, textures);
|
||||
return new ModelWrapper(modelLocation, model, meshes, smooth, value, isSideLit, defaultKey, textures);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -597,15 +598,16 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
|
||||
private final IModelTransform state;
|
||||
private final boolean smooth;
|
||||
private final boolean gui3d;
|
||||
private final boolean isSideLit;
|
||||
private final ImmutableSet<String> meshes;
|
||||
private final ImmutableMap<String, TextureAtlasSprite> textures;
|
||||
private final LoadingCache<Integer, B3DState> cache;
|
||||
|
||||
private ImmutableList<BakedQuad> quads;
|
||||
|
||||
public BakedWrapper(final Node<?> node, final IModelTransform state, final boolean smooth, final boolean gui3d, final ImmutableSet<String> meshes, final ImmutableMap<String, TextureAtlasSprite> textures)
|
||||
public BakedWrapper(final Node<?> node, final IModelTransform state, final boolean smooth, final boolean gui3d, boolean isSideLit, final ImmutableSet<String> meshes, final ImmutableMap<String, TextureAtlasSprite> textures)
|
||||
{
|
||||
this(node, state, smooth, gui3d, meshes, textures, CacheBuilder.newBuilder()
|
||||
this(node, state, smooth, gui3d, isSideLit, meshes, textures, CacheBuilder.newBuilder()
|
||||
.maximumSize(128)
|
||||
.expireAfterAccess(2, TimeUnit.MINUTES)
|
||||
.build(new CacheLoader<Integer, B3DState>()
|
||||
@@ -625,12 +627,13 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
|
||||
}));
|
||||
}
|
||||
|
||||
public BakedWrapper(Node<?> node, IModelTransform state, boolean smooth, boolean gui3d, ImmutableSet<String> meshes, ImmutableMap<String, TextureAtlasSprite> textures, LoadingCache<Integer, B3DState> cache)
|
||||
public BakedWrapper(Node<?> node, IModelTransform state, boolean smooth, boolean gui3d, boolean isSideLit, ImmutableSet<String> meshes, ImmutableMap<String, TextureAtlasSprite> textures, LoadingCache<Integer, B3DState> cache)
|
||||
{
|
||||
this.node = node;
|
||||
this.state = state;
|
||||
this.smooth = smooth;
|
||||
this.gui3d = gui3d;
|
||||
this.isSideLit = isSideLit;
|
||||
this.meshes = meshes;
|
||||
this.textures = textures;
|
||||
this.cache = cache;
|
||||
@@ -797,8 +800,7 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
|
||||
@Override
|
||||
public boolean func_230044_c_()
|
||||
{
|
||||
// TODO: Forge: Auto-generated method stub
|
||||
return false;
|
||||
return isSideLit;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import static net.minecraftforge.fml.Logging.CORE;
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.FORGEMOD;
|
||||
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
@@ -68,7 +67,7 @@ public class ForgeConfig
|
||||
.define("removeErroringTileEntities", false);
|
||||
|
||||
fullBoundingBoxLadders = builder
|
||||
.comment("Set this to true to check the entire entity's collision bounding box for ladders instead of just the block they are in. Causes noticeable differences in mechanics so default is vanilla behavior. Default: false")
|
||||
.comment("Set this to true to check the entire entity's collision bounding box for ladders instead of just the block they are in. Causes noticeable differences in mechanics so default is vanilla behavior. Default: false.")
|
||||
.translation("forge.configgui.fullBoundingBoxLadders")
|
||||
.worldRestart()
|
||||
.define("fullBoundingBoxLadders", false);
|
||||
@@ -101,13 +100,13 @@ public class ForgeConfig
|
||||
.defineInRange("dimensionUnloadQueueDelay", 0, 0, Integer.MAX_VALUE);
|
||||
|
||||
clumpingThreshold = builder
|
||||
.comment("Controls the number threshold at which Packet51 is preferred over Packet52, default and minimum 64, maximum 1024")
|
||||
.comment("Controls the number threshold at which Packet51 is preferred over Packet52, default and minimum 64, maximum 1024.")
|
||||
.translation("forge.configgui.clumpingThreshold")
|
||||
.worldRestart()
|
||||
.defineInRange("clumpingThreshold", 64, 64, 1024);
|
||||
|
||||
treatEmptyTagsAsAir = builder
|
||||
.comment("Vanilla will treat crafting recipess using empty tags as air, and allow you to craft with nothing in that slot. This changes empty tags to use BARRIER as the item. To prevent crafting with air.")
|
||||
.comment("Vanilla will treat crafting recipes using empty tags as air, and allow you to craft with nothing in that slot. This changes empty tags to use BARRIER as the item. To prevent crafting with air.")
|
||||
.translation("forge.configgui.treatEmptyTagsAsAir")
|
||||
.define("treatEmptyTagsAsAir", false);
|
||||
|
||||
@@ -153,14 +152,14 @@ public class ForgeConfig
|
||||
.define("disableStairSlabCulling", false);
|
||||
|
||||
alwaysSetupTerrainOffThread = builder
|
||||
.comment("Enable forge to queue all chunk updates to the Chunk Update thread.",
|
||||
.comment("Enable Forge to queue all chunk updates to the Chunk Update thread.",
|
||||
"May increase FPS significantly, but may also cause weird rendering lag.",
|
||||
"Not recommended for computers without a significant number of cores available.")
|
||||
.translation("forge.configgui.alwaysSetupTerrainOffThread")
|
||||
.define("alwaysSetupTerrainOffThread", false);
|
||||
|
||||
forgeLightPipelineEnabled = builder
|
||||
.comment("Enable the forge block rendering pipeline - fixes the lighting of custom models.")
|
||||
.comment("Enable the Forge block rendering pipeline - fixes the lighting of custom models.")
|
||||
.translation("forge.configgui.forgeLightPipelineEnabled")
|
||||
.define("forgeLightPipelineEnabled", true);
|
||||
|
||||
@@ -170,8 +169,8 @@ public class ForgeConfig
|
||||
.define("selectiveResourceReloadEnabled", true);
|
||||
|
||||
showLoadWarnings = builder
|
||||
.comment("When enabled, forge will show any warnings that occurred during loading")
|
||||
.translation("forge.configgui.showloadwarnings")
|
||||
.comment("When enabled, Forge will show any warnings that occurred during loading.")
|
||||
.translation("forge.configgui.showLoadWarnings")
|
||||
.define("showLoadWarnings", true);
|
||||
|
||||
builder.pop();
|
||||
@@ -202,7 +201,7 @@ public class ForgeConfig
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onFileChange(final ModConfig.Reloading configEvent) {
|
||||
LogManager.getLogger().fatal(CORE, "Forge config just got changed on the file system!");
|
||||
LogManager.getLogger().debug(FORGEMOD, "Forge config just got changed on the file system!");
|
||||
}
|
||||
|
||||
//General
|
||||
|
||||
@@ -22,6 +22,7 @@ package net.minecraftforge.common.extensions;
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.registries.ForgeRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
@@ -126,4 +127,28 @@ public interface IForgePacketBuffer
|
||||
throw new IllegalArgumentException("Attempted to read an registryValue of the wrong type from the Buffer!");
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a FluidStack to the packet buffer, easy enough. If EMPTY, writes a FALSE.
|
||||
* This behavior provides parity with the ItemStack method in PacketBuffer.
|
||||
*
|
||||
* @param stack FluidStack to be written to the packet buffer.
|
||||
*/
|
||||
default void writeFluidStack(FluidStack stack)
|
||||
{
|
||||
if (stack.isEmpty()) {
|
||||
getBuffer().writeBoolean(false);
|
||||
} else {
|
||||
getBuffer().writeBoolean(true);
|
||||
stack.writeToPacket(getBuffer());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a FluidStack from this buffer.
|
||||
*/
|
||||
default FluidStack readFluidStack()
|
||||
{
|
||||
return !getBuffer().readBoolean() ? FluidStack.EMPTY : FluidStack.readFromPacket(getBuffer());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.util;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.world.dimension.Dimension;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
/**
|
||||
* Interface for handling the placement of entities during dimension change.
|
||||
*
|
||||
* An implementation of this interface can be used to place the entity
|
||||
* in a safe location, or generate a return portal, for instance.
|
||||
*
|
||||
* See the {@link net.minecraft.world.Teleporter} class, which has
|
||||
* been patched to implement this interface, for a vanilla example.
|
||||
*/
|
||||
public interface ITeleporter {
|
||||
|
||||
/**
|
||||
* Called to handle placing the entity in the new world.
|
||||
*
|
||||
* The initial position of the entity will be its
|
||||
* position in the origin world, multiplied horizontally
|
||||
* by the computed cross-dimensional movement factor
|
||||
* (see {@link Dimension#getMovementFactor()}).
|
||||
*
|
||||
* Note that the supplied entity has not yet been spawned
|
||||
* in the destination world at the time.
|
||||
*
|
||||
* @param entity the entity to be placed
|
||||
* @param currentWorld the entity's origin
|
||||
* @param destWorld the entity's destination
|
||||
* @param yaw the suggested yaw value to apply
|
||||
* @param repositionEntity a function to reposition the entity, which returns the new entity in the new dimension. This is the vanilla implementation of the dimension travel logic. If the supplied boolean is true, it is attempted to spawn a new portal.
|
||||
* @return the entity in the new World. Vanilla creates for most {@link Entity}s a new instance and copy the data. But <b>you are not allowed</b> to create a new instance for {@link PlayerEntity}s! Move the player and update its state, see {@link ServerPlayerEntity#changeDimension(net.minecraft.world.dimension.DimensionType, ITeleporter)}
|
||||
*/
|
||||
default Entity placeEntity(Entity entity, ServerWorld currentWorld, ServerWorld destWorld, float yaw, Function<Boolean, Entity> repositionEntity) {
|
||||
return repositionEntity.apply(true);
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ package net.minecraftforge.event.world;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
import net.minecraft.world.chunk.IChunk;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
@@ -54,7 +55,7 @@ public class ChunkDataEvent extends ChunkEvent
|
||||
/**
|
||||
* ChunkDataEvent.Load is fired when vanilla Minecraft attempts to load Chunk data.<br>
|
||||
* This event is fired during chunk loading in
|
||||
* {@link net.minecraftforge.common.chunkio.ChunkIOProvider#syncCallback()}.<br>
|
||||
* {@link net.minecraft.world.chunk.storage.ChunkSerializer.read(ServerWorld, TemplateManager, PointOfInterestManager, ChunkPos, CompoundNBT)} which means it is async, so be careful.<br>
|
||||
* <br>
|
||||
* This event is not {@link Cancelable}.<br>
|
||||
* <br>
|
||||
@@ -64,9 +65,17 @@ public class ChunkDataEvent extends ChunkEvent
|
||||
**/
|
||||
public static class Load extends ChunkDataEvent
|
||||
{
|
||||
public Load(IChunk chunk, CompoundNBT data)
|
||||
private ChunkStatus.Type status;
|
||||
|
||||
public Load(IChunk chunk, CompoundNBT data, ChunkStatus.Type status)
|
||||
{
|
||||
super(chunk, data);
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public ChunkStatus.Type getStatus()
|
||||
{
|
||||
return this.status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +125,7 @@ public class ClientModLoader
|
||||
|
||||
private static void postSidedRunnable(Consumer<Supplier<Event>> perModContainerEventProcessor) {
|
||||
RenderingRegistry.loadEntityRenderers(mc.getRenderManager());
|
||||
ModelLoaderRegistry.initComplete();
|
||||
}
|
||||
|
||||
private static void preSidedRunnable(Consumer<Supplier<Event>> perModContainerEventProcessor) {
|
||||
@@ -210,7 +211,7 @@ public class ClientModLoader
|
||||
}
|
||||
}
|
||||
final T packInfo = ResourcePackInfo.createResourcePack("mod_resources", true, () -> new DelegatingResourcePack("mod_resources", "Mod Resources",
|
||||
new PackMetadataSection(new TranslationTextComponent("fml.resources.modresources", hiddenPacks.size()), 4),
|
||||
new PackMetadataSection(new TranslationTextComponent("fml.resources.modresources", hiddenPacks.size()), 5),
|
||||
hiddenPacks), factory, ResourcePackInfo.Priority.BOTTOM);
|
||||
packList.put("mod_resources", packInfo);
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ import net.minecraftforge.fml.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.packs.ModFileResourcePack;
|
||||
import net.minecraftforge.fml.packs.ResourcePackLoader;
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
import net.minecraftforge.registries.GameData;
|
||||
|
||||
public class ServerLifecycleHooks
|
||||
{
|
||||
@@ -108,6 +109,7 @@ public class ServerLifecycleHooks
|
||||
|
||||
public static void handleServerStopped(final MinecraftServer server)
|
||||
{
|
||||
if (!server.isDedicatedServer()) GameData.revertToFrozen();
|
||||
MinecraftForge.EVENT_BUS.post(new FMLServerStoppedEvent(server));
|
||||
currentServer = null;
|
||||
LogicalSidedProvider.setServer(null);
|
||||
|
||||
@@ -28,6 +28,8 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.common.util.ITeleporter;
|
||||
|
||||
import com.mojang.brigadier.builder.ArgumentBuilder;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
@@ -35,6 +37,7 @@ import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
|
||||
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class CommandSetDimension
|
||||
{
|
||||
@@ -54,6 +57,15 @@ public class CommandSetDimension
|
||||
);
|
||||
}
|
||||
|
||||
private static final ITeleporter PORTALLESS = new ITeleporter()
|
||||
{
|
||||
@Override
|
||||
public Entity placeEntity(Entity entity, ServerWorld currentWorld, ServerWorld destWorld, float yaw, Function<Boolean, Entity> repositionEntity)
|
||||
{
|
||||
return repositionEntity.apply(false);
|
||||
}
|
||||
};
|
||||
|
||||
private static int execute(CommandSource sender, Collection<? extends Entity> entities, DimensionType dim, BlockPos pos) throws CommandSyntaxException
|
||||
{
|
||||
entities.removeIf(e -> !canEntityTeleport(e));
|
||||
@@ -64,7 +76,7 @@ public class CommandSetDimension
|
||||
// throw INVALID_DIMENSION.create(dim);
|
||||
|
||||
entities.stream().filter(e -> e.dimension == dim).forEach(e -> sender.sendFeedback(new TranslationTextComponent("commands.forge.setdim.invalid.nochange", e.getDisplayName().getFormattedText(), dim), true));
|
||||
entities.stream().filter(e -> e.dimension != dim).forEach(e -> e.changeDimension(dim));
|
||||
entities.stream().filter(e -> e.dimension != dim).forEach(e -> e.changeDimension(dim, PORTALLESS));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
"fml.modloading.failedtoloadmod":"{0,modinfo,name} ({0,modinfo,id}) has failed to load correctly\n\u00a77{2,exc,msg}",
|
||||
"fml.modloading.uncaughterror":"An uncaught parallel processing error has occurred.\n\u00a77{2,exc,msg}",
|
||||
"fml.modloading.errorduringevent":"{0,modinfo,name} ({0,modinfo,id}) encountered an error during the {1,lower} event phase\n\u00a77{2,exc,msg}",
|
||||
"fml.modloading.failedtoloadforge": "Failed to load forge",
|
||||
"fml.modloading.failedtoloadforge": "Failed to load Forge",
|
||||
"fml.modloading.missingdependency": "Mod \u00a7e{4}\u00a7r requires \u00a76{3}\u00a7r \u00a7o{5,vr}\u00a7r\n\u00a77Currently, \u00a76{3}\u00a7r\u00a77 is \u00a7o{6,i18n,fml.messages.artifactversion.ornotinstalled}",
|
||||
"fml.modloading.cycle": "Detected a mod dependency cycle: {0}",
|
||||
"fml.modloading.failedtoprocesswork":"{0,modinfo,name} ({0,modinfo,id}) encountered an error processing deferred work\n\u00a77{2,exc,msg}",
|
||||
@@ -109,15 +109,11 @@
|
||||
"forge.update.newversion": "New Forge version available: %s",
|
||||
"forge.menu.updatescreen.title": "Mod Update",
|
||||
|
||||
"forge.configgui.clumpingThreshold.tooltip": "Controls the number threshold at which Packet51 is preferred over Packet52.",
|
||||
"forge.configgui.clumpingThreshold": "Packet Clumping Threshold",
|
||||
"forge.configgui.disableVersionCheck.tooltip": "Set to true to disable Forge version check mechanics. Forge queries a small json file on our server for version information. For more details see the ForgeVersion class in our github.",
|
||||
"forge.configgui.disableVersionCheck": "Disable Forge Version Check",
|
||||
"forge.configgui.removeErroringEntities.tooltip": "Set this to true to remove any Entity that throws an error in its update method instead of closing the server and reporting a crash log. BE WARNED THIS COULD SCREW UP EVERYTHING USE SPARINGLY WE ARE NOT RESPONSIBLE FOR DAMAGES.",
|
||||
"forge.configgui.removeErroringEntities": "Remove Erroring Entities",
|
||||
"forge.configgui.removeErroringTileEntities.tooltip": "Set this to true to remove any TileEntity that throws an error in its update method instead of closing the server and reporting a crash log. BE WARNED THIS COULD SCREW UP EVERYTHING USE SPARINGLY WE ARE NOT RESPONSIBLE FOR DAMAGES.",
|
||||
"forge.configgui.removeErroringTileEntities": "Remove Erroring Tile Entities",
|
||||
"forge.configgui.fullBoundingBoxLadders.tooltip": "Set this to true to check the entire entity collision bounding box for ladders instead of just the block they are in. Causes noticeable differences in mechanics so default is vanilla behavior.",
|
||||
"forge.configgui.fullBoundingBoxLadders.tooltip": "Set this to true to check the entire entity's collision bounding box for ladders instead of just the block they are in. Causes noticeable differences in mechanics so default is vanilla behavior. Default: false.",
|
||||
"forge.configgui.fullBoundingBoxLadders": "Full Bounding Box Ladders",
|
||||
"forge.configgui.zombieBaseSummonChance.tooltip": "Base zombie summoning spawn chance. Allows changing the bonus zombie summoning mechanic.",
|
||||
"forge.configgui.zombieBaseSummonChance": "Zombie Summon Chance",
|
||||
@@ -125,22 +121,32 @@
|
||||
"forge.configgui.zombieBabyChance": "Zombie Baby Chance",
|
||||
"forge.configgui.logCascadingWorldGeneration.tooltip": "Log cascading chunk generation issues during terrain population.",
|
||||
"forge.configgui.logCascadingWorldGeneration": "Log Cascading World Gen",
|
||||
"forge.configgui.fixVanillaCascading.tooltip": "Fix various bugs in vanilla world gen that causes extra chunks to load. This WILL change your worldgen from vanilla. Do not report differences if this is enabled.",
|
||||
"forge.configgui.fixVanillaCascading.tooltip": "Fix vanilla issues that cause worldgen cascading. This DOES change vanilla worldgen so DO NOT report bugs related to world differences if this flag is on.",
|
||||
"forge.configgui.fixVanillaCascading": "Fix Vanilla Cascading",
|
||||
"forge.configgui.dimensionUnloadQueueDelay.tooltip": "The time in ticks the server will wait until unloading a dimension. This can be useful when rapidly loading and unloading dimensions, like e.g. throwing items through a nether portal a few time per second.",
|
||||
"forge.configgui.dimensionUnloadQueueDelay.tooltip": "The time in ticks the server will wait when a dimension was queued to unload. This can be useful when rapidly loading and unloading dimensions, like e.g. throwing items through a nether portal a few time per second.",
|
||||
"forge.configgui.dimensionUnloadQueueDelay": "Delay when unloading dimension",
|
||||
"forge.configgui.clumpingThreshold.tooltip": "Controls the number threshold at which Packet51 is preferred over Packet52, default and minimum 64, maximum 1024.",
|
||||
"forge.configgui.clumpingThreshold": "Packet Clumping Threshold",
|
||||
"forge.configgui.treatEmptyTagsAsAir.tooltip": "Vanilla will treat crafting recipes using empty tags as air, and allow you to craft with nothing in that slot. This changes empty tags to use BARRIER as the item. To prevent crafting with air.",
|
||||
"forge.configgui.treatEmptyTagsAsAir": "Treat empty tags as air",
|
||||
|
||||
"forge.configgui.zoomInMissingModelTextInGui.tooltip": "Toggle off to make missing model text in the gui fit inside the slot.",
|
||||
"forge.configgui.zoomInMissingModelTextInGui": "Zoom in Missing model text in the GUI",
|
||||
"forge.configgui.forgeCloudsEnabled.tooltip": "Enable uploading cloud geometry to the GPU for faster rendering.",
|
||||
"forge.configgui.forgeCloudsEnabled": "Use Forge cloud renderer",
|
||||
"forge.configgui.disableStairSlabCulling.tooltip": "Enable this if you see through blocks touching stairs/slabs with your resource pack.",
|
||||
"forge.configgui.disableStairSlabCulling": "Disable Stair/Slab culling.",
|
||||
"forge.configgui.alwaysSetupTerrainOffThread.tooltip": "Enable forge to queue all chunk updates to the Chunk Update thread. May increase FPS significantly, but may also cause weird rendering lag. Not recommended for computers without a significant number of cores available.",
|
||||
"forge.configgui.disableStairSlabCulling.tooltip": "Disable culling of hidden faces next to stairs and slabs. Causes extra rendering, but may fix some resource packs that exploit this vanilla mechanic.",
|
||||
"forge.configgui.disableStairSlabCulling": "Disable Stair/Slab culling",
|
||||
"forge.configgui.alwaysSetupTerrainOffThread.tooltip": "Enable Forge to queue all chunk updates to the Chunk Update thread.\nMay increase FPS significantly, but may also cause weird rendering lag.\nNot recommended for computers without a significant number of cores available.",
|
||||
"forge.configgui.alwaysSetupTerrainOffThread": "Force threaded chunk rendering",
|
||||
"forge.configgui.forgeLightPipelineEnabled.tooltip": "Enable the Forge block rendering pipeline - fixes the lighting of custom models.",
|
||||
"forge.configgui.forgeLightPipelineEnabled": "Forge Light Pipeline Enabled",
|
||||
"forge.configgui.selectiveResourceReloadEnabled.tooltip": "When enabled, makes specific reload tasks such as language changing quicker to run.",
|
||||
"forge.configgui.selectiveResourceReloadEnabled": "Enable Selective Resource Loading",
|
||||
"forge.configgui.treatEmptyTagsAsAir.tooltip": "Vanilla will treat crafting recipess using empty tags as air, and allow you to craft with nothing in that slot. If false, this changes empty tags to use BARRIER as the item. To prevent crafting with air.",
|
||||
"forge.configgui.treatEmptyTagsAsAir": "Treat empty tags as air",
|
||||
"forge.configgui.showLoadWarnings.tooltip": "When enabled, Forge will show any warnings that occurred during loading.",
|
||||
"forge.configgui.showLoadWarnings": "Show Load Warnings",
|
||||
|
||||
"forge.configgui.disableVersionCheck.tooltip": "Set to true to disable Forge version check mechanics. Forge queries a small json file on our server for version information. For more details see the ForgeVersion class in our github.",
|
||||
"forge.configgui.disableVersionCheck": "Disable Forge Version Check",
|
||||
|
||||
"forge.controlsgui.shift": "SHIFT + %s",
|
||||
"forge.controlsgui.control": "CTRL + %s",
|
||||
|
||||
@@ -35,7 +35,14 @@ net/minecraft/client/resources/ClientResourcePackInfo.<init>(Ljava/lang/String;Z
|
||||
net/minecraft/client/gui/ScreenManager.getScreenFactory(Lnet/minecraft/inventory/container/ContainerType;Lnet/minecraft/client/Minecraft;ILnet/minecraft/util/text/ITextComponent;)Ljava/util/Optional;=|p_216909_0_,p_216909_1_,p_216909_2_,p_216909_3_
|
||||
net/minecraft/entity/EntityClassification.create(Ljava/lang/String;Ljava/lang/String;IZZ)Lnet/minecraft/entity/EntityClassification;=|name,p_i50381_3_,p_i50381_4_,p_i50381_5_,p_i50381_6_
|
||||
|
||||
net/minecraft/entity/Entity.changeDimension(Lnet/minecraft/world/dimension/DimensionType;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_212321_1_,teleporter
|
||||
net/minecraft/entity/item/EnderPearlEntity.changeDimension(Lnet/minecraft/world/dimension/DimensionType;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_212321_1_,teleporter
|
||||
net/minecraft/entity/item/ItemEntity.changeDimension(Lnet/minecraft/world/dimension/DimensionType;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_212321_1_,teleporter
|
||||
net/minecraft/entity/item/minecart/ContainerMinecartEntity.changeDimension(Lnet/minecraft/world/dimension/DimensionType;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_212321_1_,teleporter
|
||||
net/minecraft/entity/merchant/villager/AbstractVillagerEntity.changeDimension(Lnet/minecraft/world/dimension/DimensionType;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_212321_1_,teleporter
|
||||
|
||||
net/minecraft/entity/player/PlayerEntity.getDigSpeed(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;)F=|p_184813_1_,pos
|
||||
net/minecraft/entity/player/ServerPlayerEntity.changeDimension(Lnet/minecraft/world/dimension/DimensionType;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_212321_1_,teleporter
|
||||
|
||||
net/minecraft/item/Rarity.create(Ljava/lang/String;Lnet/minecraft/util/text/TextFormatting;)Lnet/minecraft/item/EnumRarity;=|name,p_i48837_3_
|
||||
|
||||
|
||||
@@ -19,32 +19,37 @@
|
||||
|
||||
package net.minecraftforge.debug.client.model;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.FourWayBlock;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.model.IModelTransform;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.obj.OBJLoader;
|
||||
import net.minecraftforge.client.model.obj.OBJModel;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.NonNullLazy;
|
||||
import net.minecraftforge.client.model.IModelBuilder;
|
||||
import net.minecraftforge.client.model.IModelConfiguration;
|
||||
import net.minecraftforge.client.model.IModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.client.model.geometry.ISimpleModelGeometry;
|
||||
import net.minecraftforge.client.model.pipeline.BakedQuadBuilder;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -54,6 +59,10 @@ import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Mod(NewModelLoaderTest.MODID)
|
||||
public class NewModelLoaderTest
|
||||
@@ -105,11 +114,89 @@ public class NewModelLoaderTest
|
||||
new Item(new Item.Properties().group(ItemGroup.MISC))
|
||||
);
|
||||
|
||||
public static RegistryObject<Item> custom_loader = ITEMS.register("custom_loader", () ->
|
||||
new Item(new Item.Properties().group(ItemGroup.MISC))
|
||||
);
|
||||
|
||||
public NewModelLoaderTest()
|
||||
{
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
|
||||
BLOCKS.register(modEventBus);
|
||||
ITEMS.register(modEventBus);
|
||||
|
||||
modEventBus.addListener(this::clientSetup);
|
||||
}
|
||||
|
||||
public void clientSetup(FMLClientSetupEvent event)
|
||||
{
|
||||
ModelLoaderRegistry.registerLoader(new ResourceLocation(MODID, "custom_loader"), new TestLoader());
|
||||
}
|
||||
|
||||
static class TestLoader implements IModelLoader<TestModel>
|
||||
{
|
||||
@Override
|
||||
public void onResourceManagerReload(IResourceManager resourceManager)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TestModel read(JsonDeserializationContext deserializationContext, JsonObject modelContents)
|
||||
{
|
||||
return new TestModel();
|
||||
}
|
||||
}
|
||||
|
||||
static class TestModel implements ISimpleModelGeometry<TestModel>
|
||||
{
|
||||
@Override
|
||||
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<net.minecraft.client.renderer.model.Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
|
||||
{
|
||||
TextureAtlasSprite texture = spriteGetter.apply(owner.resolveTexture("particle"));
|
||||
|
||||
BakedQuadBuilder builder = new BakedQuadBuilder();
|
||||
|
||||
builder.setTexture(texture);
|
||||
builder.setQuadOrientation(Direction.UP);
|
||||
|
||||
putVertex(builder, 0,1,0.5f, texture.getInterpolatedU(0), texture.getInterpolatedV(0), 1, 1, 1);
|
||||
putVertex(builder, 0,0,0.5f, texture.getInterpolatedU(0), texture.getInterpolatedV(16), 1, 1, 1);
|
||||
putVertex(builder, 1,0,0.5f, texture.getInterpolatedU(16), texture.getInterpolatedV(16), 1, 1, 1);
|
||||
putVertex(builder, 1,1,0.5f, texture.getInterpolatedU(16), texture.getInterpolatedV(0), 1, 1, 1);
|
||||
|
||||
modelBuilder.addGeneralQuad(builder.build());
|
||||
}
|
||||
|
||||
private void putVertex(BakedQuadBuilder builder, int x, float y, float z, float u, float v, float red, float green, float blue)
|
||||
{
|
||||
ImmutableList<VertexFormatElement> elements = DefaultVertexFormats.BLOCK.func_227894_c_();
|
||||
for(int i=0;i<elements.size();i++)
|
||||
{
|
||||
switch(elements.get(i).getUsage())
|
||||
{
|
||||
case POSITION:
|
||||
builder.put(i, x, y, z);
|
||||
break;
|
||||
case UV:
|
||||
if (elements.get(i).getIndex() == 0)
|
||||
builder.put(i, u, v);
|
||||
else
|
||||
builder.put(i);
|
||||
break;
|
||||
case COLOR:
|
||||
builder.put(i, red, green, blue, 1.0f);
|
||||
break;
|
||||
default:
|
||||
builder.put(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<net.minecraft.client.renderer.model.Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
|
||||
{
|
||||
return Collections.singleton(owner.resolveTexture("particle"));
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.debug.client.rendering;
|
||||
|
||||
import net.minecraft.entity.passive.CowEntity;
|
||||
|
||||
@@ -52,6 +52,7 @@ public class NewFluidTest
|
||||
|
||||
public static final ResourceLocation FLUID_STILL = new ResourceLocation("minecraft:block/brown_mushroom_block");
|
||||
public static final ResourceLocation FLUID_FLOWING = new ResourceLocation("minecraft:block/mushroom_stem");
|
||||
public static final ResourceLocation FLUID_OVERLAY = new ResourceLocation("minecraft:block/obsidian");
|
||||
|
||||
public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, MODID);
|
||||
public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, MODID);
|
||||
@@ -72,7 +73,7 @@ public class NewFluidTest
|
||||
);
|
||||
|
||||
public static final ForgeFlowingFluid.Properties test_fluid_properties =
|
||||
new ForgeFlowingFluid.Properties(test_fluid, test_fluid_flowing, FluidAttributes.builder(FLUID_STILL, FLUID_FLOWING).color(0x3F1080FF))
|
||||
new ForgeFlowingFluid.Properties(test_fluid, test_fluid_flowing, FluidAttributes.builder(FLUID_STILL, FLUID_FLOWING).overlay(FLUID_OVERLAY).color(0x3F1080FF))
|
||||
.bucket(test_fluid_bucket).block(test_fluid_block);
|
||||
|
||||
public NewFluidTest()
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"parent": "forge:item/default",
|
||||
"loader": "new_model_loader_test:custom_loader",
|
||||
"textures": {
|
||||
"particle": "item/quartz"
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import cpw.mods.modlauncher.Launcher;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.Proxy;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
@@ -122,9 +123,12 @@ public class LaunchTesting
|
||||
// hack the classloader now.
|
||||
try
|
||||
{
|
||||
final Field sysPathsField = ClassLoader.class.getDeclaredField("sys_paths");
|
||||
sysPathsField.setAccessible(true);
|
||||
sysPathsField.set(null, null);
|
||||
final Method initializePathMethod = ClassLoader.class.getDeclaredMethod("initializePath", String.class);
|
||||
initializePathMethod.setAccessible(true);
|
||||
final Object usrPathsValue = initializePathMethod.invoke(null, "java.library.path");
|
||||
final Field usrPathsField = ClassLoader.class.getDeclaredField("usr_paths");
|
||||
usrPathsField.setAccessible(true);
|
||||
usrPathsField.set(null, usrPathsValue);
|
||||
}
|
||||
catch(Throwable t) {}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user